hello guys how r u ?
Q: my Question is that , how can i get the value of text box which i built in gridview through the item template field?
i was try like this but i did not get the value
<asp:GridView ID="GridView1" runat="server" BackColor="#CCCCCC"
BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4"
CellSpacing="2" ForeColor="Black" ShowFooter="True">
<RowStyle BackColor="White" />
<Columns>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False"
CommandName="Select" Text="Select"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Answer">
<FooterTemplate>
<asp:LinkButton ID="lbnSubmit" runat="server" onclick="lbnSubmit_Click">Submit</asp:LinkButton>
</FooterTemplate>
<ItemTemplate >
<asp:TextBox ID="txtAnswer" runat="server">Answer</asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCCCC" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:GridView>
string data;
protected void lbnSubmit_Click(object sender, EventArgs e)
{
foreach (GridViewRow gvr in GridView1.Rows)
{
data = gvr.Cells[1].Text;
}
Response.Write(data);
}
reply soon please its urgent...