problems with web control textbox posting back


  i have a simple form with a couple of vb/ web server side textbox controls. They are set to not auto postback
  when the text changes ( but they do seem to auto postback when a return key is entered which is fine for me ).
  If i hit the return key when focused in these text boxes they cause a postback event but I cannot capture it
  server side. I get redirected back to my default web page . If i use an ordinary HTML input box - the same thing

  If I use an ordinary submit html button control everything works fine.
My question - how can I capture the server side event when I enter a carriage return into one of my textboxes ?

Any advice much appreciated.
7/19/2005 2:57:03 PM 91979 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 52

I think whats happening is that when you hit return key its executing the code for very first button. You can stop that by capturing the keypress event
7/19/2005 3:47:05 PM
check this or this
There are a lot of methods to handle your problem, try the folowing pattern in google: enter button

Best regards
Demian Schnaidman
7/19/2005 3:50:28 PM
Here is how you can capture a server side event

<script language=javascript>
  function test(args)
   var key=args.keyCode;
    return false;


<asp:TextBox id="TextBox1" onkeypress="javascript:return test(event);" runat="server"></asp:TextBox>

If you want to stop it for your page, you can call test function from body tag. I hope this helps.

7/19/2005 3:54:58 PM

Similar Artilces:

Problem With Dynamicially Created Web User Control.on post back all controls lost.
Hi All,         i m facing Problem With Dynamicially Created Web User Control.on post back all controls lost. I have Created a Web User Control in that user control i have a button which has some works fine when i add this control. but when i create this control at run time ,problem arise when i click on any of the button on the control.all control lost.i load this control by writing this code private SqlBuilderResultsControl objSBRC = new SqlBuilderResultsControl(); objSBRC = (SqlBuilderResultsControl)LoadControl("SqlBuilderR...

getting focus back to the same control after post back
Hi friends!  How the control can be set focused on the same conrol after post back from where it was generated?thanks At the event of the control which causes Postback , add {        ControlID.Focus() } in this wayprotected void Page_Load(object sender, EventArgs e) {if (IsPostBack) {Control control = null; string ctrlname = Page.Request.Params["__EVENTTARGET"];if (ctrlname != null && ctrlname != String.Empty) { control = Page.FindControl(ctrlname); control.Focus(); } }   }   Note this will work for all...

Web Page with Textbox and other controls.. how to make cursor start at the Textbox
I'm putting together a page with a textbox that will input the emloyees ID, and that is used to populate in a dropdown box with each of the employees pay checks for the year. And from that dropdown box, once one selects one of the end-of-period dates, I can get the employee's pay stub informantion to show up.  Well two questions.  1) How to get the beginning cursor once the page appears, to rest on the textbox for immediate filling.  2) and then once I get the dropdown box to populate, how to get it to select the first date of the list to show (it right now will for...

Posting using HTTP GET instead of HTTP POST from Textbox control
Hi I feel almost silly asking this question, but I want to use HTTP GET instead of the default HTTP POST that uses when a user enters some text in my textbox and clicks on the associated button. How do I do that? Regards, Egil. You can explicitly specify "get" for method attribute of your form. Like this: <form id="form1" runat="server" method="get"> I am not sure why you would want to do this. This causes _VIEWSTATE to show up in your URL and as a query string. And there is a length limitation on query string. The HTML specifications technically define the...

Having Problems with Web Controls/TextBox
Hi,I have created a textbox web control on a colored background strip. When I run the personal local host, the page opens in IE browser. When the browser is in restore down state (ie when the window is not in maximized state), the textbox is going out of the colored background strip. Is there any way to lock the textbox so that it remains in the same position(on the colored background strip) irrespective of whether the IE browser window is in maximized or restore down state?~C#Learner*************************************************Please remember to Mark As Answer if this pos...

Dynamiclly added web control in a web control problem?
I have a small problem...I have a web control, that creates dynamicly some other my custom controls and add these to itself. But when there is a postback, how can I get the information of the dynamiclly added control. Here is my example:(I have simplified)  1 DropDownList d; 2 protected void Page_Load(object sender, EventArgs e) 3 { 4 d= new DropDownList(); 5 d.Items.Add("B"); 6 d.Items.Add("L"); 7 d.AutoPostBack = true; 8 d.SelectedIndexChanged += new Event...

How to get the HREF value of the Anchor tag in a web page using the web browser control in
Hi Friends,               i have a webserver control in my application.i load the web browser control on a button click using the below code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click                AxWebBrowser1.Navigate("", False) End sub once the page is loaded in the browser i want the <a> HREF value in that page.For example if that page has ...

Dynamic Controls and Post Back Problem
Hi, I am dynamically creating and populating DropDownLists in a age and i have this problem. The DDLs are created fine, they are popultaed fine, but when the user is choosing a value from them, how do i retrieve those values so i can do something with them? I am thinking it has something to do with IsPostBack, because i got as far as capturing the original values, but not the newly selected ones. Here is my code: Sub BuildAttributeDDLs()     Dim i As Integer    For i = 0 To ProductDS.Tables(0).Rows.Count -1         Dim R...

web control problem,about the textbox in the panel
Dim i As Integer For i = 1 To 4 Dim text1 As New TextBox text1.Rows = 1 text1.Columns = 1 text1.Style.Item("Width") = "200" Dim Literal1 As New LiteralControl Literal1.Text = i & "cusotmer : " Dim text2 As New TextBox text2.Rows = 1 text2.Columns = 1 text2.Style.Item("Width") = "200" Dim Literal2 As New LiteralControl Literal2.Text = ...

Can you return .net web controls in a .net page from a web service?
I've got a problem with a project. I've got to compile an entire .net page and return it as part of a Web Service for display. The problem I have is that I need to add WebControls and functionality to the page so that not only the html content and images are displayed (which I've managed) but that textboxes, labels, buttons and datasets can be displayed also. Essentially I need to make a call from one site for a page, populate the page and return it in a state as though it resided on the same server/webspace as the calling page. Code is currently built as follows into a string: strOpenHT...

Get message that mozilla has to close. Get booted out of web site. Get message from Mozilla to report problem. Problem reporting will not work. Eventually I delete the report message.
Name: Linnea Hagberg Email: lhagbergatsmithcovedotcom Product: Mozilla Suite Summary: Get message that mozilla has to close. Get booted out of web site. Get message from Mozilla to report problem. Problem reporting will not work. Eventually I delete the report message. Comments: See above. Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 Firefox/1.0.7 ...

Problem getting focus in textbox
I am using a CreateUserWizard.  For some reason, I am unable to get focus into my textboxes on mouse click.   On my page_load, I have added some code to get the focus on the first textbox (FirstName.Focus()) and the user can tab through the rest of the fields. However, I need the user to be able to click on the textboxes and gain focus that way. Here's some code from the beginning of the first step.  As noted, I cannot click on any of the textboxes to gain focus.  The only way this works with mouse clicks is if I click on the associated text label next to the te...

How to get Textbox value in web user control?
Hi friends,I created a web user control with only one textbox.(textbox.ascx) and textbox id=" txtSimple"textbox user control having some property. another user control with button(button.ascx) next i use two textbox usercontrol and one button usercontrol in sample.aspx. when i click button at that time call the required field validate property in textbox user property have following code.public bool RequireValidate    {        set        {     &nbs...

Web Matrix Getting Started Tour
Hi guys, my first time on the forum here so please be gentle :) I downloaded WebMatrix just 2 days ago and I have been doing the WebMatrix walk throughs with gusto the last couple of days. I was runing through this project "Build an End-to-End Application (with VB.NET)" with everything running perfectly every step of the way until the very last page. At first the login page just kept returning to itself no matter what I did... and then a few tests and re-inspections later I started to get this error in my browser -> "Unable to find script library '/a...

Web resources about - problems with web control textbox posting back -

Problem novel - Wikipedia, the free encyclopedia
Working class, or proletarian novels are often also social problem novels . This was in many ways a reaction to rapid industrialization , and ...

Corporate Australia's real problem: ancient companies
Our biggest companies are pretty aged, compared to the dynamic corporate giants that power the world's biggest economy.

Report claims Samsung Galaxy S7 will fix the biggest problem with the Galaxy S6
... Samsung ditched microSD support on the Galaxy S6. Well according to a new report on Monday, Samsung will fix the bigger of those two problems ...

November 2015: Unofficial Problem Bank list declines to 255 Institutions
This is an unofficial list of Problem Banks compiled only from public sources. Here is the unofficial problem bank list for November 2015. Changes ...

Acampora on problems in the market
Master technician Ralph Acampora says he has some doubts about this "fractured" market.

Tesla Unveils ‘Cheap’ $80,000 SUV, As Problems Mount For The Automaker
Tesla unveiled an $80,000 “budget” version of its Tesla Model X SUV Tuesday as the company struggles to sell cars and burns through cash at an ...

New York's anti-terror reporting app could easily cause problems
New York state is understandably more anxious than ever about terrorist threats, and it's hoping that some mobile technology will bolster its ...

Can Los Angeles Solve Its Traffic Problem By Building More Roads?
The Reason Foundation publishes a Los Angeles transportation plan that embraces reality over dogma.

Family evicted, building deemed unlivable: Landlord cannot fix problems, he was murdered
... A Milwaukee family has been forced to leave their apartment. Their building has been declared unlivable. The landlord was required to fix problems ...

Icy roads causing problems for Thanksgiving travelers around Colorado Springs
Dress warm this holiday, temperatures Thursday are predicted to be colder...

Resources last updated: 11/28/2015 2:59:35 AM