TextBoxWatermarkExtender - asp.net

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>

Related

ajaxtool kit - Html editor tools not displayed

I have installed ajaxtoolkit version 4.5 and included below lines in the config under controls tag
<add tagPrefix="ajaxtoolkit"
namespace="AjaxControlToolkit"
assembly="AjaxControlToolKit"/>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor" TagPrefix="cc1" %>
<ajaxtoolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxtoolkit:ToolkitScriptManager>
<cc1:Editor ID="Editor1" runat="server" Width="300" Height="400"/>
if i use html editor control getting the below error in IE9
0x800a139e - Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.
and in chrome the editor is displayed with no tools in it.
Please help to resolve this
Please change your code like this:
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></cc1:ToolkitScriptManager>
HTML Markup:
<cc1:Editor ID="Editor1" runat="server" Width="300" Height="400"/>
You can save your HTMLEditor content in database like this:
string lsPageContent = Server.HtmlEncode(Editor1.Content);
Insert into [TableName] (PageContent) Values ('" + lsPageContent + "');
and fetch page content like this:
Editor1.Content = Server.HtmlDecode(YourcolumnValue);

How can I add namespaces to my asp.net page?

I've just added Ajax Control Toolkit with NuGet, and I want to add the following piechart:
<ajaxToolkit:PieChart ID="pieChart1" runat="server" ChartHeight="300"
ChartWidth="450" ChartTitle="Widget Production in the world"
ChartTitleColor="#0E426C">
<PieChartValues>
<ajaxToolkit:PieChartValue Category="United States" Data="45"
PieChartValueColor="#6C1E83" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Europe" Data="25"
PieChartValueColor="#D08AD9" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Asia" Data="17"
PieChartValueColor="#6586A7" PieChartValueStrokeColor="black" />
<ajaxToolkit:PieChartValue Category="Australia" Data="13"
PieChartValueColor="#0E426C" PieChartValueStrokeColor="black" />
</PieChartValues>
</ajaxToolkit:PieChart>
However, my page has no clue what PieChart is, how can I add ajaxToolkit and link it to the dll file in the aspx page?
Mine looks like this:
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
If you drop an ajax control onto the form, it should create the registration for you. Mine above is an auto generated reference to the ajax toolkit. You also have to add a reference to the Ajax dll through the project references (although Nuget might have done this already, not sure).
I hope the following images will be useful. And download the needed AJAX .dll file.
Add this:
<%# Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %>
Step 1:
Step 2:
Step 3:
Step 4:

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