Pulling Radgrid Values For Use On a Small Site
I have a grid that I am extracting the values (maybe3 or so) from to 开发者_开发问答use over multiple aspx pages and was curious as to the easiest ways to do so.
Are cookies the best way to go or is there a more simple solution? Best practices aside, I'm really just looking for a quick way at doing this.
Thanks.
You can do this easily via Session variables. Although it is frowned upon to do so, due to problems you run into if you use too many. If you just need a simple fix use this code in conjunction with the ItemCommand event on your grid:
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
Session["thenameofthevariable"] = e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["nameofyourDataKeyNamesregisteredinyourgrid"];
}
精彩评论