此函数中的“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;
有关可能原因的任何建议吗?
答案 0 :(得分:0)
// 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;
}
}
}