Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET Textbox.Text Property not updating

Reply
Thread Tools

ASP.NET Textbox.Text Property not updating

 
 
SpaceCake SpaceCake is offline
Junior Member
Join Date: Oct 2009
Posts: 1
 
      10-02-2009
Hi all,

I have been looking throughout the forum however I haven't managed to find a solution to the problem I am encountering.

I have dynamically created a number of textboxes stored in an array using Code Behind. When the user presses a button I want to be able to read the value in those textboxes, however I am reading the old value ("") instead.

I have included the relevant code below.



//array of textboxes
public static TextBox[] txtParameters;


//the text boxes are created dynamically based on what the user chooses from a list, ID = lstMethod
protected void lstMethod_SelectedIndexChanged(object sender, EventArgs e)
{

//tblParameters is Table control in the .aspx used to display the text boxes
tblParameters.Rows.Clear();
txtParamaters = new TextBox[Convert.ToInt32(lstMethod.SelectedIndex.Text)];
for (int i; i < Convert.ToInt32(lstMethod.SelectedIndex.Text); i++)
{
TableRow tableRow = new TableRow();

TableCell label = new TableCell();
label.Text = i;
tableRow.Cells.Add(label);

TableCell data = new TableCell();
txtParameters[i] = new TextBox();
data.Controls.Add(txtParameters[i]);

tableRow.Cells.Add(data);
tblParameters.Rows.Add(tableRow);
}
}


//once btnDone is clicked, the values in txtParameters are read
protected void btnDone_Click(object sender, EventArgs e)
{
for(int i = 0; i < txtParameters.Length; i++)
{
txtParameters[i].Text;
}
}


Thank you, much appreciated
Kevin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating JTable Atomically - block data changes while updating. news.rcn.com Java 2 12-10-2007 11:49 AM
Iframe window updating parent window property? Chandra HTML 0 04-12-2007 10:39 AM
Updating Design Time When Property Changes Mark Olbert ASP .Net 4 01-31-2007 07:22 AM
Could not find a property named '... ' on the type specified by the DataObjectTypeName property in ObjectDataSource '...' Anabela Silva ASP .Net 0 11-01-2006 07:08 PM
Updating property value in a custom contorl using ASP.NET 2.0 Callback Alani ASP .Net 2 01-22-2006 10:48 AM



Advertisments