Webboy2008
asked on
asp.net c# ascx
Please view my attached codes...how can i capture the value from the attached code
and save into the database?
protected void BtnSubmit_Click(object sender, EventArgs e)
{
//How can I capture the textbox value?
}
I tried the following codes and it does not work...
TextBox tb = (TextBox)this.Page.FindCon trol("TxtI tem_1");
if (tb != null)
Label2.Text = tb.Text;
else
{
Label2.Text = "Nothing";
}
and save into the database?
protected void BtnSubmit_Click(object sender, EventArgs e)
{
//How can I capture the textbox value?
}
I tried the following codes and it does not work...
TextBox tb = (TextBox)this.Page.FindCon
if (tb != null)
Label2.Text = tb.Text;
else
{
Label2.Text = "Nothing";
}
protected void DdlTotalItem_SelectedIndexChanged(object sender, EventArgs e)
{
int TotalItemCount = int.Parse(DdlTotalItem.SelectedValue);
if (TotalItemCount >= 1)
{
// DdlTotalItem.Visible = true;
MasterListItem.Visible = true;
MasterListItemTable.Visible = true;
for (int i = 0; i < TotalItemCount; i++)
{
Obout.Interface.OboutTextBox ItemTextBox = new Obout.Interface.OboutTextBox();
ItemTextBox.ID = "TxtItem_" + i;
ItemTextBox.Width = 150;
DivItemCode.Controls.Add(ItemTextBox);
}
}
else
{
MasterListItem.Visible = false;
MasterListItemTable.Visible = false;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To both....Your codes won't work because I have a for loop to generate the id for each text box.
how can add a code like FindControl("Txtitem_i")?
Thanks
how can add a code like FindControl("Txtitem_i")?
Thanks
Obout.Interface.OboutTextB
hope it helps.