Textbox is disabled after adding text dynamically in codebehind

Posted by user1761348 on Stack Overflow See other posts from Stack Overflow or by user1761348
Published on 2012-10-20T10:51:41Z Indexed on 2012/10/20 11:00 UTC
Read the original article Hit count: 164

Filed under:
|
|
|

Can't quite work out what is happening but The background is that I am dynamically adding table rows in a web page and some of the cells hold controls such as dropdowns etc. One of the columns pulls a size into it.

However the column I am having issues with is the next column which takes the text from teh previous dropdown and shows the appropriate price. On doing htis however the textbox which is being created appears to turn into a label as I cannot select or adjust the text that has been put in there.

 var gotPrice =(from a in getPrice.Sizes
                     where a.Size1 == Size.SelectedValue
                     select a).First();

         TextBox Price = new TextBox();
            Price.Width = 100;
            PriceField.Controls.Add(Price);
            PriceField.Text = gotPrice.RackRate.ToString();

I have tried then calling .Enabled but still the text box is not editable.

any help appreciated.

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET