Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何访问gridview标题中的控件?_C#_Asp.net_Events_Gridview - Fatal编程技术网

C# 如何访问gridview标题中的控件?

C# 如何访问gridview标题中的控件?,c#,asp.net,events,gridview,C#,Asp.net,Events,Gridview,我想为我的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">

我想为我的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标题中的标签和图像按钮,以设置标签值并处理按钮事件,以便更改标签值。如何执行此操作?

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

您可以看到标题中的控件吗?我认为服务器控件在标题中不起作用,至少我看不到它们。