Posted on: 7/18/2013 3:55:37 AM | Views : 222

I have a TextBox to enter a number. This is AutoPostBack=true and calls NumberOfFiles_Change to dynamically create a TextBox. On submit, I want to get the TextBox.Text. The TextBox is created correctly OnChange, but I can't get the value after submit. I get the error Object reference not set to an instance of an object. on the Response.Write line. However, if I move the creation of the TextBox to Page_Load, it works fine. What am I doing wrong here?
 
Default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>BatchImportPre Generator</title> </head> <body> <form id="form1" runat="server"> <div> Number of Files: ...

Go to the complete details ...