473,396 Members | 1,916 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,396 software developers and data experts.

Determine Which Button Pressed

In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button has
code to save the user's place in the survey and I only want it to run. Thanks.
Aug 22 '06 #1
14 1920
did u tried use the Wizard component under asp.net 2.0 to do such task???

--

Bruno Alexandre
"a Portuguese in København, Danmark"

"Mike Collins" <Mi*********@discussions.microsoft.comescreveu na mensagem
news:BB**********************************@microsof t.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.

Aug 22 '06 #2
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

"Bruno Alexandre" wrote:
did u tried use the Wizard component under asp.net 2.0 to do such task???

--

Bruno Alexandre
"a Portuguese in København, Danmark"

"Mike Collins" <Mi*********@discussions.microsoft.comescreveu na mensagem
news:BB**********************************@microsof t.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.


Aug 22 '06 #3
re:
>I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.
What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microsof t.com...
>I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

"Bruno Alexandre" wrote:
>did u tried use the Wizard component under asp.net 2.0 to do such task???

--

Bruno Alexandre
"a Portuguese in København, Danmark"

"Mike Collins" <Mi*********@discussions.microsoft.comescreveu na mensagem
news:BB**********************************@microso ft.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.



Aug 22 '06 #4
That was a typo. Is this better: v1.1.4322. I would like help instead of
criticism.

"Juan T. Llibre" wrote:
re:
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microsof t.com...
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

"Bruno Alexandre" wrote:
did u tried use the Wizard component under asp.net 2.0 to do such task???

--

Bruno Alexandre
"a Portuguese in København, Danmark"

"Mike Collins" <Mi*********@discussions.microsoft.comescreveu na mensagem
news:BB**********************************@microsof t.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.


Aug 22 '06 #5
re:
That was a typo. Is this better: v1.1.4322.
Yes, that's better.

re:
>I would like help instead of criticism.
Posting correct information would help you in getting help.

You should consider upgrading to 2.0.
Is there anything stopping you from doing that ?


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:91**********************************@microsof t.com...
That was a typo. Is this better: v1.1.4322. I would like help instead of
criticism.
"Juan T. Llibre" wrote:
>re:
>I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP
>"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microso ft.com...
>I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.
>did u tried use the Wizard component under asp.net 2.0 to do such task???

Bruno Alexandre

Aug 22 '06 #6
Thanks...I realize correct information is much better when needing help.
Sorry for the typo.

The office where I work just started using VS 2003 this year, so there are
no plans to upgrade for at least 2 years.

"Juan T. Llibre" wrote:
re:
That was a typo. Is this better: v1.1.4322.

Yes, that's better.

re:
I would like help instead of criticism.

Posting correct information would help you in getting help.

You should consider upgrading to 2.0.
Is there anything stopping you from doing that ?


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:91**********************************@microsof t.com...
That was a typo. Is this better: v1.1.4322. I would like help instead of
criticism.
"Juan T. Llibre" wrote:
re:
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microsof t.com...
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.
did u tried use the Wizard component under asp.net 2.0 to do such task???

Bruno Alexandre


Aug 22 '06 #7
re:
Thanks...I realize correct information is much better when needing help.
Sorry for the typo.
No problem...

re:
The office where I work just started using VS 2003 this year,
so there are no plans to upgrade for at least 2 years.
Do the guys who run your office realize that VWD is free ?
Also, do they realize that running the .Net Framework 2.0 is free ?

They're free downloads.

Get VWD at :
http://msdn.microsoft.com/vstudio/express/vwd/download/

You can also download the free .Net Framework 2.0 redistributable at :
http://www.microsoft.com/downloads/d...D=0856eacb-436...

And, you can download, for free, the .Net Framework 2.0 SDK at :
http://www.microsoft.com/downloads/d...d=FE6F2099-B7B...

With VWD and the .Net Framework redistributable -or the SDK- there's no need
to spend money for an IDE which *can* target .Net Framework 2.0 objects.

You can continue to use VS 2003 for your .Net Framework/ASP.NET 1.1 development.
That won't interfere with your *free* development of ASP.NET 2.0 apps.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================

"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
Thanks...I realize correct information is much better when needing help.
Sorry for the typo.

The office where I work just started using VS 2003 this year, so there are
no plans to upgrade for at least 2 years.

"Juan T. Llibre" wrote:
>re:
That was a typo. Is this better: v1.1.4322.

Yes, that's better.

re:
>I would like help instead of criticism.

