I have a page which contains gridview and button now i want to add gridview values to database table when i click on button, but when i click on button and try to get value using find control its not showing any value it shows value as blank. my code is given below
aspx page
<%@ Page Title="" Language="C#" MasterPageFile="Masters.Master" AutoEventWireup="true" EnableEventValidation ="false" CodeBehind="test.aspx.cs" Inherits="test" UICulture="hi-IN" Culture="hi-IN" %>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnDataBound="GridView1_DataBound"
OnRowDataBound="GridView1_RowDataBound" BackColor="White" BorderColor="White"
BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical">
<asp:TemplateField Visible="true">
<HeaderTemplate>
<asp:Label ID="lbl4" runat="server" Text="test."></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lbltestno" runat="server" Text='<%# Bind("testing") %>' Visible="true"></asp:Label><br style="mso-data-placement:same-cell;"/>
</ItemTemplate>
</asp:TemplateField>
.cs page
on button click
foreach (GridViewRow GvRow in GridView1.Rows)
{
Label lblvinnos = (Label)GvRow.FindControl("lbltestno");
}
Please note that this page is working fine when i use without master page but when i am using master page its showing find control values as null
I just checked its finding textbox value not of labels any particular reason?