Link to home
Start Free TrialLog in
Avatar of npl77
npl77

asked on

TextBox Causing A Postback In Dynamic .ascx Control

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.
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of npl77
npl77

ASKER

You know what your right because when I do this on a test page no postback occurs. Let me look more into it and try to figure out why this is happening....
Avatar of npl77

ASKER

Whats happening is when I click the "Backspace" key after giving one of these textboxes focus. The code is automatically going back to the previous ascx control that was loded into the placeholder. Does that make any type sense?
No, that is not a normal problem.  You are going to have to show me something that would attempt to explain the problem in more detail...