Catch TextBox value entered by user into the GridView Templated Field (both created dynamically) on

T

Tatyana

Hello,



I was wondering if anybody knows how to get the values entered by the user
into the GridView Templated Field (both created dynamically) which is a
textbox.

Usually it could be



<asp:TextBox id="textbox1" OnTextChanged="TextBoxTextChanged" runat="server"
/>



and then

protected void TextBoxTextChanged(object sender, EventArgs e)

{TextBox txt_b = (TextBox)sender;

NewText = txt_b.Text;}

The reason that it didn't work is because we have multiple gridviews created
dynamically in code-behind, along with Templated Fields one of them is a
TextBox.

I'm trying to get entered by user data on the PostBack. But I either get the
same text pre-populated on gridviews creation (if I don't check on the
postback) or I'm getting a null for GridView (if I check on PostBack and do
not create all controls again on postback).

I was able to Add the OnTextChanged="TextBoxTextChanged" Attribute to the
TextBox. When text changes on submit button click event is not working.

Thank you,

Tatyana
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top