Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > RE: fire event when click on specific cell in dataGrid using asp.net

Reply
Thread Tools

RE: fire event when click on specific cell in dataGrid using asp.net

 
 
=?Utf-8?B?YW5nc3JhbQ==?=
Guest
Posts: n/a
 
      07-28-2004
In order to add click event to the entire row of datagrid, add a link button as a hidden column to the datagrid and then in ItemDataBound event of datagrid, we can attribute the link click event to the entire row in the following way :
//Get the link button
LinkButton lnkButton = (LinkButton)grdEventArgs.Item.Cells[0].Controls[0];

// add the click event to the entire list item
grdEventArgs.Item.Attributes["onclick"] = Page.GetPostBackClientHyperlink(lnkButton, "");

thats it..when the user clicks on the row, the row is selected and SelectedIndex event is fired which we can catch in the code behind and get the SelectedIndex value.
hope this answers you.

 
Reply With Quote
 
 
 
 
=?Utf-8?B?dGVuemVlbC4=?=
Guest
Posts: n/a
 
      07-31-2004
pleaze tell me how we can use selectedindexchange event. because i am using nested grid. when i click on child datagrid then that row is selected. the selectedindexchange event also fired. but problem is how i get the specific cell value.where i click in child dataGrid. because the event arguments has two methods. empty and gettype. plz help me out.

"angsram" wrote:

> In order to add click event to the entire row of datagrid, add a link button as a hidden column to the datagrid and then in ItemDataBound event of datagrid, we can attribute the link click event to the entire row in the following way :
> //Get the link button
> LinkButton lnkButton = (LinkButton)grdEventArgs.Item.Cells[0].Controls[0];
>
> // add the click event to the entire list item
> grdEventArgs.Item.Attributes["onclick"] = Page.GetPostBackClientHyperlink(lnkButton, "");
>
> thats it..when the user clicks on the row, the row is selected and SelectedIndex event is fired which we can catch in the code behind and get the SelectedIndex value.
> hope this answers you.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to fire both event button click and textchanged when button is click and text is changed Amy ASP .Net 0 06-01-2006 02:33 PM
Re: fire event when click on specific cell in dataGrid using asp.net Eliyahu Goldin ASP .Net 1 07-31-2004 12:11 PM
Fire event when clicking on the specific cell =?Utf-8?B?dGVuemVlbC4=?= ASP .Net 2 07-28-2004 11:00 AM
Re: fire event when click on specific cell in dataGrid using asp.net Cory D. ASP .Net 1 07-28-2004 10:27 AM
Re: fire event when click on specific cell in dataGrid using asp.net John Saunders ASP .Net 0 07-27-2004 09:31 PM



Advertisments