button Click event

B

bbawa1

I have a button( btnLogOut)in my master page. In page_load event of
this master page I want
to verify if the button is clicked or not.

How can I do that.

Thanks in advance.


seema
 
M

Mark Rae

I have a button( btnLogOut)in my master page. In page_load event of
this master page I want
to verify if the button is clicked or not.

How can I do that.

Not sure what you mean exactly...

The Page_Load event occurs server-side near the beginning of the page cycle,
but it's not possible to click a button until the page has actually been
rendered and streamed down to the client browser, by which time the
Page_Load event is long gone...
 
B

bbawa1

Not sure what you mean exactly...

The Page_Load event occurs server-side near the beginning of the page cycle,
but it's not possible to click a button until the page has actually been
rendered and streamed down to the client browser, by which time the
Page_Load event is long gone...

--http://www.markrae.net

Hi,

Acrtually I have some coding in page load event. But as I click on
button it first go topage_load event. So, I want in page_load event
that If I clicked on button
and when page postback and goes to page load event do something-----

So, It meands I wnat to know the condition if button is clicked or not
on every post back.
 
B

bruce barker

set UseSubmitBehavior is True. then:

bool clicked = IsPostback
&& !(Request.Form[btnLogOut.UniqueID] == null);


-- bruce (sqlwork.com)
 
M

Mark Rae

Hi,

Acrtually I have some coding in page load event.
OK.

But as I click on button it first go topage_load event.

Yes, it will do... Clicking an <asp:Button control will (under normal
circumstances) cause the page to post back...
So, I want in page_load event that If I clicked on button
and when page postback and goes to page load event do something-----

So, It meands I wnat to know the condition if button is clicked or not
on every post back.

Again, I'm not exactly sure what you want, and I appreciate that English is
not your first language...

If you mean that you don't want the code in your Page_Load event to run with
the page is posted back, then surround it with IsPostback...

if (!IsPostback)
{
// this code will run only when the page first loads, not when it's
posted back
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top