views:

404

answers:

1

Hi, I'd like to use a calendar control to edit a date in my mvc application. The ajaxtoolkit's calendarextender seems like a good choice.

However, when I reference the name given in markup, the application reports that the control cannot be found.

How can I reference the textbox created with mvc html-extensions?

Thanks,

Anders, Denmark

Below my first shot which produces an error - targetcontrolid not valid.

        <%= Html.TextBox("DateOfEarliestEmail", Model.DateOfEarliestEmail)%>
        <ajaxToolKit:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="DateOfEarliestEmail" Format="yyyy-MM-dd" PopupButtonID="Image1"/>
        <%= Html.ValidationMessage("DateOfEarliestEmail", "*")%>
A: 

That can be a messy choice. If I were you, I would use a jQuery plug in.

But, here is a walkthrough (might be a bit outdated and based on an asp.net mvc RC) on how to use asp.net mvc w/ the ajaxcontrol toolkit:

http://stephenwalther.com/blog/archive/2008/08/23/asp-net-mvc-tip-36-create-a-popup-calendar-helper.aspx

Also see: http://stackoverflow.com/questions/368098/asp-net-mvc-ajax-control-toolkit

ericvg