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

How to update ClientDataKeyNames

2 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 23 Mar 2010, 03:52 PM
I have need to update the ClientDataKeyNames on ItemDataBound.

My Aspx page has:

<MasterTableView ClientDataKeyNames="MyName" >

My Code behind has:

protected void grdMasterList_ItemDataBound(object sender, GridItemEventArgs e)
{
  //  Need to update ClientDataKeyNames here
}

How can I update ClientDataKeyNames so it gets reflected in the aspx page?

Thanks.

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Mar 2010, 08:19 AM

Hello Steve,

Checkout the following forum link which descusses how to manipulate the ClientDataKeyNames from code.

Dynamic ClientDataKeyNames

-Shinu.

0
Steve
Top achievements
Rank 1
answered on 24 Mar 2010, 05:36 PM
Shinu,

I need to be able to access the values contained within the ClientDataKeysName Collection. So, when the ItemDataBound event fires, I need to update the values in ClientDataKeysName.  So when the control is rendered to the page, the updated value is reflected.

In Code behind, I would have something like:

private void BindGrid()
{
RadGrid1.DataSource = MyDataSource();  // returns a dataset
RadGrid1.DataBind();
}

protected void grdMasterList_ItemDataBound(object sender, GridItemEventArgs e)
{
  //  Need to update ClientDataKeyNames collection here.  How?

}

In aspx page, the RadGrid1 has the following:
...
<MasterTableView ClientDataKeyNames="MyName">
...

I am not sure where/how the appropriate place is to up the collection?  When does the ClientDataKeyNames Collection get populate?

Thanks.

Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Steve
Top achievements
Rank 1
Share this question
or