← Tutti gli articoli

ASP.NET AJAX Control Toolkit - Calendar Extender - EnableScriptGlobalization

23 marzo 2011  · Asp.Net · Article  ·  954 visite

The ASP.NET AJAX Control Toolkit includes an amazing number of controls. The calendar extender it's usefull because the format date for each country it's different from each other.

In our aspx page we insert:
  • the Asp.Net ScriptManager (with EnableScriptGlobalization set to true)
  • a texbox (TextBox1)
  • a CalendarExtender (associated to our textbox)
    1. <asp:ScriptManager ID="ScriptManager1" runat="server" EnableScriptGlobalization="true">  
    2.        </asp:ScriptManager>  
    3.   
    4.        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>  
    5.          
    6.        <asp:CalendarExtender ID="TextBox1_CalendarExtender" runat="server"   
    7.            Enabled="True" TargetControlID="TextBox1">  
    8.        </asp:CalendarExtender>  
To be sure the date format it's in the correct country format we have to insert a globalization tag in the System.Web section of the Web.Config:
 
  1. < system.web >   
  2.    <!--// Web.config section under system.web-->  
  3.   
  4.    <globalization culture="it-IT" uiCulture="it" />