TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Pankaj Singh
NA
97
0
Get Text of Gridview TextBox on button click
Apr 13 2012 12:31 PM
Hi,
I want to get the text of TextBox of gridview on Button click.
I am using following code:
source code-
<asp:GridView ID="Gridview1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
CellPadding="3"
style="font-size: small; font-family: Arial">
<RowStyle ForeColor="#000066" />
<Columns>
<asp:BoundField DataField="Data_type" HeaderText="type" />
<asp:BoundField DataField="column_name" HeaderText="Column" />
<asp:TemplateField HeaderText="Value">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
cs file code:
protected void btninsert_Click(object sender, EventArgs e)
{
for (int i = 0; i <= Gridview1.Rows.Count - 1; i++)
{
TextBox txt1 = (TextBox)Gridview1.Rows[i].Cells[2].FindControl("TextBox1");
string str=txt1.Text;
}
but in str I am getting only space "". plz help me
Thanks in advance
Reply
Answers (
2
)
How to config smtp server
Image Control