问题描述:

I am implementing a project in asp.net where I am using calender extender of Ajax toolkit.

The calender extender is used in the content page. But it is not correctly showing the calender. The calender is misplaced from the 'textbox' which owns the calender extender.

网友答案:

You just write the style for the Calendar Extender in a seperate CSS class,

Then assign it to the Calendar Extender.

<asp:CalendarExtender   ID="CalendarExtender1"  runat="server"  TargetControlID="TextBox1"    CssClass="CalendarCSS"/>  
网友答案:

Try this ..

<asp:TextBox   ID="TextBox1"  runat="server"/>

<asp:CalendarExtender   ID="CalendarExtender1"  runat="server"  TargetControlID="TextBox1"    CssClass="CalendarCSS"/>  
网友答案:

Make sure the TargetControlID of the Calendar Extender is equal to the TextBoxID and then you include the PopupPosition property.

For example:

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1" PopupPosition="Right"></cc1:CalendarExtender>

I hope it helps you.

网友答案:

The best way to solve this issue is just add an ajax assembly to your page, on the top:

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="ajaxToolkit" %>

And don't forget to add the tagprefix on the calender extender as "ajaxToolkit".

ex:

<ajaxToolkit:CalendarExtender ID="txtPostingDate_CalendarExtender"
runat="server" Enabled="True" TargetControlID="txtPostingDate"
Format="MM/dd/yyyy">
                                            </ajaxToolkit:CalendarExtender>
相关阅读:
Top