.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Using Ajax AutoCompleteExtender on dynamic fields

Posted By:      Posted Date: August 24, 2010    Points: 0   Category :ASP.Net


I have quite a problem with a form that contains an autocomplete function. The page is an aspx page with c# codebehind.

On the form there is an address field that the user can type in any string address. This field is using an Ajax autocomplete extender, which suggests roadnames to the user. This works fine.
Furthermore the user has the option to add multiple address fields when clicking a button. This works fine now with Jquery. Jquery copies the table which contains, besides other fields, the address field, and "paste" it underneath the existing adress field.

Problem is, how do I attach the Ajax autocomplete extender to the address fields that gets added? Or is there another workaround to make all these fields have this autocomplete function?

Here is my simplfied code:

aspx page:

<td width="200">
  <asp:TextBox ID="TextBoxStopRoadName" runat="server" Width="200"></asp:TextBox>
      <asp:AutoCompleteExtender runat="server"

View Complete Post

More Related Resource Links

Need help regarding C# / AJAX Dynamic Controls creation


radiobuttons is assigned before page init.. 

public partial class Default : System.Web.UI.Page
//Assign values as a specific Dynamic WebControl Creation.
List<RadioButton> radioButtons = new List<RadioButton>();
List<CheckBox> checkBoxes = new List<CheckBox>();

Then I created a class that would dynamically create a table containing the available flights depending on session.. (See CallPageLoad())

The placeholder and button is inside the UpdatePanel...

on the button inside the update panel, (btnSelect)

i have this code which works... 

protected void btnSelect_Click(object sender, EventArgs e)

Label1.Text = Convert.ToString(radioButtons.Count);

It detects the number of radiobuttons that were dynamically created...

But when I use the following code inside the BtnSelectClick event...

//PLS HELP.......
foreach (RadioButton button in radioButtons)
if (button.Checked == true)
Label1.Text = "You select... " + button;



It does not work even though t

Uploading to SQL Server using AJAX muiltiple file uploader and dynamic SQL Server Tables


I am getting an error on the following code when trying to pload files directly to a database.  

 Incorrect syntax near ','.

 Incorrect syntax near 'image'.


    Private Sub Uploader_FileUploaded(ByVal sender As Object, ByVal args As UploaderEventArgs)

        Dim data() As Byte = New Byte((args.FileSize) - 1) {}

        Dim stream As Stream = args.OpenStream

        stream.Read(data, 0, data.Length)

    End Sub


Private Sub ButtonTellme_Click(ByVal sender As Object, ByVal e As EventArgs)


        Dim objConn As New SqlConnection("Data Source=mrpoteat.db.2798093.hostedresource.com; Initial Catalog=mrpoteat; User ID=mrpoteat; Password=Colgate23;")


        Dim strCommandText As String = ""

        For index = 1 To Attachments1.Items.Count Step 1

            strCommandText += "pic" + index.ToString() + Space(5)

Dynamic gallery using ListView and AJAX


I want to create a gallery where on top there will be a normal view of a selected image and below a horizontal listview in order to select an image. Both in separate ajax update panels.

When i debug i get the following error "Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" and highlights the "ImageButton imgbtn =(ImageButton)ListView1.Items[ListView1.SelectedIndex].FindControl("ImageButton2");" of my code behind file

Can anyone help me? Thank you in advance!

Here is my code:

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" runat="server

Ajax AutocompleteExtender not working from IIS


