Posts

Showing posts with the label Ajax Control Toolkit

Donate

Using AJAX Control Toolkit AutoCompleteExtender In ASP.NET 4.5 Web Forms

Image
Hello all, I have posted in VBForums codebank on how to integrate Ajax Toolkit's AutoCompleteExtender control in your ASP.NET 4.5 Web Forms project. The thread is in VB.NET but if your using C# just replace the code behind as described in Step 4 with the snippet below. Code Behind private static AdventureWorks2012Entities _context; [ScriptMethod()] [WebMethod] public static List< string > GetCountries( string prefixText, int count) { _context = new AdventureWorks2012Entities(); var result = ( from country in _context.CountryRegions.AsEnumerable() where country.Name.ToLower().StartsWith(prefixText, StringComparison.OrdinalIgnoreCase) select country.Name).Take(count); return result.ToList(); } [ScriptMethod()] [WebMethod] public static object GetCountryInfo( string Country) { _context = new AdventureWorks2012Entities(); var result = ( from country in _context.CountryRegions.AsEnumerable() where country.Name.ToLower().Equals(C

Remove Extra Spacing In Between NumericUpDownExtender Default Buttons (ASP.NET Ajax)

Image
When integrating NumericUpDown Extender to your asp.net apps, there's a wide gap in between the up/down buttons as shown below: The trick to remove the extra space in between NumericUpDownExtender Default Buttons is to replace the doctype declaration in master page from: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> to: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> Note: This DTD contains all HTML elements and attributes, INCLUDING presentational and deprecated elements (like font) as described in w3. So, I believe there are presentational elements or deprecated elements incorporated into this extender. Reference: StackOverflow Cheers!

The Controls collection cannot be modified because the control contains code blocks(i.e.<% …%>) (ASP.NET HTML Editor Extender)

After adding an HTML Editor extender to my asp.net page, an error shows when rendering the page to the browser as stated which is the title of this post. I found the solution in asp.net forums which is to wrap aspx markup codes enclosed with <% %> using placeholder control. The code below is in my ASP.NET Master Page: <head runat= "server" > <title></title> <link href= "~/Styles/Site.css" rel= "stylesheet" type= "text/css" /> <asp:PlaceHolder Runat= "server" > <script src= '<%=Page.ResolveUrl("~/Scripts/jquery-1.4.1.min.js") %>' language= "javascript" type= "text/javascript" ></script> </asp:PlaceHolder> <asp:ContentPlaceHolder ID= "HeadContent" runat= "server" > </asp:ContentPlaceHolder> </head> Reference: Handling Ajax Extenders Error :)

ASP.NET jQuery $find() Not Working In Onclick() Event Of Radio Button

In an application where i want trigger the onclick event of radio button that has a $find() method, which will retrieve the radio button's value, the code below doesn't work. <input type= "radio" id= "rb1" name= "format" value= "format2" runat= "server" onclick= "$find('<%=dpe1.ClientID %>').populate(this.value);" /> d.m.y <input type= "radio" id= "rb2" name= "format" value= "format3" runat= "server" onclick= "$find('<%=dpe1.ClientID %>').populate(this.value);" /> y/m/d where dpe1 is a DynamicPopulateExtender Ajax Extender.The solution I made was to remove the populate logic and transfer it to a javascript function. Here's the revised code: //javascript code function rbFunction() { //$find('<%=dpe1.ClientID %>').populate($("input:radio:c

AnimationExtender Animation Using JSON Not Working In ASP.NET

When setting animations for AnimationExtender control using JSON/Javascript, setting the AnimationTarget with the explicit control id such as panel ID does not work when rendered to browser specified by the code below: "AnimationTarget" : "panelDescription" The workaround is to get the clientID of the panel control rendered through the browser. Below is the workaround code: //Note: this is just a fragment of the JSON animation //the actual animation might be a little bit specific than this. var animation = "AnimationTarget":"' + '<%= panelDescription.ClientID %>' + '","AnimationChildren"'; //set click behavior animationExtender.set_OnClick(animation); Cheers!

Custom Extender Type Or Class Is Undefined In AjaxToolkit ASP.NET

