【问题标题】:How to Access the controls in the caption of the gridview?如何访问gridview标题中的控件?
【发布时间】:2013-05-09 20:13:14
【问题描述】:

我想给我的 gridview 加上一个标题,所以我做了以下事情:

<asp:GridView ID="gv_employee" runat="server" AllowPaging="True" AllowSorting="True"
        AutoGenerateColumns="False" Caption='<table width="100%" class="TestCssStyle"><tr><td class="text_Title"><asp:Label runat="server" Id="lbl_gv_title"></asp:Label></td><td><asp:ImageButton runat="server" id="ibtn_edit_master"  ImageUrl="~/Images/editsmall.png" ValidationGroup="G1"></asp:ImageButton></td></tr></table>'
        CssClass="forms" DataKeyNames="valueskey" HorizontalAlign="Center" OnPageIndexChanging="gv_inbox_PageIndexChanging"
        OnRowCommand="gv_inbox_RowCommand" OnRowDataBound="gv_inbox_RowDataBound" TabIndex="2"
        Width="600px">

    </asp:GridView>

我想访问我的 gridview 标题中的标签和图像按钮来设置标签的值并处理按钮的事件,以便我可以更改标签值。如何做到这一点?

【问题讨论】:

  • 你能看到标题中的控件吗?我认为服务器控件不会在字幕中起作用,至少我看不到它们。

标签: c# asp.net events gridview


【解决方案1】:

不用给asp控件labell和图片按钮,可以给html控件 元素作为标题。然后您可以分配divid.innerHtml=gridviewid.caption.Tostring(),然后您可以为该输入元素按钮编写客户端脚本。

【讨论】:

    猜你喜欢
    • 2010-10-11
    • 2011-07-12
    • 1970-01-01
    • 2015-07-31
    • 2013-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多