Posting correct information would help you in getting help.

You should consider upgrading to 2.0.
Is there anything stopping you from doing that ?


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:91**********************************@microso ft.com...
That was a typo. Is this better: v1.1.4322. I would like help instead of
criticism.
"Juan T. Llibre" wrote:

re:
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP
>"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microso ft.com...
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.
>did u tried use the Wizard component under asp.net 2.0 to do such task???

Bruno Alexandre




Aug 22 '06 #8
I did not realize that VS 2003 could take advantage of the new things in the
2.0 framework, but we have a very rigid process that keeps us from being to
upgrade until approved by higher until they have "fully" tested it. The one
great day I am on my own, I'll work with all the latest and greatest :)

Do you know if I can do what I need in VS 2003?

"Juan T. Llibre" wrote:
re:
Thanks...I realize correct information is much better when needing help.
Sorry for the typo.

No problem...

re:
The office where I work just started using VS 2003 this year,
so there are no plans to upgrade for at least 2 years.

Do the guys who run your office realize that VWD is free ?
Also, do they realize that running the .Net Framework 2.0 is free ?

They're free downloads.

Get VWD at :
http://msdn.microsoft.com/vstudio/express/vwd/download/

You can also download the free .Net Framework 2.0 redistributable at :
http://www.microsoft.com/downloads/d...D=0856eacb-436...

And, you can download, for free, the .Net Framework 2.0 SDK at :
http://www.microsoft.com/downloads/d...d=FE6F2099-B7B...

With VWD and the .Net Framework redistributable -or the SDK- there's no need
to spend money for an IDE which *can* target .Net Framework 2.0 objects.

You can continue to use VS 2003 for your .Net Framework/ASP.NET 1.1 development.
That won't interfere with your *free* development of ASP.NET 2.0 apps.

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================

"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:48**********************************@microsof t.com...
Thanks...I realize correct information is much better when needing help.
Sorry for the typo.

The office where I work just started using VS 2003 this year, so there are
no plans to upgrade for at least 2 years.

"Juan T. Llibre" wrote:
re:
That was a typo. Is this better: v1.1.4322.

Yes, that's better.

re:
I would like help instead of criticism.

Posting correct information would help you in getting help.

You should consider upgrading to 2.0.
Is there anything stopping you from doing that ?


Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:91**********************************@microsof t.com...
That was a typo. Is this better: v1.1.4322. I would like help instead of
criticism.

"Juan T. Llibre" wrote:

re:
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

What the h*ll are you doing using ASP.NET 1.0 ?

At the very least you should be using ASP.NET 1.1.
although everybody should be, at least, testing ASP.NET 2.0.

Juan T. Llibre, asp.net MVP

"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:CD**********************************@microsof t.com...
I am only using ASP.Net 1.0. As far as I know, there is no wizard for that.

did u tried use the Wizard component under asp.net 2.0 to do such task???

Bruno Alexandre

Aug 22 '06 #9
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:BB**********************************@microsof t.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.
You've obviously tried if (!Page.IsPostback) ...?
Aug 22 '06 #10
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:B7**********************************@microsof t.com...
>I did not realize that VS 2003 could take advantage of the new things in
the
2.0 framework,
It can't, but that's not what Juan actually said...
but we have a very rigid process that keeps us from being to
upgrade until approved by higher until they have "fully" tested it. The
one
great day I am on my own, I'll work with all the latest and greatest :)
Maybe that time has come...
Do you know if I can do what I need in VS 2003?
private void Page_Init(object sender, EventArgs e)
{
// create your dynamic buttons - you'll need to do this every time the
page loads irrespective of whether it's been posted back or not

if (!Page.IsPostback)
{
// do something which won't happen when the page is posted back
}
}

private void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostback)
{
// do something which won't happen when the page is posted back
}
}
Aug 22 '06 #11
This is what I have right now in the initialize event:

private void Page_Init(object sender, EventArgs e)
{
InitializeComponent();

if (Page.IsPostBack)
{
//Load dynamic controls.
LoadNextSurveyPage();
}

base.OnInit(e);
}

I am doing Page.IsPostBack so it does not run on the initial load because we
are displaying instructions first., so I am wondering how to use the "stop
survey" button that I added through the designer to keep the above from
running.

