如何将自动生成选择按钮中的文本从选择更改为修改 [英] how to change text in autogenerate select button from select to Modify

查看:125
本文介绍了如何将自动生成选择按钮中的文本从选择更改为修改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用GRIDVIEW.There我想将自动生成选择按钮的TEXT从SELECT更改为MODIFY ...我怎么能这样做?



请让我知道如果不可能这样做...

Thnx ..

解决方案

您可以尝试使用以下代码来更改选择行的文字



 protected void GridView1_RowDataBound(object sender,GridViewRowEventArgs e)
{
GridViewRow row =( GridViewRow)e.Row;
TableCell cell = row.Cells [GridView1.SelectedIndex];


if(cell.Controls.Count> 0)
{
LinkBut​​ton control = cell.Controls [0] as LinkBut​​ton;
if(control!= null)
{
control.Text =Your Modified Text;
}
}
}





希望这有帮助


< blockquote>



请在网格中添加命令栏,如下所示

 <   asp:id     runat   =  server    autogeneratecolumns   =  False < span class =code-attribute>   xmlns:asp   = #unknown >  
< < span class =code-leadattribute> columns >
< asp:commandfield selecttext = 修改 showselectbutton = True / >
< / columns >

< / asp:id >



希望它有所帮助



问候,Mahe


i am using GRIDVIEW.There i want to change TEXT of autogenerate select button from SELECT to MODIFY...How i can do that??

please let me know if its not possible to do so...
Thnx..

解决方案

You can try something like below code to change the text on selecting the row

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    GridViewRow row = (GridViewRow)e.Row;
    TableCell cell = row.Cells[GridView1.SelectedIndex];


    if (cell.Controls.Count > 0)
    {
        LinkButton control = cell.Controls[0] as LinkButton;
        if (control != null)
        {
            control.Text = "Your Modified Text";
        }
    }
}



Hope this helps


Hi,

Please add command column in grid as below

<asp:id runat="server" autogeneratecolumns="False" xmlns:asp="#unknown">
<columns>
  <asp:commandfield selecttext="Modify" showselectbutton="True" />
</columns>

</asp:id>


Hope it helps

Regards,Mahe


这篇关于如何将自动生成选择按钮中的文本从选择更改为修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