473,398 Members | 2,403 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,398 software developers and data experts.

Button causing post

How can I tell the name of the button causing the post. I have some code in
page prerender and I don't want the code to execute if a certain button
causes the post since it would be an unnecessary trip to the server and a
hit on the DB.

If button <> btnTime caused post then
Execute Code
End if

Thanks
Nov 18 '05 #1
3 1933
Could you just to a
if(!IsPostBack){}

Or do you have to do the redener with some buttons? If so just put the call
to do this in the buttons you need it to, it'll be easier.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
How can I tell the name of the button causing the post. I have some code in page prerender and I don't want the code to execute if a certain button
causes the post since it would be an unnecessary trip to the server and a
hit on the DB.

If button <> btnTime caused post then
Execute Code
End if

Thanks

Nov 18 '05 #2
Thanks for the quick response Curt. My situition is that I have a datagrid
on a page and a composite control made up of a calandar control and a text
box. When the user selects a new date I need the datagrid to update based
on the new selected date.

When the processing begins the page load is fired and then my composite
control is fired so I can't use the ispostback because the page is loaded
before my new date is selected. That is why I put the databind method for
the datagrid in the prerender so the datagrid will update after the date is
selected in the composite control.

I have two other buttons on the page that cause postback and the datagrid is
redrawn in the prerender method which is unnecessary for my purposes.

So if possible I don't want the code in prerender to execute if either of
these two buttons are presses.

Is there another way to get my datagrid to be redrawn/binded after the
composite control is executed?

Thanks
"Curt_C [MVP]" <software_AT_darkfalz.com> wrote in message
news:eA*************@TK2MSFTNGP09.phx.gbl...
Could you just to a
if(!IsPostBack){}

Or do you have to do the redener with some buttons? If so just put the call to do this in the buttons you need it to, it'll be easier.
--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
How can I tell the name of the button causing the post. I have some code
in
page prerender and I don't want the code to execute if a certain button
causes the post since it would be an unnecessary trip to the server and

a hit on the DB.

If button <> btnTime caused post then
Execute Code
End if

Thanks


Nov 18 '05 #3
The button pressed will be the sender argument passed to your event handler,
just do a:

Button foo = (Button)sender;
if(foo.ID != "bar")
//do stuff
MattC

"Brian Shannon" <bs******@lbrspec.com> wrote in message
news:#K**************@tk2msftngp13.phx.gbl...
How can I tell the name of the button causing the post. I have some code in page prerender and I don't want the code to execute if a certain button
causes the post since it would be an unnecessary trip to the server and a
hit on the DB.

If button <> btnTime caused post then
Execute Code
End if

Thanks

Nov 18 '05 #4

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

Similar topics

4
by: Fred | last post by:
I have read and tried every combination for hours. I'm sorry, but I don't get it. How do I have a form with textboxes and buttons and allow click events to execute a server function then display...
25
by: KK | last post by:
Hi, I am using history.go(-1) for implementing the back button functionality. Its working fine but with this exception. 1. The page which is having back button has some hyperlinks on it. ...
2
by: Frawls | last post by:
Hi Can any one give me some help with this problem please? Here is the scenario: A user submits page 1 which is a web form.
2
by: sk2000 | last post by:
Hello All, I'm creating a web form with user controls in different HTML table cells (User Controls are place in the table cells at design time ). For some reason none of the Button type...
11
by: CW | last post by:
I have message entry screen that's causing me a bit of an issue. At the moment, there are 2 buttons, one is used to send message to another user (btnSend) and another is used to send messages to...
2
by: Selden McCabe | last post by:
I have an asp.net project with several pages. On most pages, clicking a button fire's the button's click event, and the page does not get reloaded unless something triggers a postback. But on...
4
by: BrianDH | last post by:
Hi I would ask this questiopn on the NG ASP but it would be days before anyone might respond. I am using vb.net code behind to create buttons to add to a web form. After the buttons are created...
4
by: Aleks Kleyn | last post by:
In asp.net I can put code for button click event. However I come to this event twice. What is the reason and how to prevent or check second entry to this event. I need to make sure that i do not...
1
by: johnacooke | last post by:
I have a HTML form that is generated in part by PHP. The action attribute on the form tag calls itself, so that I can validate the fields without using any other form of code like Javascript to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.