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

Click to fetch cell value

1 Answer 18 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lovella Bacaud
Top achievements
Rank 1
Lovella Bacaud asked on 05 Apr 2013, 02:31 AM
Hi,

On clicking a particular cell in a RadGrid, is it possible to fetch that cell value using client-side code?

Thanks,
Lovella.

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 1
answered on 05 Apr 2013, 05:17 AM
Hi,

Try the following code.
C#:
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridDataItem)
        {
            GridDataItem item = (GridDataItem)e.Item;
            TableCell cell = (TableCell)item["Uniquename"];
            cell.Attributes.Add("onclick", "Click('" +cell.Text + "');");
       }
}
JS:
function Click(value) {
       alert(value);
   }

Thanks,
Shinu
Tags
Grid
Asked by
Lovella Bacaud
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or