473,386 Members | 1,864 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

PostBack & <asp:TextBox> question


I have my <asp:TextBox> inside one of DataGrid's columns. I haven't set
AutoPostBack=True. 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 1704
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=True. 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_RowCommand 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_RowCommand event firing?


I don't know. I haven't overrided this event so far (will try that).
Jun 8 '06 #5
Is the GridView_RowCommand 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_RowCommand 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
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...
3
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...
11
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...
0
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"...
0
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...
1
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,...
6
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...
1
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...
1
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.