Properties setting in postback

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.
 
H

Hermit Dave

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...
 

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,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top