locked
Asp.net code RRS feed

  • Question

  • I have 1 text box name: createcontrolbox:...........................................

                                           quantity:........................................................

                             one button   .........create.....................

    i have to enter  suppose:    text ........

                                            5 then

    click button

    it should show me 5 text box.......should be created. i dont ve to use javascript. onlu c# and asp.net.

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title></title>
       
    </head>
    <body>
    <table>
    <tr>
    <td>
    <label for="ctrlname"> Createcontrol*</label></td>
    <td><input  type="text" id ="Text1" name="Createcontrol" maxlength="50" size="30"/></td>
    </tr>
    <tr>
    <td><label for="quantity"> quantity*</label></td>
    <td><input  type="text" id ="Text2" name="quantity" maxlength="50" size="30"/></td>
    </tr>
    <tr>
    <td><input  type="button" id ="btncr" value= "create" /></td>
    
    </tr>
    
    
    
    
    
    </table>
    
    </body>
    </html>


    thanks and regard love4csharp


    Tuesday, March 5, 2013 4:14 PM

Answers

  •  protected void btncr_Click(object sender, EventArgs e)
        {

            for (int i= 0; i < Convert.ToInt32(Text2.Text); i++)
            {

                TextBox txt = new TextBox();
                txt.ID = "TextBox" + i.ToString();
                txt.Text = "TextBox " + i.ToString();
                Form.Controls.Add(txt);   

            } 

        }

    thanks and regard love4csharp

    • Marked as answer by love4csharp Tuesday, March 5, 2013 5:45 PM
    Tuesday, March 5, 2013 5:45 PM

All replies

  • i dont know where to post. so srry for that. 

    if any problem related to ques then plz ask me.


    thanks and regard love4csharp

    Tuesday, March 5, 2013 4:25 PM
  • There is a forum specifically for C# in web apps, here:

    http://forums.asp.net/37.aspx/1?C+

    Tuesday, March 5, 2013 4:33 PM
  •  protected void btncr_Click(object sender, EventArgs e)
        {

            for (int i= 0; i < Convert.ToInt32(Text2.Text); i++)
            {

                TextBox txt = new TextBox();
                txt.ID = "TextBox" + i.ToString();
                txt.Text = "TextBox " + i.ToString();
                Form.Controls.Add(txt);   

            } 

        }

    thanks and regard love4csharp

    • Marked as answer by love4csharp Tuesday, March 5, 2013 5:45 PM
    Tuesday, March 5, 2013 5:45 PM