首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >我不能在标签中显示值。

我不能在标签中显示值。
EN

Stack Overflow用户
提问于 2014-12-30 03:40:34
回答 1查看 122关注 0票数 0

此函数中的"id“字符串有一个值,但它没有显示在标签中。我有一个断点,我可以清楚地看到这样的价值。

代码语言:javascript
复制
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;
}

更新并且不像这样工作:

代码语言:javascript
复制
....
string id = item.GetDataKeyValue("MessageID").ToString();
Label2.Text = id;

对可能的原因有什么建议?

EN

回答 1

Stack Overflow用户

发布于 2014-12-30 05:55:56

代码语言:javascript
复制
// 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;
        }
    }

}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27699310

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档