473,587 Members | 2,550 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(ob ject sender, System.EventArg s e)
{
selectQuery();
}
private void selectQuery()
{
try
{

strcondition="s elect * from Student"
DataView dv ;
dv =
VS.DAC.PDMO.Gen eralDesMng.Sear chSectionsLines ByDistrict(strc ondition);
if (dv.Count 0)
{
Label number_Label =
(Label)searchRe sult_DataGrid.F indControl("num Header_Label");
number_Label.Te xt=
dv[0]["NumUnit"].ToString();
Label capacity_Label =
(Label)searchRe sult_DataGrid.F indControl("cap Header_Label");
capacity_Label. Text
=dv[0]["CapUnit"].ToString();
Label address_Label =
(Label)searchRe sult_DataGrid.F indControl("add rHeader_Label") ;
address_Label.T ext=dv[0]["AddrUnit"].ToString();
}
searchResult_Da taGrid.DataSour ce = dv;
searchResult_Da taGrid.DataBind ();
}
catch(Exception ex)
{
Response.Write( "<script
language=Javasc riptalert('"+
ex.Message.ToSt ring()+"') ;</script>");
}
}

Aug 4 '06 #1
0 953

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

Similar topics

3
4830
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 child and bind it to a grid. Like that it goes on for the next parent and the related child for the next button click.
0
4222
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 formating. the datagrid also has paging. I'm doing a ASP.NET guestbook. I know some things could be improved like adding some error handling and caching...
3
2724
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 folder of flag images, named in relations to the countries database ID. Current data grid code is...
3
2047
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 not declared". The data bind is for a DataList.)
2
3669
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 checkbox in the datagrid, if it is checked, it updates the corresponding rows prices. That works, no problem. What I need to do is that when a user...
11
4649
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 the information I need programmatically, but what about the databind property I just don't understand it's value.
0
1097
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 same datasource(Dataset) and Share the same BINDINGCONTEXT ie on clicking a record in the grid;we can see the same record in the groupbox. ...
2
8586
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 ID="datagrid" Runat="server" ShowHeader="True"> <Columns> <asp:TemplateColumn> <HeaderTemplate> <asp:Label ID="Label1" Runat="server" Text='<%#
0
1407
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 tell me what is the solution behind them. private void search_Click(object sender, System.EventArgs e) { selectQuery(); } private void...
0
7920
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8215
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8347
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7973
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5394
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3844
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2358
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1454
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1189
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.