TextBox Causing A Postback In Dynamic .ascx Control
Posted on 2010-01-11
I have a ascx control that contains an asp:Textbox control. I add the ascx control to a web form dynamically. If I click inside this textbox (that is read only and autopostback is false) and then click a key on the keyboard it causes a postback. If the textbox is in a web form and now anscx control obviously it does not cause a postback and everything works correctly. Is there a way to stop this postback from happening? What about using html textboxes instead will that fix it? I need the textbox to do 2 things:
1. Populate with data from the db on the loading of the control (uncertain if this is even possible with an html textbox)
2. Get access to the textbox through code if not in read only mode. Ive tried to access an html textbox in code behind and I am unsure how. The Id of an html textbox is not accessible from code behind.