This is a migrated thread and some comments may be shown as answers.

How do you get the value of the clicked GridHyperLinkColumn row?

3 Answers 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Big
Top achievements
Rank 1
Big asked on 16 May 2012, 08:53 PM
When a user clicks on the GridHyperLinkColumn in a particular row, how can only get that value back?

I want to reiterate through, but I want only the selected GridHyperLinkColumn value of "Name" below.  

That's it.

???? 


protected void grdData_ItemDataBound(object sender, GridItemEventArgs e)
       {
           if (e.Item is GridDataItem)
           {
               GridDataItem item = (GridDataItem)e.Item;
               HyperLink link = (HyperLink)item["Name"].Controls[0];
               
           }
       }

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 May 2012, 06:01 AM
Hello,

Try accessing the hyperlink column value in SelectedIndexChanged event as follows.
C#:
void RadGrid1_SelectedIndexChanged(object sender, EventArgs e)
{
   foreach (GridDataItem item in RadGrid1.SelectedItems)
  {
      HyperLink link = (HyperLink)item["Name"].Controls[0];
  }
}
Note:Set EnablePostBackOnRowClick as true in ClientSettings.

Thanks,
Shinu.
0
Big
Top achievements
Rank 1
answered on 17 May 2012, 02:03 PM
That kind of gets me where I want to go, but not completely.

If that GridHyperLink is clicked in a row, can I fire off the SelectedIndexChange method in the codebehind?

Right now, the user can select the row by clicking in the horizontal area of that row and it fires off the SelectedIndexChange
which raises an event that changes another user control on the page.   When the user clicks the GridHyperLink (and not the
area for selected changes) we want the same behavior to happen.

Is this possible?  To tie in SelectedIndexChange to the GridHyperLink onclick event?


Thanks!
0
Richard
Top achievements
Rank 1
answered on 18 May 2012, 10:20 PM
BIg:

Please reference the solution that I have provided in your other open forum thread:

http://www.telerik.com/community/forums/aspnet-ajax/grid/onselectedindexchanged-fires-when-onselectedindexchanged-clicked.aspx

Cheers!
Tags
Grid
Asked by
Big
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Big
Top achievements
Rank 1
Richard
Top achievements
Rank 1
Share this question
or