PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

Calendar resets SelectedDate

 
 
Jakub Cermak
Guest
Posts: n/a
 
      17th Jun 2010
Hello all,
I've a data-bound form as FormView. I use it only in update mode. I have a
Calendar control declared as
<asp:Calendar ID="BirthDate" runat="server" ValidationGroup="ProfileEditor"
SelectionMode="Day" SelectedDate='<%# Bind("ContactPersonBirthDate")
%>'></asp:Calendar>

Although the ContactPersonBirthDate is set to some date initially (retieved
from Linq2sql), when I click on update button (CommandName=update), the
SelectedDate of this Calendar control is set to 1.1.0001 (and therefore the
update in SQL database fails).
I found out that it happens only when I dynamically remove some controls (to
hide unimportant values if needed) in Load event, it I commented out the
deleting function, everything works OK. The hide function is very simple:
void HideControls(params string[] names)
{
foreach (var item in names)
{
var ctrl = FormView1.FindControl(item);
ctrl.Parent.Controls.Remove(ctrl);
}
}

I hope I made myself clear. Can you give me please some ideas why it's
happening and how can I fix it? I don't clearly see the connection between
resetting of the Calendar control to its default value and removing some
controls (which are in the same EditItemTemplate, but they aren't
connected).

Thanks in advance

Jakub Cermak

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SelectedDate problem with Calendar!? Leon_Amirreza Microsoft ASP .NET 1 7th Dec 2007 05:22 PM
DotNet2.0 Calendar SelectedDate Steven Nagy Microsoft ASP .NET 3 13th Dec 2006 12:58 AM
Re: Calendar.SelectedDate xarky d_best Microsoft C# .NET 0 8th Apr 2005 07:15 AM
Calendar.SelectedDate Xarky Microsoft ASP .NET 3 7th Apr 2005 01:42 PM
Calendar Control - SelectedDate problem 00_CuMPe3WaR3D12 Microsoft ASP .NET 1 15th Feb 2005 03:42 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:48 PM.