Hi! When running an asp.net app that includes an ajax custom extender control, a javascript alert pops up message "EXTENDER is undefined". Sample error message: CustomExtenders.DisabledTextBehavior is undefined where: CustomExtenders.DisabledTextBehavior is Namespace.Type After troubleshooting for several hours, I came up with the solution: 1. Download Ajax Toolkit Stable Release for the specific .NET Framework.  I tried versions for September release and it's not working. 2. Replace code: CustomExtenders.DisabledTextBehavior.registerClass( 'CustomExtenders.DisabledTextBehavior' , AjaxControlToolkit.BehaviorBase); To CustomExtenders.DisabledTextBehavior.registerClass( 'CustomExtenders.DisabledTextBehavior' , Sys.Extended.UI.BehaviorBase); Note: AjaxControlToolkit.BehaviorBase is used in previous versions of AjaxToolkit. Cheers!

AjaxControlToolkit ExtenderControlBaseDesigner Class Requires T

Hello! The previous version of ExtenderControlBaseDesigner does not require T as parameter. However, in recent versions you might notice that the class is declared with T. Here's a sample declaration: AjaxControlToolkit.Design.ExtenderControlBaseDesigner<T> T means AjaxControlToolkit.ExtenderControlBase. In order for the Custom Extender Designer to work, supply the T with class that inherits the ExtenderControlBase. This sample class inherits the ExtenderControlBase: public class CustomPanelExtender : ExtenderControlBase { //your code goes here.... }

Show Smart Tag(Shift + Alt + F10) Is Disabled Or Greyed In ASP.NET Web Forms Server Control

When adding ajax extenders to asp.net server controls using Smart Tag, you often encounter an issue such as Show Smart Tag is greyed out/disabled. The best thing to do is to use the latest stable version of AjaxToolkit. And then, reset the toolbox. Sometimes, you have to close the Visual Studio IDE just to make sure. IDE Version: Visual Studio 2010 Professional Ajax Toolkit Binary: AjaxControlToolkit.Binary.NET4 (Stable Version) Cheers!

Ajax Control PopupControlExtender GetProxyForCurrentPopup Not Showing In Visual Studio Intellisense

I was wondering why when I type PopupControlExtender. nothing happens. Supposedly, GetProxyForCurrentPopup method will show. The solution was so simple, I forgot to include the namespace of AjaxControlsToolkit. //add namespace AjaxToolkit using AjaxControlToolkit; //call commit method PopupControlExtender pce = PopupControlExtender.GetProxyForCurrentPopup( this ); pce.Commit( "hi" );

Format Width Of AutocompleteExtender AjaxControlToolkit

By default, the width of the autocomplete list of autocomplete extender is inherited from the target control which is the textbox. However, you can customize the width and appearance of the ajax control: 1. Create an asp.net website 2. Add a webservice to your site 3. In your webservice, add a code to retrieve customer or any info. 4. In your asp.net website, add an aspx markup similar below:  Note that CompletionListElementID target control is the div called autocomplete declared below the textbox. <asp:ToolkitScriptManager ID= "ToolkitScriptManager1" runat= "server" > <Services> <asp:ServiceReference Path= "~/YourSampleService.asmx" /> </Services> </asp:ToolkitScriptManager> <div> <table> <tr> <td><asp:TextBox ID= "txtName" runat= "server" ></asp:TextBox></td> <td><div id= "AutoComplete" runat= "server&q

ScriptManager.RegisterStartupScript() Vs. ClientScript.RegisterStartupScript()

Hi! I have been struggling in manipulating scripts to focus to a particular control when a user executes a button or events triggered by postbacks.The scenario was in every button clicked, the focus will be transferred to another control. These butttons are inside an update panel and ajax tab container. The solution presented in an article i've previously posted was using ClientScript.RegisterStartupScript() to register a script. However, this script is registered in the Page object. But since my controls are inside an update panel which is partial postback rendering, the solution I've come up was using ScriptManager.RegisterStartupScript(). So, to register client scripts on an aspx page w/o ajax functionalities, use ClientScript: 1 ClientScript.RegisterStartupScript( this .GetType(), "MyScript" , script.ToString(), false ); And to register client scripts on an aspx page w/ ajax functionalities such as inside an update panel, use ScriptManager: 1 ScriptManager.

Donate