views:

842

answers:

2

hey guys,

I'm having some trouble getting a datetime from calextender on a modalpopup I have.

<asp:TextBox ID="txtPopEndDate" runat="server" Enabled="false"></asp:TextBox>
<img id="calButton" alt="" title="Show Calendar" src="~/App_Themes/Main/img/calendar.png"
                        runat="server" height="20" style="cursor: hand;" />
<ajax:CalendarExtender Animated="true" TargetControlID="txtPopEndDate"
                        runat="server" PopupButtonID="calButton"
                        Enabled="true" ID="calExtender" Format="dd/MM/yyyy"/>

are the controls I have to select the date, now when I press the ok button I handle the data including the date. However, if I try to fetch the date using calExtender.selectedDate property I get nothing. the same goes for manually getting the string from the textbox and parsin that.

I have to mention that the other data from textboxes and dropdowns on that popup work without a glitch. any help here would be greatly appreciated.

A: 

Your textbox has enabled = false. I think this spits out a disabled attribute set to true in the html, therefore the post of the form would not send the value. Why dont you want the textbox enabled?

Im also assuming your trying to grab the value after a postback ? Is that true?

Mcbeev
A: 

yep,

in the meanwhile I found a solution to the problem. as you said, the textbox apparently needs to be enabled. this means the option for erroneous dates. I got the value from the textbox and parsed it that way with a DateTime.TryParse to secure a correct date.

if anyone has a better option, let me know

Jan W.