Hi,

I have a site and I want the user to be able to select the refresh time. I set it on page load:

void Page_Load(Object sender, EventArgs e)
	{
		 Response.AppendHeader("Refresh", "10");
}

Then the user can change it via a drop down list. In the list changed I put:

protected void RefreshTime_SelectedIndexChanged(object sender, EventArgs e)
    {
        string refreshtime = RefreshTime.AutoPostBack.ToString();
        RefreshTime.Items.FindByValue(refreshtime).Selected = true;
        Response.AppendHeader("Refresh", ""+refreshtime+"");
    }

I hoped it would save the new value but it always defaults back to the original value. I even moved the code from page_load to page_init no difference. Any ideas where im going wrong?

add not post back condition in page load

like this

if(!IsPostBack)
{
Response.AppendHeader("Refresh", "10");
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.