Home All Groups Group Topic Archive Search About
Author
19 Jun 2006 7:24 PM
matt.grande
Hi all,

My code:
protected void Page_Load(object sender, EventArgs e)
    {
        string et = Request.Form["__EVENTTARGET"];
        if ((IsPostBack) && (et.Equals("")))
        {
                ExecuteCustomSearch();
        }
    }

There are times when I will click a button, and ExecuteCustomSearch()
shouldn't run, but the EventHandler of that button should.  However, if
ExecuteCustomSearch() doesn't run (ie, if the if statement is false),
the EventHandler for the button won't run.

Why is this?  How can I get around it?

(PS:  The buttons are created dynamicly, if that makes a difference)

Author
20 Jun 2006 12:58 AM
Cowboy (Gregory A. Beamer)
Why are you using Page_Load for a postback? If you caused a postback, you
should have an event handler for the event that caused the postback. That is
where you should put the code. I assume that the postback in question could
be handled without using EVENT_TARGET much easier with the event handler.
Just a thought.

--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
<matt.gra***@gmail.com> wrote in message
Show quote
news:1150745061.191194.176360@i40g2000cwc.googlegroups.com...
> Hi all,
>
> My code:
> protected void Page_Load(object sender, EventArgs e)
>    {
>        string et = Request.Form["__EVENTTARGET"];
>        if ((IsPostBack) && (et.Equals("")))
>        {
>                ExecuteCustomSearch();
>        }
>    }
>
> There are times when I will click a button, and ExecuteCustomSearch()
> shouldn't run, but the EventHandler of that button should.  However, if
> ExecuteCustomSearch() doesn't run (ie, if the if statement is false),
> the EventHandler for the button won't run.
>
> Why is this?  How can I get around it?
>
> (PS:  The buttons are created dynamicly, if that makes a difference)
>
Author
20 Jun 2006 1:02 PM
matt.grande
That really didn't answer my question at all...


Cowboy (Gregory A. Beamer) wrote:
Show quote
> Why are you using Page_Load for a postback? If you caused a postback, you
> should have an event handler for the event that caused the postback. That is
> where you should put the code. I assume that the postback in question could
> be handled without using EVENT_TARGET much easier with the event handler.
> Just a thought.
>
> --
> Gregory A. Beamer
>
> *************************************************
> Think Outside the Box!
> *************************************************
> <matt.gra***@gmail.com> wrote in message
> news:1150745061.191194.176360@i40g2000cwc.googlegroups.com...
> > Hi all,
> >
> > My code:
> > protected void Page_Load(object sender, EventArgs e)
> >    {
> >        string et = Request.Form["__EVENTTARGET"];
> >        if ((IsPostBack) && (et.Equals("")))
> >        {
> >                ExecuteCustomSearch();
> >        }
> >    }
> >
> > There are times when I will click a button, and ExecuteCustomSearch()
> > shouldn't run, but the EventHandler of that button should.  However, if
> > ExecuteCustomSearch() doesn't run (ie, if the if statement is false),
> > the EventHandler for the button won't run.
> >
> > Why is this?  How can I get around it?
> >
> > (PS:  The buttons are created dynamicly, if that makes a difference)
> >

AddThis Social Bookmark Button