How to save values of dynamically added textboxes into database in asp.net
<p>Hi
I have created no. of textboxes(that no entered by user in txtcount textbox) dynamically.
But i want to store those values into database. For that i used code in save button click event as follows :</p>

<pre><code>protected void btnsave_Click(object sender, EventArgs e)
    {
        // Check how many textboxes the user created
        int count = Convert.ToInt32(txtcount.Text); 
        // Loop through them    
        for (int i=0; i &lt; count; i++)
        {         
            // Get the TextBox      
            TextBox textbox = (TextBox)Page.FindControl("TextBox_" + i); 
            // Get the value      
            string val = textbox.Text;

            Response.Write(val);

         } 
    } 
</code></pre>

<p>But its giving error :</p>

<pre><code>Object reference not set to an instance of an object.
</code></pre>

<p>What should i do?
Please help me?
Thank you.</p>
