Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/307.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_Gridview - Fatal编程技术网

C# 如何在Gridview中访问特定标签文本

C# 如何在Gridview中访问特定标签文本,c#,asp.net,gridview,C#,Asp.net,Gridview,我在GridView1的EditItemTemplate中使用以下代码 <EditItemTemplate> <asp:Label ID="Label1" runat="server" Text="<%# bind('ftype') %>"></asp:Label> <asp:Label ID="Label2" runat="server" Text="<%# bind('ftname') %>"></

我在
GridView1
EditItemTemplate
中使用以下代码

<EditItemTemplate>
    <asp:Label ID="Label1" runat="server" Text="<%# bind('ftype') %>"></asp:Label>
    <asp:Label ID="Label2" runat="server" Text="<%# bind('ftname') %>"></asp:Label>
    <asp:Label ID="Label3" runat="server" Text="<%# bind('fsname') %>"></asp:Label></br>
    <asp:Label ID="Label4" runat="server" Text="<%# bind('fa1') %>"></asp:Label></br>
    <asp:Label ID="Label5" runat="server" Text="<%# bind('fa2') %>"></asp:Label></br>
    <asp:Label ID="Label6" runat="server" Text="<%# bind('fa3') %>"></asp:Label></br>
    <asp:TextBox ID="TextBox1" Width="30px" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox2" Width="30px" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox3" Width="30px" runat="server"></asp:TextBox>
    <asp:TextBox ID="TextBox4" Width="30px" runat="server"></asp:TextBox>
 </EditItemTemplate>
如何访问
Gridview
中任何
标签的
文本

protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
    Label label = (Label)this.GridView1.Rows[e.NewEditIndex].FindControl("Label4");
    string value = label.Text;
}

请分享您的行编辑功能我已经编辑了我的答案请检查此项。
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
    Label label = (Label)this.GridView1.Rows[e.NewEditIndex].FindControl("Label4");
    string value = label.Text;
}