Ajax change language - asp.net

I saw in a lot of AjaxControlToolkit.resources.dll for different languages, even mine (Russian) in my bin folder so I guess that's real to change the language of my Ajax Calendar Extender.
<asp:TextBox ID="TextBox4" runat="server" oninit="TextBox4_Init" />
<ajaxToolkit:CalendarExtender ID="TextBox4_CalendarExtender" runat="server"
Enabled="True" FirstDayOfWeek="Monday" Format="dd.MM.yyyy"
TargetControlID="TextBox4" />
<br />
It's English by default
But how can I change it to my Language ? (or to the current culture language)
I've tried
<%# Page Title="gfregrhtrhr" Language="Nemerle" MasterPageFile="~/MasterPage.Master" AutoEventWireup="true"
CodeBehind="Report.aspx.n" Inherits="Flow_WEB_Nemerle.Report" Culture="ru-RU" UICulture="ru-RU" %>
but it made no sense for calendar :-/
by the way I have some fun in comparing my page and
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/Calendar/Calendar.aspx
there I can see month names etc on Russian BUT "Today" an english >_< instead on my page month names are English and "Today" is Russian "Сегодня" ... is it phenomenon
Finally fixed by adding
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnableScriptGlobalization="true" EnableScriptLocalization="true"/>

The components are going to work by default in the language defined in the page culture property in your page directive. This directive also fix the date format and all the culture relative parameters and preferences.
This is an example to set them work for English-United Kingdom:
<%# Page Language="C#" Culture="en-UK" UICulture="en-UK" %>

You must set EnableScriptGlobalization="true" in ToolkitScriptManager like this
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="True"></asp:ToolkitScriptManager>

Related

How to set uiculture for AjaxControl

I have an asp.net application that is entirely in the Dutch language (Culture and UICulture) This is set in the header of the aspx:
<%# Page Language="vb" AutoEventWireup="false" UICulture="nl" Culture="nl-NL" CodeBehind="CSSSR_BlokjesSchema.aspx.vb" EnableEventValidation="false" Inherits="CS_SSR_RAIO.CSSSR_BlokjesSchema" %>
This workes perfectly, but not for the Ajax calendar extender. In that component, the dates and month names are still displayed in English.
What am i forgetting?? What setting in Ajax makes my calendar use the Culture i set?
I found it myself
The toolkit scriptmanager needs to be explicitly told that is has to use localisation:
<ajaxControlToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" EnableScriptGlobalization="true" EnableScriptLocalization="true" runat="server" CombineScripts="true"></ajaxControlToolkit:ToolkitScriptManager>
After i changed this, the calendar was showing the date descriptions in Dutch

TextBoxWatermarkExtender

i am new to asp.net and i was to work in AjaxControlToolkit and i instaled and performed other operation but it is showing me report...,
error is:
The type name 'TextBoxWatermarkExtender' does not exist in the type 'AjaxControlToolkit'
protected global::AjaxControlToolkit.TextBoxWatermarkExtender TextBoxWatermarkExtender1;
code is:
<asp:TextBoxWatermarkExtender id="TBWEDOB" runat="server" targetcontrolid="txtDOB"
watermarktext="dd/mm/yy" watermarkcssclass="watermarked"> </asp:TextBoxWatermarkExtender>
plz any one pelp me on this flow....,
First Check This
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
in Your Page and see what is the TagPrefix in your page and than use that.like
<asp:TextBoxWatermarkExtender ID="TBWE2" runat="server"
TargetControlID="TextBox1"
WatermarkText="Type First Name Here"
WatermarkCssClass="watermarked" />
it will work defiantly
Why don't you simply try placeholder property to achieve the watermark in input fields.
Yes, There is a restriction of older browser, so if you are working with newer version (suppots HTML 5) then you can use it like this
<asp:TextBox ID="textbox1" runat="server" placeholder="dd/mm/yyyy"></asp:TextBox>
You haven't provided much information so it will be tough to identify where your mistake is, here's a simple step-by-step list of how you can use AJAX in your application, just follow the points below and it will work:
1) Download AJAX from codeplex, save and unzip anywhere on your machine
2) In Visual Studio Toolbox, Right click-> Add Tab, give it a name
3) Right click the newly created tab -> Choose Items...
4) Click Browse, find AjaxControlToolkit.dll and click OK
5) If all is well the controls will be added to your toolbox
6) Drag and drop a ToolkitScriptManager to the .aspx page, doing this will automatically:
6.1) Add a AjaxControlToolkit.dll reference to your project
6.2) Add the following line to the source view of your page
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
7)Drag and drop a TextBoxWatermarkExtender to the .aspx page and you're done:
<asp:ToolkitScriptManager ID="sm" runat="server" />
<asp:TextBoxWatermarkExtender ID="watermark" runat="server" TargetControlID="txtName" WatermarkText="Type name here..." />
<asp:TextBox ID="txtName" runat="server" />
try modifying the tag prefix
on the top of the page register the ajax tool kit.
<%# Register Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" TagPrefix="ajax" %>
<ajax:TextBoxWatermarkExtender id="TBWEDOB" runat="server" targetcontrolid="txtDOB"
watermarktext="dd/mm/yy" watermarkcssclass="watermarked"> </ajax:TextBoxWatermarkExtender>

