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"
Related
I've got several DevExpress DateEdit controls on my page organized into an AjaxControlToolkit Accordion along with other fields relevant to my data.
The DateEdit controls worked quite fine until I put them into the Accordion so I'm assuming the problem is some conflict between DevExpress and AjaxControlToolkit though I have no other alternative unless there's a DX accordion type control that does the same as the one from the Control Toolkit...
The error I'm getting in my browser when I try to use a date editor is
ASPx is not defined
No other details that I could find but DateEdit fields placed outside of the Accordion work perfectly.
Note that removing the accordion is not a viable solution for this project without a possible alternative being presented.
Here's my code:
<%# Register TagPrefix="ajax" Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" %>
<%# Register Assembly="DevExpress.Web.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web" TagPrefix="dx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphContent" runat="server">
<asp:UpdatePanel runat="server" ID="upAlerts">
<ContentTemplate>
<ajax:Accordion runat="server" ID="Accordion1" EnableViewState="true" CssClass="panel panel-info"
HeaderCssClass="panel-heading" ContentCssClass="panel-body">
<Panes>
<ajax:AccordionPane runat="server" ID="apAlert">
<Header>
<h3>Alert Details</h3>
</Header>
<Content>
<div class="form-group">
<label for="dtDate">Date</label>
<dx:ASPxDateEdit ID="dtDate" runat="server" DisplayFormatString="yyyy/MM/dd" CssClass="form-control"></dx:ASPxDateEdit>
</div>
</Content>
</ajax:AccordionPane>
</Panes>
</ajax:Accordion>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
I would normally suspect the problem to actually exist with the ViewState since I know these controls (ACT ones in particular) can mess with the ViewState quite a lot, but the Accordion isn't currently disabling the ViewState so I'm prepared to rule that out as a possibility at this point.
That said, I'm all out of ideas.
I even tried to rearrange the order in which the assemblies are registered on the page so that DevExpress is being registered after Ajax in an attempt to ensure that Ajax wasn't overriding anything that DevExpress needed.
As a last resort I tried switching the DevExpress date editors to Ajax calendar extenders but for some weird reason they don't render correctly either (no dates are visible on the calendar pop out).
How can I get these DateEdit controls working?
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
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>
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>
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");