problems with user control

g_r_a_robinson

Regular
Joined
Jan 13, 2004
Messages
71
I have a user control that is to be made visible when a checkbox is clicked. The checkbox autopostback is set to true. I have a property in my user control that I set to true when the checkbox has been clicked. The idea is, is that the main aspx finds the value of the property in the user control property and displays the relevant panel accordingly.

Problems is this, When I click the checkbox in the user control the page (aspx) does it thing, but because it hasn't yet picked up the value of the checkbox from the property, ie the property hasn't been inserted yet. It reads false. It then goes and receives the value from the property but by then its too late. The main screen has already cycled through and I get nothing. Obviously when I click the checkbox again it takes the property but its functions acts in reverse.

Long story short.. The pages aren't firing in the order that would allow my main page to act upon the checkbox of my user control..

Heres some code from my uc







private void Calendar_CBX_CheckedChanged(object sender, System.EventArgs e)

{

if(Calendar_CBX.Checked == true)

{

Disable_JobAdder();

calendar_Checked_Status = true;

//Response.Redirect(PageBase.SecureUrlBase + @"/secure/NoteScreen.aspx");



}

else

{

Enable_JobAdder();

calendar_Checked_Status = false;

}

}



public static bool Calendar_Checked_Status

{

get

{

return calendar_Checked_Status;

}

set

{

calendar_Checked_Status = value;

}

}





and code from my main aspx page:-



private void Page_Load(object sender, System.EventArgs e)

{

if (JobAdder.Calendar_Checked_Status == true)

{

NoteList_LST.Visible = false;

Calendar_On_Notescreen_PNL.Visible = true;

}



if (JobAdder.Calendar_Checked_Status == false)

{

NoteList_LST.Visible = true;

Calendar_On_Notescreen_PNL.Visible = false;

}





if (IsPostBack)

{

}
 
Back
Top