I want to populate a radgid using values from my database. This grid contains a radio button column. I want to check the radio button for the row in which datakeyname value equals say 'X'. How can i achieve this?? I already have the value "X with me.
mridulraj13
Member
6 Points
18 Posts
how to the the datakeynames of nth row a radgrid??
Mar 07, 2012 11:34 AM|LINK
how to the the datakeynames of nth row a radgrid??
karang
Contributor
2439 Points
918 Posts
Re: how to the the datakeynames of nth row a radgrid??
Mar 07, 2012 12:05 PM|LINK
Hi
Please elaborate more about your problem
Karan Gupta
http://gyansangrah.com
Please click "Mark as Answer" if this helped you.
mameenkhn
Contributor
2026 Points
391 Posts
Re: how to the the datakeynames of nth row a radgrid??
Mar 07, 2012 12:10 PM|LINK
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) { if (e.CommandName == RadGrid.EditCommandName) { Response.Write("Primary key for the clicked item from ItemCommand: " + (e.Item as GridDataItem).GetDataKeyValue("CustomerID").ToString() + "<br>"); } } protected void RadGrid1_SelectedIndexChanged(object sender, System.EventArgs e) { Response.Write("Primary key for the clicked item from SelectedIndexChanged: " + RadGrid1.SelectedItems[0].GetDataKeyValue("CustomerID").ToString() + "<br>"); }--------------------------------------------------
Muhammad Amin
محمد امين
srinivaskotr...
Star
11228 Points
1792 Posts
Re: how to the the datakeynames of nth row a radgrid??
Mar 07, 2012 12:15 PM|LINK
hi
refer this
http://forums.asp.net/t/1742208.aspx/1 (answered forum)
http://www.velocityreviews.com/forums/t119713-get-datakey-on-rowdatabound.html
Thanks,
Srinivas Kotra.
mridulraj13
Member
6 Points
18 Posts
Re: how to the the datakeynames of nth row a radgrid??
Mar 07, 2012 12:20 PM|LINK
Hi,
I want to populate a radgid using values from my database. This grid contains a radio button column. I want to check the radio button for the row in which datakeyname value equals say 'X'. How can i achieve this?? I already have the value "X with me.
incubator138...
Member
280 Points
70 Posts
Re: how to the the datakeynames of nth row a radgrid??
Dec 14, 2012 08:11 AM|LINK
Hi,
Please check the following code snippet to check RadioButton for the row with given DatakeyValue.
C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) { if (e.Item is GridDataItem) { GridDataItem item=(GridDataItem)e.Item; if (item.GetDataKeyValue("DataKeyName").ToString() == "100") { RadioButton RadBtn = (RadioButton)item.FindControl("RadioButton1"); RadBtn.Checked = true; } } }Thanks,
Shinu.