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

How to get RadGrid ID dynamically

4 Answers 191 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Web team
Top achievements
Rank 1
Web team asked on 23 Apr 2010, 09:05 AM
Hi,

I want to get the ID of the radgrid on delete and edit command.

i tried e.item.parent.uniqueid but i am getting something like this: "ctl00$ContentPlaceHolder1$grdName$ctl00$ctl00"

I just want to get the "grdName" part without parsing the string. thanks.

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 23 Apr 2010, 09:58 AM
Hello Arnold,

Try following code in order to get the grid ID.

        string id = e.Item.OwnerGridID.ToString();

Regards,
Princy.
0
Web team
Top achievements
Rank 1
answered on 23 Apr 2010, 10:15 AM
thanks for the response, how bout during NeedDataSource event?
0
Veli
Telerik team
answered on 23 Apr 2010, 11:27 AM
Hi Arnold,

The sender object in the event handler is the  RadGrid instance that fires the NeedDataSource event, so you can simply try ((RadGrid)sender).ID.

All the best,
Veli
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Web team
Top achievements
Rank 1
answered on 26 Apr 2010, 02:39 AM
That seem to work. Thanks again.
Tags
Grid
Asked by
Web team
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Web team
Top achievements
Rank 1
Veli
Telerik team
Share this question
or