<asp:Calendar, EnableViewState doesn't work

S

stefan edlund

Hi!

I'm using the <asp:Calendar and want's it to keep the
selected dates after postbacks. I tried the
EnableViewState = true but nothing is selected after
postback. I have a dropdown set to AutoPostBack="True" for
posting (use if for filtering data).

Any ideas?
/Stefan
 
K

Ken Cox [Microsoft MVP]

Hi Stefan,

It sounds like you are doing something that you shouldn't with the Calendar
in the Page_Load event. Is it being re-initialized each time the page loads?

Can you show the code that is causing problems?

Here's some code that makes a form. Make sure you don't have anything in the
Page_Load related to the calendar.

<form id="Form1" method="post" runat="server">
<asp:Calendar id="Calendar1" runat="server">
<OtherMonthDayStyle BackColor="#FFC0FF"></OtherMonthDayStyle>
</asp:Calendar>
<P>&nbsp;</P>
<P>
<asp:Button id="Button1" runat="server"
Text="Recolour"></asp:Button></P>
</form>
 

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

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top