Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

does page_load know

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rodchar - 26 Oct 2007 00:03 GMT
hey all,
does server-side page_load what button was pressed on a postback?

thanks,
rodchar
Mick Walker - 26 Oct 2007 08:16 GMT
> hey all,
> does server-side page_load what button was pressed on a postback?
>
> thanks,
> rodchar
Not directly no. But its simple enough to set a Session variable so that
it will know.
Paul Hadfield - 26 Oct 2007 09:24 GMT
How would that help the OP though - Page_Load event fires before OnClick
event (which I would guess is where you would set the session value).

>> hey all,
>> does server-side page_load what button was pressed on a postback?
[quoted text clipped - 3 lines]
> Not directly no. But its simple enough to set a Session variable so that
> it will know.
Mark Rae [MVP] - 26 Oct 2007 09:39 GMT
> does server-side page_load [know] what button was pressed on a postback?

Yes - Request.Form["__EVENTTARGET"]

However, it has no need to know this...

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

rodchar - 26 Oct 2007 14:55 GMT
Here's the reason i ask:

i have an UpdatePanel that contains a div which contains my web user control
called CalendarHelper.ascx. The user control consists of a textbox, calendar
image button, and calendar to help with date entry. I can load this user
control dynamically but whenever i click the calendar icon to make the
calendar appear the webcontrol just disappears on postback/async callback.

This is the only code i have and thought i would need:

protected void BtnEdit_Click(object sender, EventArgs e)
   {                
       CalendarHelper cal1 = new CalendarHelper();
       cal1 = (CalendarHelper)cal1.LoadControl("CalendarHelper.ascx");      
 
       divmain.Controls.Add(cal1);
   }

p.s. i know there is an easier way to do this but i have to work with the
user control that i've been given.

> > does server-side page_load [know] what button was pressed on a postback?
>
> Yes - Request.Form["__EVENTTARGET"]
>
> However, it has no need to know this...
Mark Rae [MVP] - 26 Oct 2007 16:14 GMT
> i have an UpdatePanel that contains a div which contains my web user
> control
[quoted text clipped - 3 lines]
> control dynamically but whenever i click the calendar icon to make the
> calendar appear the webcontrol just disappears on postback/async callback.

What code is behind the calendar icon?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

rodchar - 26 Oct 2007 16:59 GMT
all that does is toggle the calendar control's visibility.

> > i have an UpdatePanel that contains a div which contains my web user
> > control
[quoted text clipped - 5 lines]
>
> What code is behind the calendar icon?
Lloyd Sheen - 26 Oct 2007 18:42 GMT
> Here's the reason i ask:
>
[quoted text clipped - 25 lines]
>>
>> However, it has no need to know this...

You need to reload the ascx in the page init event.

LS

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.