473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Binding data to datagrid header template on button click

Dear all i want to bind data to the controls in the datagrid header
template on button click event which is not in the datagrid . i am
writting following code but it gives an error.
can any one tell me what is the solution behind them.

private void search_Click(object sender, System.EventArgs e)
{
selectQuery();
}
private void selectQuery()
{
try
{

strcondition="select * from Student"
DataView dv ;
dv =
VS.DAC.PDMO.GeneralDesMng.SearchSectionsLinesByDis trict(strcondition);
if (dv.Count 0)
{
Label number_Label =
(Label)searchResult_DataGrid.FindControl("numHeade r_Label");
number_Label.Text=
dv[0]["NumUnit"].ToString();
Label capacity_Label =
(Label)searchResult_DataGrid.FindControl("capHeade r_Label");
capacity_Label.Text
=dv[0]["CapUnit"].ToString();
Label address_Label =
(Label)searchResult_DataGrid.FindControl("addrHead er_Label");
address_Label.Text=dv[0]["AddrUnit"].ToString();
}
searchResult_DataGrid.DataSource = dv;
searchResult_DataGrid.DataBind();
}
catch(Exception ex)
{
Response.Write("<script
language=Javascriptalert('"+
ex.Message.ToString()+"') ;</script>");
}
}

Aug 4 '06 #1
0 945

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Dinesh_GR | last post by:
Hi all, I have many parent tags and many child tags under the respective parent.. in an XML file. On the click of a button the application should pick up the one parent and the corresponding...
0
by: lucas | last post by:
Hi, I have a simple input form that i use to add records to a sql server database. Bellow that is a datagrid that has one template column that I use to dispaly the 3 fields with some html...
3
by: Simon Harris | last post by:
Hi All, I have a data grid which displays country names. I now wish to display the country flag images above the names. Can someone please advise how I display an image in a datagrid? I have a...
3
by: bbernieb | last post by:
Hi, All, Is it possible to access a variable inside of a data binding, without the variable being out of scope? (Note: On the DataBinder line, I get an error message that says "Name 'i' is...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
11
by: Rourke Eleven | last post by:
I have looked and searched. What good is the databind property on Radiobuttons? How does one go about actually using it? What is a good resource on this? I understand that I can easily get/set...
0
by: A.J | last post by:
There is a : 1.DataGrid: Columns-->firstName,LastName,EMail,PhoneNumber 2.GroupBox: controls-->4 TextBoxes(firstName,LastName,EMail,PhoneNumber) 3.Both DataGrid and GroupBox are binded to the...
2
by: Santosh | last post by:
Dear all i want to bind data to datagrid header template i am wrtting follwing code it is displaying data with in item template not but it is display data in header template <asp:DataGrid...
0
by: Santosh | last post by:
Dear all i want to bind data to the controls in the datagrid header template on button click event which is not in the datagrid . i am writting following code but it gives an error. can any one...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.