hello ,thank you for replies and suggestion.
It is good to get response nowadays from the people.
I had tried to give you all infromation as possible.
1>This is a simple ASP.NET website and programming language is c#, with WAMP SERVER as backend
2>Main problem is the pointing to the dynamic created simple textboxes having dynamic Id
as per the series name and the value is series discount which is entered by use in past.
The textbox values might be entered or modified by user.
Main issue is retriving the Dynamic created TextBox and text entered.
I had used the code as follwed
<pre lang="c#">
TextBox TxtBoxU = new TextBox();
string txtboxname = "txt_" + Convert.ToString(dtexistseries.Rows[i]["seriesid"]);
TxtBoxU.ID = txtboxname;
Now for the textbox values are entered with coding
TxtBoxU.Text = Convert.ToDecimal(dt.Rows[0]["discount"]).ToString();
Now added to the panel named by the code
PlaceHolder1.Controls.Add(TxtBoxU);
The previous entered valued are shown in dymanic created textbox. Code is working till creating
dynamic TextBox and the Values.
this shows the entered or empty values.
Now the main problem is to locate the dynamic created textbox and value retrived, for further inserting
in table the structure is ("clientid","seriesid","Discount"")
proposed code to insert the data
foreach (string series in individualseries)
{
TextBox txt1 = (TextBox)Panel1.FindControl(series);
decimal discount =0;
decimal.TryParse(txt1.Text.Trim(),out discount);
tbinsertdiscount.Append("("+ Convert.ToInt16(cd.ClientID) +","+ Convert.ToInt16(series.Split('_')[1]) + "," + discount + ")");
}
Main problem is how to retrive the textbox Id and values which might be changed or unchanged.
proposed solution by user BillWoodruff , was implemented as
// outsode the page's functions inclution page_load and button click and userdefined functins
//to make it accesable throughout page
public static Dictionary<string,TextBox> SeriesToTextBox = null ;
//in button search
<pre lang="c#">
protected void btnSearch_Click(object sender, EventArgs e)
{
SeriesToTextBox = new Dictionary<string,TextBox>() ;
//in for loop
SeriesToTextBox.Add(TxtBoxU.Text, TxtBoxU); -----> wrroe is shown ""An item with the same key has already been added. type ArgumentException "
Please suggest some solutions.
thanks.