I make sense now.  I don't have to put the gathering
all user inpunt in postback.

thanks a bunch.

chris andrada
--- Rajendra Appalla <[EMAIL PROTECTED]>
wrote:

> Hi Chris,
> 
> I am confused on what you want to achieve.  Let's
> see.
> 
> You have two parts in your Page_Load
> 
> If(IsPostBack)
> {
> } 
> Lets call this Part-1.
> 
> And 
> 
> If( ! IsPostBack)
> {
> }
> Let's call this Part-2.
> 
> When the page first loads:
> Part-1 does not get executed.
> Part-2 gets executed. 
> 
> So the code in Part-2 gets executed only once.
> 
> After the page loads for the first time, any post
> back event that occurs
> thereafter makes the code in Part-1 gets executed. 
> So here you would
> want only that code that you want to get executed
> for any postback. 
> 
> Now you have another event for the button
> btnCalendar_Click.  Since this
> is wired to the button it gets executed after the
> code in Part-1 gets
> executed.
> 
> You said "I understand that Page_Load is
> triggered if i click on the image button and I only
> want to triger (Page.IsPostBack) if i click on the
> Submit button."
> 
> From this statement I understand that you want the
> code in Part-1 to get
> executed only for Submit button and not for image
> button.  Is that what
> you are trying to say??
> 
> Then remove the code in Part-1 and place it in the
> event handler
> btnSubmit_Click and wire it to the Submit button.
> 
> Anyway, if I did not quite understand what you were
> trying to say, let
> me know what exactly you are trying to say.
> 
> Rajendra.
> 
> 
> 
> 
> -----Original Message-----
> From: christopher andrada
> [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 21, 2004 1:18 PM
> To: [email protected]
> Subject: RE: [AspNetAnyQuestionIsOk] How to prevent
> Image Button from
> triggering IsPostBack
> 
> 
> Hi Rajendra,
> 
> I have the following code behind.
> private void Page_Load(object sender,
> System.EventArgs
> e){
>   if (Page.IsPostBack) 
>   {
>     lblMessage.Text = "hello";
>   }else if (!Page.IsPostBack) {
>     DateTime datNow = DateTime.Now;
>     string today = datNow.ToString("d");
>     txtBDate.Value = today;
>   }
> }
> private void btnCalendar_Click(object sender,
> System.Web.UI.ImageClickEventArgs e)
>               {
> 
>                       bDateCalendar.Visible = true;
>               }
> 
> When i click on the image button, It executes
> (Page.IsPostBack) and not (!Page.IsPostBack) and
> shows
> the calendar.  If I take out the (Page.IsPostBack)
> everything works fine.  I understand that Page_Load
> is
> triggered if i click on the image button and I only
> want to triger (Page.IsPostBack) if i click on the
> Submit button.  Please help.  Thanks
> 
> Chris Andrada
> 
> --- Rajendra Appalla <[EMAIL PROTECTED]>
> wrote:
> 
> > For any postback event, the Page_Load event runs. 
> > Only after this, the
> > corresponding event is handled.
> >  
> > So if you have an event btnCalendar_Click  wired
> to
> > the button, then
> > first Page_Load runs, then this event
> > btnCalendar_Click  gets executed.
> > 
> >  
> > If you do not want some code inside the Page_Load
> > event not run for
> > postbacks, then you need to put that inside an if
> > condition that checks
> > for postback as:
> > If ( ! IsPostBack)
> > {
> > }
> >  
> > If your problem is that the event
> btnCalendar_Click
> > is not getting
> > executed, check to see whether the event is
> properly
> > wired to the
> > button.  If not, then go to the design part of the
> > aspx page and double
> > click your button to wire the button to its event.
> >  
> > Hope this helps.
> >  
> > Rajendra.
> >  
> >  
> >   _____  
> > 
> > From: christopher andrada
> > [mailto:[EMAIL PROTECTED] 
> > Sent: Tuesday, December 21, 2004 12:17 PM
> > To: [email protected]
> > Subject: [AspNetAnyQuestionIsOk] How to prevent
> > Image Button from
> > triggering IsPostBack
> >  
> > Hi All,
> > 
> > The following code below is an image button that
> > triggers the visibility of the calendar and
> populate
> > the text box with the chosen date.  However, if I
> > click on the image button, IsPostBack is getting
> > triggered located at Page_Load().  This button is
> > suppose to trigger another function called
> > btnCalendar_Click.  Please advise on what i'm
> > suppose
> > to do.  Thanks.
> > 
> > <td width="442"><INPUT class="input2"
> id="txtBDate"
> > disabled type="text" size="30" name="txtBDate"
> > runat="server">
> >                                    
> <asp:imagebutton
> > id="btnCalendar"
> > runat="server"
> > ImageUrl="images/b_calendar.gif"
> > ImageAlign="AbsMiddle"
> >                                          
> > CausesValidation="False"
> >
> Autopostback="False"></asp:imagebutton><asp:calendar
> > id="bDateCalendar" runat="server"
> > DayNameFormat="FirstLetter" BorderStyle="Solid"
> >                                          
> > BackColor="GhostWhite"
> > BorderColor="Gainsboro"
> > Visible="False" ShowGridLines="True">
> >                                          
> > <SelectorStyle
> > BorderColor="Maroon"></SelectorStyle>
> >                                          
> > <DayHeaderStyle
> > BackColor="Peru"></DayHeaderStyle>
> >                                          
> > <OtherMonthDayStyle
> > BackColor="Tan"></OtherMonthDayStyle>
> >                                    
> > </asp:calendar></td>
> > 
> > 
> >             
> 
=== message truncated ===



                
__________________________________ 
Do you Yahoo!? 
Take Yahoo! Mail with you! Get it on your mobile phone. 
http://mobile.yahoo.com/maildemo 


------------------------ Yahoo! Groups Sponsor --------------------~--> 
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to