Hello everyone,
Below is my code:
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
touchpay.fillcombo(dpwcompany, "select company_id,company_name from company_master");
}
}
protected void btnadd_Click(object sender, EventArgs e)
{
for(int i=0; i<Convert.ToInt32(DropDownList1.SelectedValue); i++)
{
TextBox textBox =(TextBox)Panel1.FindControl("myTextBox" + i);
if (textBox != null)
{
touchpay.exce("Insert into card_pin_master(company_id,card_type,pin,card_id) values('" + dpwcompany.SelectedValue + "','" + dpwtype.SelectedValue + "','" + textBox.Text+ "',"+dpwcardname.SelectedValue+"')");
}
}
}
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
for (int x = 0; x < Convert.ToInt32(DropDownList1.SelectedValue); x++)
{
TextBox textarray = new TextBox();
textarray.ID = "myTextBox" + x.ToString();
Label lb = new Label();
lb.Text = textarray.ID;
Panel1.Controls.Add(textarray);
Panel1.Controls.Add(lb);
}
}
protected void dpwtype_SelectedIndexChanged(object sender, EventArgs e)
{
touchpay.fillcombo(dpwcardname, "select card_name,card_id from card_info_master where company_id='" + dpwcompany.SelectedValue + "' and card_type='" + dpwtype.SelectedValue + "'");
}
In this code,If u select 4 in dropdownlist then 4 textbox is created.Now i want to insert the values of that textbox in database.Then tell me how can i get the values of that textboxes.
thanx in advance..