I am using  AjaxAutoCompleteExtender  in my asp.net program (C#) . I am applying the extender to a texbox and using internal Web Service. I am getting the desired result, when i am running from the development environment. After Publishing the site to IIS, I am not getting the list and not showing any errors. I have turned off custom errors. My website is not an Ajax Enabled WebSite. So i added the lines into my Web.Config.

I tried all service path.. http://localhost/Test/ WebService.asmx

and i tried ~/Test/WebService.aspx


While testing from the development environment, i am using the last one.

I am not sure whether this is the problem with the service path or any permission issue.



Dynamic Ajax Calender Extender

hi i dynamically create Calender Extender and set TargetControl ID and PopupControl Id as dynamically created TextBox Its works fine in windows XP but i tried in Windows 7 return lots of javascript errors value can't be null then something.....   if i didn't add that dynamically created Calendar Extender than no pbm if add then got this errors wats the wrong in windows 7 OS   i m using Vs2008 SP1, Latest Ajax Control Toolkit 

Sproc with dynamic Where fields

I've got a textbox where the user enters data and I've got a DropDownlist, with 2 fields in it (code and tag) I need to create a stored procedure which uses the textbox, but it also uses the field names from the DropDownList it's kind of  like this ' if user chooses 'code':where code= textbox1.text 'if user chooses 'tag':where tag=textbox1.text How can this be done?

how to use autocompleteExtender in ASP.net AJAX

In the tutorial for autocomplete text box for static page method in c# the following lines of code is given. When i use it my website using c# it gives error 'invalid term "in" showing in line 7. Why is it so.Plz help me. [System.Web.Services.WebMethodAttribute(), System.Web.Script.Services.ScriptMethodAttribute()]   public static string[] GetCompletionList(string prefixText, int count, string contextKey) {       // Create array of movies       string[] movies = {"Star Wars", "Star Trek", "Superman", "Memento", "Shrek", "Shrek II"};          // Return matching movies       return (from m in movies where m.StartsWith(prefixText,StringComparison.CurrentCultureIgnoreCase) select m).Take(count).ToArray();   } 

Creating Dynamic Group Fields for a Crystal Report?

I have a VB.Net application which generates quite a few Crystal Reports. One report in particular has a Group Section. What I am trying to do with my VB.Net app is pass a value (a sql server column name used in the report). This value is represented by radio buttons. For example, the user may check either "ZipCode" or "State" or "Category" or "Type" or "Vendor". Each of these options represent a column in the database table used in the report. I simply want to be able to write the "SelectionFormula" using one of these options but not sure how to go about it. Thanks, Blake

Dynamic rows(fields) generation in crystal reports

Hi.....frnds,     I am working on Crystal reports.My requirement is that i need to  generate dynamic fields according to the count of Family_Members column in sql server database,for example if i have '4' in 'Family_Members' column i need to generate 4(Family members details)dynamically.

ASP.Net Dynamic Data - DropDownList Field Template with AJAX Cascading DropDown Extension

Hi all,   Have spent hours trying to create a Dynamic Data Field Template holding a DropDownList which is extended by the AJAX Cascading DropDown extension. Final form holds multiple cascading dropdown boxes. User selects Country (Land) then Postcodes, Counties (Provincie) are populated. Once postcode is selected then towns (Plaats) are populated.  The problem I am now facing is that the viewstate for the dropdown lists is not being saved/restored after an insert action or custom validation error. So basically the dropdown lists are being reset to their default values. Some code (if missing parts, just ask and I will post them) - Don't mind the code structures etc... needs some refactoring :) Attribute I created:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Data { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] sealed public class CascadingDropDownParametersAttribute : Attribute { //public string TargetControlID; // The ID of the DropDownList to populate. public string Category; // The name of the category this DropDownList represents. public string PromptText; // Optional text to display before the user has selected a value from the DropDownList. public string

AJAX AutoCompleteExtender Not Calling WebMethod

I have the correct signature for the web method, and it works fine,  but for some reason it is not being called at all by AutoCompleteExtender<div> <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"> <Services><asp:ServiceReference Path="~/AutoComplete.asmx" /></Services> </asp:ToolkitScriptManager> <asp:TextBox ID="txtUser" runat="server"></asp:TextBox> <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtUser" ServicePath="~/AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1" EnableCaching="true" UseContextKey="false"> </asp:AutoCompleteExtender> </div>  Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.Web.Script.Services Imports System.ComponentModel Imports System.Data.SqlClient ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiP

Dynamic Javascript in Ajax Partial View

I have a partial view which uses Ajax.ActionLink to perform paging.  The AjaxOptions in the link identify the update target (a div on the main view) and some javascript to run OnSuccess (in the partial view).  The javascript must be in the partial view since there is some information in the partial view required to properly wire up the jQuery in the javascript.  This isn't working as expected.  The sample below is the minimum code to duplicate the behavior I am seeing: Controller: private static int count; // // GET: /Home/ public ActionResult Index() { ViewData["Test"] = count++; return View(); } [HttpPost] public ActionResult TestPartial() { ViewData["Test"] = count++; return PartialView(); } View:  <%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>Index</title> <script src="../../Scripts/MicrosoftAjax.js" type="text/javascript"></script> <script

generate dynamic fields crystal report

  I want to add a Dynamic column in Crystal report at run time. Because I dont know about the columns in design time. The columns will come based on the user selection. So i want to Add a column to Crustal report at run time. I am using Crystal report. If it is not support to add column in Crystal report at runtime. Please kindly give the other solution or other third party tool like. Which version will support to add dynamic column in Crystal report? i already used the crosstab report but thats not work for my scenario.becoz i want to add another colums at right side ( after total of each row ) , which is crosstab report not supported 

Ajax AutoCompleteExtender displaying incorrectly or causing javascript errors


I have an autocomplete extender working well with IE and Firefox but it is either displaying incorrectly or causing the error below in Chrome and Safari.

Displaying incorrectly: At times the autocomplete list appears in the lower right corner of the browser.  It still works at this point though.

Error: The list stops appearing along with the halting of all of the JavaScript on the page.  I captured the error (see below).  In order to get the page to operate correctly again, I have to refresh the page.

Things to note:

  • There are two autocomplete extenders on two separate textboxes both of which trigger an asynchronous post-back that updates the value of the other (to ensure the data is correct according to the database).
  • These are both located in an update panel that triggers the a-post-back.
  • I have customized the CSS but when I set the CSS back to the defaults for AjaxControlToolkit there was no change to the behavior described above.

Thank you in advance for your help!


Uncaught TypeError: Cannot call method 'show' of null


dynamic fields added/removed depending on user selection


Is it possible to dynamically add/remove fields upon creating an item in a list?

For example:
If user selects from drop down list and chooses "Booked"

and a date field name "Booked Date" will dynamically pop up underneath.

And if user selects a different choice, the date field will dissapear.

Can someone point me to anything that can be of help?

I searched around and noticed that this can be achieved via javascript using the ows.js object model?

Thank you for your help.

Does Simple Dynamic Data Fields exist using VWD10?



Hello, everyone.

I created this simple dynamic data form using Dreamweaver cs4, ASP VB technology and a MySQL Database:


I love all of the extended functionality that VWD 10 provided, but the most important functionality for me is to be able to completely design a dynamic data table any way I want.

I noticed after researching extensively that the GridView, ListView and DetailsView templates still leave me very limited in what I can design.

My question: is there a way for me to design a table in a details page with record placeholders that will be fetched from a master/detail page set?

ajax confirm button for dynamic hyper link?



Is there any way of using ajax confirm button for dynamically created hyper link control?

I am using data in table and each row has dynamically created link control, so if the user click on the link then it will delete the row from database. Is there any way if i can use ajax confirm button for hyper link?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend