Properties setting in postback

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a button, combo, and custom control that i created. When I click the button i want to set certain display properties of my custom control depending whats in the combo. I set those properties in the Click_Event in the button control. Unfortunately postback is triggered in the click event before I set the display properties of the control. Is there anyway that I can set these properties before the postback is triggered? I'd like to do this without writing any Javascript...

Thanks.
 
Okay here it goes
Page_load is always executed before control flow reaches the event handler.

what you need to do is use code like (for you page load function)
if(!Page.IsPostback)
{
// set you essential values during page load up.
}

now when your control causes a postback you essential code is not executed
cause its only supposed to execute during the first request for the page.
Just FYI: controls are server sided which means that they cause postback. If
you wish to do some thing without postback javascript is your only saviour.
you can register javascript method using Page.RegisterClientScriptRegistered
method.

HTH

Angel said:
I have a button, combo, and custom control that i created. When I click
the button i want to set certain display properties of my custom control
depending whats in the combo. I set those properties in the Click_Event in
the button control. Unfortunately postback is triggered in the click event
before I set the display properties of the control. Is there anyway that I
can set these properties before the postback is triggered? I'd like to do
this without writing any Javascript...
 
Back
Top