是否有办法将对象从DataKeyArray强制转换为ASP.Net中的String
本文关键字:转换 ASP Net String 中的 DataKeyArray 对象 是否 | 更新日期: 2023-09-27 18:27:38
我试图将一个对象从DataKeyArray转换为String,但我得到了以下错误:
Cannot convert type 'System.Web.UI.WebControls.DataKey' to 'string'
有人解决这个问题吗。这是我产生错误的代码:
int index = (int)GridView1.SelectedIndex;
HttpContext.Current.Session["Order"] = (String)GridView1.DataKeys[index];
Response.Redirect("Test.aspx");
尝试:
GridView1.DataKeys[Index].Value