changing the value of a seprate server control from within another control
for example i want to set label one to show the value of the theme, i am able to do it if i write the code inside the page load method, but not if i write it in the ThemeList_SelectedIndexChanged method, please elaborate.
protected void ThemeList_SelectedIndexChanged(object sender, EventArgs e)
{
HttpCookie preferredTheme = new HttpCookie("PreferredTheme");
preferredTheme.Expires = DateTime.Now.AddMonths(3);
preferredTheme.Value = ThemeList.SelectedValue;
Response.Cookies.Add(preferredTheme);
Response.Redirect(Request.Url.ToString());
// set label1 to show the value/name of theme
Label1.Text = preferredTheme.Value;
}
|