user3278660
user3278660

Reputation: 1

AjaxControlToolkit & RequiredFieldValidator compatibility issue

I had a ASP.NET webpage with several text boxes (WebControls) with mandatory data entry. Hence, the text boxes have an associated RequiredFieldValidator & this form was working fine.

Recently, I had to add an additional textbox which accepts date as input. To enforce correct date format, I decided to associate this textbox to the CalendarExtender of the AjaxControlToolkit, so that on clicking the textbox a pop up calendar appears. After successful build of the project, when I navigate to the page an error message “Assembly AjaxControlToolkit does not contain a web resource with name jquery” is returned.

It was also observed that when I deleted all the text boxes & their associated RequiredFieldValidators the Form is working fine. That is when the textbox with CalendarExtender is clicked the Calendar appears without any problem.

It appears that AjaxControlToolkit (ToolkitScriptManager) & RequiredFieldValidator cannot co-exist on a web form. I am using Visual Studio Professional 2012.

Any suggestions ?. Thanks in advance.

Upvotes: 0

Views: 692

Answers (1)

Afnan Ahmad
Afnan Ahmad

Reputation: 2542

Please follow the following steps:

Register Assembly, Namespace and TagPrefix

Than put ScriptManager

<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>

Try the following code for calendar popup:

<asp:TextBox ID="myTextBox" runat="server" CssClass="textBoxStyle" Width="282px"> 
 </asp:TextBox>
 <asp:ImageButton ID="myImg" runat="server" ImageUrl="~/myImage.png"/>
 <cc1:CalendarExtender ID="calendarId" runat="server" PopupButtonID="myImg" 
 TargetControlID="myTextBox" Enabled="True">
 </cc1:CalendarExtender>

Upvotes: 0

Related Questions