"Mark Rae" wrote:
"Mike Collins" <Mi*********@discussions.microsoft.comwrote in message
news:BB**********************************@microsof t.com...
In my page initialize, I am loading dynamic controls for a survey. On the
survey, I have a stop button. If the user clicks the stop button, because
of
the page life cycle, the initialize and page load events run before the
button click and reloads a bunch of controls. Is there a way to keep these
events from running with a button control. The click event of the button
has
code to save the user's place in the survey and I only want it to run.
Thanks.

You've obviously tried if (!Page.IsPostback) ...?
Aug 22 '06 #12
You can't stop the events from firing but you might be able to use some
heuristics to determine which button caused the postback.

In your Page_xxx handlers you can look at the post body and check to see
if the btn data is in there. For example, if I have this

<asp:Button runat="server" id="stop" Text="Stop Survey"/>

Then in the event handler the Request object's items collection will
have a key called "stop" with the value "Stop Survey" so you could look
for that combination in the handlers alongside the IsPostback flag and
use that information to not use the postback.

If this is too kludgy then you could use a hidden form field, then when
the user clicks on the stop button use a javascript function to set the
value of the control before sending the postback to the server. You
could then use the items collection to look for that value,

Kevin
Aug 22 '06 #13
Thanks...I'll look into doing that.

"Kevin Jones" wrote:
You can't stop the events from firing but you might be able to use some
heuristics to determine which button caused the postback.

In your Page_xxx handlers you can look at the post body and check to see
if the btn data is in there. For example, if I have this

<asp:Button runat="server" id="stop" Text="Stop Survey"/>

Then in the event handler the Request object's items collection will
have a key called "stop" with the value "Stop Survey" so you could look
for that combination in the handlers alongside the IsPostback flag and
use that information to not use the postback.

If this is too kludgy then you could use a hidden form field, then when
the user clicks on the stop button use a javascript function to set the
value of the control before sending the postback to the server. You
could then use the items collection to look for that value,

Kevin
Aug 22 '06 #14
I added this to the initialize event and it worked...thanks.

if ((Page.IsPostBack) && (Request.Params.Get("btnStop") == null))
{
...code to load dynamic controls
}
"Kevin Jones" wrote:
You can't stop the events from firing but you might be able to use some
heuristics to determine which button caused the postback.

In your Page_xxx handlers you can look at the post body and check to see
if the btn data is in there. For example, if I have this

<asp:Button runat="server" id="stop" Text="Stop Survey"/>

Then in the event handler the Request object's items collection will
have a key called "stop" with the value "Stop Survey" so you could look
for that combination in the handlers alongside the IsPostback flag and
use that information to not use the postback.

If this is too kludgy then you could use a hidden form field, then when
the user clicks on the stop button use a javascript function to set the
value of the control before sending the postback to the server. You
could then use the items collection to look for that value,

Kevin
Aug 23 '06 #15

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

Similar topics

1
by: robert | last post by:
hi! I want to have a custom button change appearance when pressed and then call a function and change back to its original appearance when released. here's what i have now, which works mostly....
2
by: jb | last post by:
Hello, I need to know which button was pressed in the submit , i tried reading the vaule of submit it the validateDate function but it returns 'undefined' value ; I do this in asp all the time, Not...
3
by: James McGivney | last post by:
I have a project in VS.NET using C# I have a series of buttons on an aspx page. When one of the buttons is pressed, a panel becomes visible and allows the user to enter and edit data. I want to...
18
by: jrhoads23 | last post by:
Hello, I am trying to find a way to tell if an .NET windows forms Button (System.Windows.Forms.Button) is "depressed" (pushed down). For my application, I can not use a check box control set to...
2
by: Vern | last post by:
I have a custom control which has it's own OnValidating event handler. I would like to skip the validations if the Cancel/Exit button is pressed. Also, if possible, would like to skip the...
0
by: Vern | last post by:
I have a custom control which has it's own OnValidating event handler. I would like to skip the validations if the Cancel/Exit button is pressed. Also, if possible, would like to skip the...
0
by: Benjamin Bittner | last post by:
hallo ng, first of all, for the zipping progress i use the ziplib from http://www.icsharpcode.net/OpenSource/SharpZipLib/Default.aspx now to my problem. im trying to build a little application...
19
by: darrel | last post by:
On my vb.net page, I have 4 sets of inputs + form buttons. example: Search: (GO) Zip: (GO) County: (GO) County: (GO) The problem is if I go to the page, type in a zip code, and hit...
3
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
Is there any way to determine the state of the mouse buttons during a WM_NCHITTEST message? I have a situation where I need to perform custom logic during a WM_NCHITTEST messsage (by overriding a...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
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...

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.