Ajax Calendar Extender doesn't work

I know this is a silly question, bu I just can't get the ASP.Net Calendar Extender work. I am looking at this problem for hours now.
Can someone please help me.
I've downloaded the code from the Asp.net Ajax website and I've added the dll to my toolbox.
This is the code of my page
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CalendarExtender TargetControlID="TextBox1" runat="server"></asp:CalendarExtender>
When I click the TextBox, it behaves like a normal TextBox. It doesn't show the calendar.
Is there something I forget, or is there something I am doing wrong?
Replace ScriptManager With ToolkitScriptManager
You forgot to set the PopupButtonID property of the CalendarExtender. If you want the calendar to appear when you click on the TextBox, use PopupButtonID="TextBox1"

correct use of tag prefix and tag name?

It looks like both TagPrefix and TagName are both required. I'm wondering what the correct usage of each element would be? The code I've got below doesn't look right, as I repeat the name of the control twice...
<%# Register TagPrefix="ucCustomerSearch" TagName="ucCustomerSearch" Src="~/UserControls/IndividualSearch.ascx"%>
<%# Register TagPrefix="ucCustomerList" TagName="ucCustomerSearch" Src="~/UserControls/CustomerList.ascx"%>
<asp:Content ContentPlaceHolderid="PlaceHolderMain" runat="server">
<ucCustomerSearch:ucCustomerSearch Title="Search" runat="server" />
<ucCustomerList:ucCustomerList Title="Customer List" runat="server" />
</asp:Content>
Think of TagPrefix like a namespace. You should use the same for both your controls, and it could be something like my or the name of your project or whatever you like really. But it shouldn't be the same as any of your controls.

ASP.NET Controls are not coming in Code-behind IntelliSense

I am having an aspx page where I have added one asp.net text box control with ID and RUNAT attribute. But in Code-behind I am not seeing this control's name in the intellisense.
My page directive in aspx is as follows
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MyProject_UI._Default" %>
I am using VS 2008. Any idea how to get rid of this?
Try using CodeFile instead of CodeBehind. The latter is a hold-over from .NET 1.1.
Also, make sure the namespaces match up between the markup and the code. Do a test compile to be sure.
I have seen this on occasion when I edit a page. When it happens to me, I close the files and open them again and it seems to fix itself.
This will happen if you are trying to include your control in LayoutTemplate. For example if you are using an asp label in a login control you have converted to a LayoutTemplate.
<asp:Login ID="userLogin" runat="server">
<LayoutTemplate>
<!--Username and password controls-->
<asp:Button ID="btnLogin" CommandName="Login" runat="server" Text="Login" />
<asp:Label ID="lblAlert" runat="server"></asp:Label>
</LayoutTemplate>
So your lblAlert will not show up on the code behind take it out of the layouttemplate or use a loop to find the control within the layout object.
var mylabel = (Label)userLogin.FindControl("lblAlert");

Resources