2
I have a form that receives an amount of Textbox that must be instantiated, the page then generates the textboxes, but I do not know how to take the values.
hd = Request.QueryString["qtHD"];
mem = Request.QueryString["qtMem"];
hdnum = Convert.ToInt16(hd);
while (hdnum >= 1)
{
text1 = new TextBox();
String txtBox = "txtTamHD" + hdnum.ToString();
text1.ID = txtBox;
form1.Controls.Add(text1);
hdnum--;
}
Can you please put an example code?
– Leonel Sanches da Silva
Don’t know how to take what values?
– Math
Using this code snippet to create the Textbox, I wanted to get the values the user typed into them.
hd = Request.QueryString["qtHD"]; 
mem = Request.QueryString["qtMem"];
hdnum = Convert.ToInt16(hd); 
 while (hdnum >= 1)
 {
 text1 = new TextBox();
 String txtBox = "txtTamHD" + hdnum.ToString();
 text1.ID = txtBox;
 form1.Controls.Add(text1);
 hdnum--;
 }
– rafaslide
The data submitted by the controls will probably not be in query-string form. Try using Request.Params["qtHD"].
– Miguel Angelo
this is the code is what receives the number and instance the textbox, I’m taking the parameters via GET and is working normally with Querystring, my problem is how to get the data of the controls I’m creating now.
– rafaslide
@rafaslide do not forget to mark as correct the answer that helped you the most. You can also add your answer if none of the others has been satisfactory.
– Andre Calil