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

Remove rows randomly

2 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roy Halvorsen
Top achievements
Rank 1
Roy Halvorsen asked on 18 Nov 2011, 05:17 PM
How can I remove a row from a RadGrid randomly by clicking a button outside the RadGrid? Let's say I am using random numbers, and I want the row with the same index as the random number i create to be removed. But I also want to get the DataKeyName from that row so I can use it to tell in a label what row has been removed.
Roy

2 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Nov 2011, 06:01 PM
Hello,

You can find datakey by using index with the help of below code.

string strID = RadGrid1.MasterTableView.Items[1].GetDataKeyValue("ID").ToString();
 
//Remove Item index was "1"


Thanks,
Jayesh Goyani
0
hurman
Top achievements
Rank 1
answered on 15 Jan 2020, 12:17 PM
I have read what you have written but i think i have a better plan to solve it
i found a video on it on YouTube (he practically explain everything in his video)
How to generate unique random numbers in asp.net using c#
https://youtu.be/7R4jm-40rCc
Tags
Grid
Asked by
Roy Halvorsen
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
hurman
Top achievements
Rank 1
Share this question
or