【问题标题】:how to change radgrid's GridButtonColumn's text in radgrid's ItemCommand event?如何在 radgrid 的 ItemCommand 事件中更改 radgrid 的 GridButtonColumn 的文本?
【发布时间】:2011-01-11 13:15:36
【问题描述】:

我有一个以 GridButtonColumn 作为列之一的 radgrid。我需要在 ItemCommand 事件期间更改网格中显示的该列的文本。 例如。 如果在 ItemCommand 事件之后文本为“是”,则应将其更改为“否”。 我们如何实现这一点?

【问题讨论】:

    标签: gridview radgrid


    【解决方案1】:

    见:How to change GridButtonColumn image/text at runtime

    protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item;
            LinkButton lbutton = item["ButtonUniqueName"].Controls[0] as LinkButton;
            if (lbutton.Text == "yes") 
            { 
               lbutton.Text = "no";
            } 
        } 
    } 
    

    【讨论】:

    • 这对我来说很神奇,因为我试图通过 item 命令事件获取行信息。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-17
    • 2015-05-02
    • 2023-04-10
    • 1970-01-01
    相关资源
    最近更新 更多