此函数中的"id“字符串有一个值,但它没有显示在标签中。我有一个断点,我可以清楚地看到这样的价值。
protected void RadTreeList1_ItemCommand(object sender, TreeListCommandEventArgs e)
{
string id = "";
if (e.CommandName == "Select")
{
if (e.Item is TreeListDataItem)
{
TreeListDataItem item = e.Item as TreeListDataItem;
id = item.GetDataKeyValue("MessageID").ToString();
}
}
Label2.Text = id;
}更新并且不像这样工作:
....
string id = item.GetDataKeyValue("MessageID").ToString();
Label2.Text = id;对可能的原因有什么建议?
发布于 2014-12-30 05:55:56
// try this Put Label2.Text = id; in if (e.Item is TreeListDataItem)
protected void RadTreeList1_ItemCommand(object sender, TreeListCommandEventArgs e)
{
string id = "";
if (e.CommandName == "Select")
{
if (e.Item is TreeListDataItem)
{
TreeListDataItem item = e.Item as TreeListDataItem;
id = Convert.ToString(item.GetDataKeyValue("MessageID")) ;
Label2.Text = id;
}
}
}https://stackoverflow.com/questions/27699310
复制相似问题