473,776 Members | 1,650 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PostBack & <asp:TextBox> question


I have my <asp:TextBox> inside one of DataGrid's columns. I haven't set
AutoPostBack=Tr ue. When I hit the ENTER button, my page "refreshes" (I
belive that PostBack was performed - however not sure). I don't want
anything to happen when ENTER is being pressed. The other option is that
button event might execute (button next to my asp:TextBox). How can I do
this?
Jun 8 '06 #1
6 1732
It is probably the button event firing.

You could put this code in your Page_Load event to confirm a postback.

if(IsPostBack)
{
Response.Write( "A PostBack Occured");
}
else
{
Response.Write( "A PostBack Did Not Occur");
}

John Smith wrote:
I have my <asp:TextBox> inside one of DataGrid's columns. I haven't set
AutoPostBack=Tr ue. When I hit the ENTER button, my page "refreshes" (I
belive that PostBack was performed - however not sure). I don't want
anything to happen when ENTER is being pressed. The other option is that
button event might execute (button next to my asp:TextBox). How can I do
this?


Jun 8 '06 #2
You could put this code in your Page_Load event to confirm a postback.


Just did that. Yes, it was PostBack, but WHO causes this PostBack? It is not
a button, because button have its OnClick event and I have put my code
inside it and that code doesn't execute when I press ENTER in my
asp:TextBox.

What should I do? :(
Jun 8 '06 #3
John

How many buttons do you have on your page? Is the button part of a
template or a GridView Command Button?

Is the GridView_RowCom mand event firing?

I can't be sure without seeing your code.

Regards

Jared

John Smith wrote:
You could put this code in your Page_Load event to confirm a postback.


Just did that. Yes, it was PostBack, but WHO causes this PostBack? It is not
a button, because button have its OnClick event and I have put my code
inside it and that code doesn't execute when I press ENTER in my
asp:TextBox.

What should I do? :(


Jun 8 '06 #4
How many buttons do you have on your page? Is the button part of a
template or a GridView Command Button?
One button, which is inside template together with TextBox.
Is the GridView_RowCom mand event firing?


I don't know. I haven't overrided this event so far (will try that).
Jun 8 '06 #5
Is the GridView_RowCom mand event firing?


If yes, can I disable/ignore this event?
Jun 8 '06 #6
John

I am not an expert, but I believe that the Button Control will always
cause a post back, due to the way a browser renders and deals with HTML
.. You could try using a link button instead if it is pressing enter
that is causing the problem.

Also, if the post back is causing a problem due to some code in your
Page_Load event, you could try grouping that code within the;

if(!IsPostBack)
{
}

So it only fires the first time the page loads.

Other than this, I am not aware of a method to turn off the RowCommand
event when you have a button control in the Grid.

Sorry I can't be more help.

Jared


John Smith wrote:
Is the GridView_RowCom mand event firing?


If yes, can I disable/ignore this event?


Jun 8 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5294
by: Kerri | last post by:
Hi, I have an asp textbox that allows users to enter their password. I have another page that allows a user to edit their user account. On this page I set the text to be the password in the Database. There is a value in my datareader but yet on my
3
5539
by: Jaime Stuardo | last post by:
Hi all... Both controls are server side. The former has more properties. Both may have associated events that are ran at server. Which one are recommended to use? is performance an issue? in what case I can (or must) use the second? If I want an input control that has specific font or color, I can use client side <input> so I'm wondering if there is an advantage to use <input> as
11
7764
by: Joe | last post by:
Hello All, I have an ASP.NET page with one Textbox (SearchTextBox) and one ImageButton (SearchButton) server controls. The user can type search text in SearchTextBox and click SearchButton and the web server performs a database query and displays the results. All of this works fine. I want the user to be able to press the Enter key while the cursor is still in SearchTextBox and have the SearchButton.Click event fire (thus performing...
0
1619
by: CharlesA | last post by:
Hi folks, I'm using ASP.net 1.1 with C# I've got this kind of thing going <div class="row"> <label class="col1">Rm Name</label> <asp:textbox id="txtRM" runat="server" cssclass="col2" ReadOnly="True" EnableViewState="False"></asp:textbox> <label class="col3">Rm Phone</label> <asp:textbox id="txtRmPhone" runat="server" cssclass="col4" ReadOnly="True"
0
4236
by: SureshBeniwal | last post by:
Dear All, What is the scenario in which onBlur for an ASP.NET web control <asp:textbox> would not get called, while onChange would? I ran into such a situation few hours back. can somebody throw some light? thanks in advance, guys. -Suresh Beniwal
1
1361
by: Mark Rae | last post by:
Hi, Have been modifying a piece of JavaScript I found on the net which completely prevents the Google AutoFill Toolbar from doing its stuff... Got that working now but, while I was debugging it, I noticed that every field that the Google Toolbar turned yellow also had its border style changed... Seems that this is a standard "feature"... If you specify an <asp:TextBox>'s BackColor property, that also changes its border style - has...
6
4020
by: HockeyFan | last post by:
I'd like to have an AJAX textbox that after the user fills in, will auto-fill another textbox on the page without having a postback occur. It doesn't have to do any filtering or any other thing like that. I'm fairly experienced with ASP.Net, but new to AJAX. Please help if you can. Thanx.
1
2553
by: raghulvarma | last post by:
In <asp:textbox> we do not have the method such as onmouseover as we have it in input type = "text" instead of onmouseover which method would be a perfect match for it? My situation is for a calender plz help me out...
1
1507
by: =?Utf-8?B?R3JlZw==?= | last post by:
I've added some <ASP:Textboxcontrols to a data-entry form. I've set the backcolor to light green and they appear properly on the page when I'm developing. But, when I load the page, only the first control shows the color and all others appear as yellow. To see if setting the backcolor made this happen I removed the light-green setting. Still, all controls appear light-yellow and only the first one appears as light-green. How can I...
0
9628
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10289
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9923
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8952
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.