Monday, August 9, 2010

Simpler way to get the selected RadGrid row's primary key and description(or other fields)

Much simpler than SelectedIndexChanged

protected void grdCategory_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
    if (e.Item is GridDataItem)
    {                
        var item = (GridDataItem)e.Item;
        TextBox1.Text = item["category_description"].Text;         
        TextBox2.Text = item.GetDataKeyValue("category_id").ToString();
    }
}

No comments:

Post a Comment