470,641 Members | 1,736 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

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 1833
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by robert | last post: by
3 posts views Thread by James McGivney | last post: by
reply views Thread by Benjamin Bittner | last post: by
19 posts views Thread by darrel | last post: by
3 posts views Thread by =?Utf-8?B?bGpsZXZlbmQy?= | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.