TextBox Causing A Postback In Dynamic .ascx Control

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08
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.
Question by:npl77
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 26288068
The TextBox control shouldn't cause a post-back in that configuration, so I believe that there is another explanation.  You shouldn't have to change to <input> elements.

Author Comment

ID: 26288213
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....

Author Comment

ID: 26288284
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?
LVL 96

Expert Comment

by:Bob Learned
ID: 26289658
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...

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this Article, I will provide a few tips in problem and solution manner. Opening an ASPX page in Visual studio 2003 is very slow. To make it fast, please do follow below steps:   Open the Solution/Project. Right click the ASPX file to b…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question