GridView中的ButtonField [英] ButtonField in a GridView

查看:90
本文介绍了GridView中的ButtonField的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过VB.net访问按钮字段中的text属性.

< asp : ButtonField ButtonType ='" Button" CommandName ="triggerState"
<字体颜色=#ff0000" size = 2> HeaderText <字体颜色=#0000ff" size = 2> =阶段完成?" ShowHeader =" True" 文本 ="按钮">
< HeaderStyle 环绕 =真" />
</ asp : ButtonField >


我正在使用的代码是:

受保护的 Sub GridView1_RowCommand( ByVal 发送者 As 对象 ByVal e As System.Web .UI.WebControls.GridViewCommandEventArgs) 句柄 GridView1.RowCommand
Dim
rowIndex As 整数 = Convert.ToInt32(e.CommandArgument)
昏暗 pkID As Integer
= Convert.ToInt32(GridView1.DataKeys(rowIndex).Value )
GridView1.Columns(7).Visible =
True
GridView1.Rows(rowIndex).Cells(6).Text =

GridView1.Rows(rowIndex).Cells(7).Text =
&; Rejected";

但是,它不起作用.文本不会改变.

解决方案

MSDN 论坛首页> Visual Basic > Visual Basic互操作和升级位于: http://social.msdn.microsoft.com/forums/zh-CN/vbinterop/threads/.

<asp:ButtonField ButtonType="Button" CommandName="triggerState" 
    
HeaderText="Phase Complete?" ShowHeader="True" Text="Button">
    <HeaderStyle Wrap="True" />
</asp:ButtonField>


The code I'm using is:

Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView1.RowCommand
    Dim
rowIndex As Integer = Convert.ToInt32(e.CommandArgument)
    Dim pkID As Integer
= Convert.ToInt32(GridView1.DataKeys(rowIndex).Value)
    GridView1.Columns(7).Visible =
True
    GridView1.Rows(rowIndex).Cells(6).Text =
"Approved"
    GridView1.Rows(rowIndex).Cells(7).Text =
"Rejected"

    ObjectDataSource1.DataBind()
    GridView1.DataBind()
End Sub


It's not working however. The text doesn't change.

解决方案

Hi, 

 

Thank you for your post!  I would suggest posting your question in one of the MSDN > Forums Home > Visual Basic > Visual Basic Interop and Upgrade located here:  http://social.msdn.microsoft.com/forums/en-US/vbinterop/threads/.

Have a great day!


这篇关于GridView中的ButtonField的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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