Handling dynamically generated textbox in a datalist

G

Gaurav Gargate

Hi Group,

I am creating a ASP.NET (C#) project.
I am creating a datalist with some dynamically generated text boxes in the
edit template.
I have the datalist control on the form. The text box is written on the form
at run time.
Using Response.Write() on the EditTemplate I write the HTML code required
for the text box along with the data and the ID for the text box.

On the Update event of the datalist I try to read the value from the text
box.
I am doing a FindControl (<text box id which was inserted into the HTML
code>).
But I get an 'Object reference not set to an instance of an object' error.

When I put a text box in the EditTemplate of the datalist at the design
time, I can read the values of the data in it.
But the same does not happen when the text box is created on run time...

How can I read the data from the text box created at run time.
Should I use a different method of creating a text box at run time, instead
of writing the HTML code on the form.

Thanks in advance,
Gaurav
 

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

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top