AutoComplete Extender In Master Page?
Dec 8, 2010
I went through lots of forums, posts etc. But never found really good answer on this.I'm trying to add AutoComplete Extender to TextBox and display some tips to users.Everything is fine when this code is placed in Content Page. But I've got like ~10 Content Pages based on one Master Page so it's completely stupid to repeat the code on each one.
There are some answers on the web but they are only partial ones, check if you wan't:
Could post only one link :/
Here is my code:
Master Page:
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="~/AutoComplete.asmx" />
</Services>
</asp:ScriptManager>
[Code]....
View 1 Replies
Similar Messages:
Sep 29, 2010
I'm creating just simple autocomplete sample.
taking one textbox adding autocomplete extender as
<asp:ScriptManager ID="ScriptManager2" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server" EnableTheming="True" ></asp:TextBox>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" MinimumPrefixLength="1" ServiceMethod="GetCountryInfo" ServicePath="WebService.asmx" TargetControlID="TextBox1">
</cc1:AutoCompleteExtender>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
Also creating web services as "WebService.asmx" & code inside this file is that
<%@ WebService Language="C#" CodeBehind="~/App_Code/WebService.cs" %>
------
then in Webservice.cs file i write code as
public class WebService : System.Web.Services.WebService {
MySql.Data.MySqlClient.MySqlCommand cmd = new MySqlCommand();
MySql.Data.MySqlClient.MySqlConnection con = new MySqlConnection();
//MySqlDataAdapter da = new MySqlDataAdapter();
MySqlDataReader dr;
public WebService () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public string[] GetCountryInfo(string prefixText)
{
int count = 10;
string sql = "Select * from tbl_patientmaster Where P_NAME like '" + @prefixText + "%'";
con.ConnectionString = System.Configuration.ConfigurationManager.AppSettings["HMSDBConnectionString"].ToString();
con.Open();
MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter(sql, con);
da.SelectCommand.Parameters.Add("@prefixText", MySql.Data.MySqlClient.MySqlDbType.VarChar, 50).Value = prefixText + "%";
System.Data.DataTable dt = new System.Data.DataTable();
da.Fill(dt);
string[] items = new string[dt.Rows.Count];
int i = 0;
foreach (System.Data.DataRow dr in dt.Rows)
{
items.SetValue(dr["P_NAME"].ToString(), i);
i++;
}
return items;
}
this code is not working
View 1 Replies
May 17, 2010
i have developed a AutoComplete Search with the JAX AutoCompleteExtender Now i found a solution to use these control without a webservice (amsx) you only have the function in the codebehind (default.aspx.cs) , to do this you must let theServicePath empty. In the codebehind of your webpage is only the function which gets the data from the database.Important the function must be static !! Here is a good description: http://allwrong.wordpress.com/2007/03/13/ms-ajax-autocomplete-extender-using-a-page-method/
[Code]....
default.aspx.cs
[Code]....
Let´s come to my problem, i wanted to store these functionality in a webcontrol => AutoCompleteSearch.ascx
So i put the code from the default.aspx an .cs in the AutoCompleteSearch.ascx control. After i started the webapplication there was no functionality. So tried to let the
[Code]....
View 1 Replies
Mar 18, 2013
I want to add autosuggest textbox in my masterpage, which suggest data from sql server database ....
View 1 Replies
Sep 16, 2010
I have a text box and ajax autocomplete control extender in my Master Page that it is not working at all. When I type some characters on the text box it doesn't trigger the autocomplete. I have a web service that contains the function code. I est my code on a single Web Page (No Master Page) and it works perfectly. Also, it works fine if I include the text box and the extender on the Content Page instead of on the Master Page. It is important to keep the text box in the Master Page for me. I am using Visual Studio 2008 and ASP 3.5. MASTER PAGE.
[Code]....
WEB SERVICE:
[Code]....
View 7 Replies
Mar 11, 2010
I have to use auto complete extender in .master page The problem i am facing is, the copy of ServiceMethod should exists in each and every page then only the autocomplete extender is working.
Is it possible to have the code only in .master page, if so how it is. I tried with webservices also but not working.
View 3 Replies
Feb 24, 2010
I'm using ajax autocomplete extender(from database). Its working fine in content page. But its not working in Master Page. I'm using VS2008. I'm using webservice...
<asp:ScriptManager ID="ScriptManager1"
runat="server">
<Services>
<asp:ServiceReference Path="Autocomplete.asmx" />
</Services>
</asp:ScriptManager>
[Code]....
View 12 Replies
Jun 16, 2015
I saw [URL] ....
How to show two indicators instead of one indicator.....
View 1 Replies
Apr 27, 2016
Modal popup not working, I need to open modal pop up inside a panel, below is my html, senerio goes as :
On page load on only panel with id="pnlgrid" is visible and button with id btnaddnew is visible on clicking addnewbutton panel grid is visible false and panel with id=pnlFormEdit is visible true.
Inside there is linkbutton1 on which click i want to open popup. but on clicking it goes postback.
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="DutySlip.aspx.vb" Inherits="_DutySlip" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<style type="text/css">
[Code] .....
View 1 Replies
Jan 14, 2011
how to use autocomplete extender in asp.net
View 1 Replies
Jun 7, 2010
I am using AJAX Control toolkit V-1.0.
I am coming across one problem with auto complete extender in my application, problem seems to simple but i can't find any satisfactory solution. In one form, i have set auto complete extender on one text box, i have set one web service, in which one function is there, which fetches existing records from db, on first load, if i write releavent words with that of db, i can't see the extender, but if once either i minimize the page or give tab despite AutoPostBack property of text box is false, then after writing something in text box shows me the extender.
Here are the properties of both text box and extender
<asp:TextBox
ID="txtCompanyName"
runat="server"
CssClass="txt"
MaxLength="100"
TabIndex="4"
Width="443px"
></asp:TextBox>.........
View 1 Replies
Aug 22, 2010
I have a ajax autocomplete extender and everything works fine. I mean sql procedure and others are fine but when I enter something to textbox nothing happened. Why is that?
Here is my codes.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
[Code]....
View 1 Replies
Aug 22, 2010
I have a ajax autocomplete extender and when I enter something to textbox nothing happened. Why is that?
Here is my codes.
[Code]....
HTML Side:
[Code]....
View 11 Replies
May 12, 2010
Iam getting an array of list from database to client side(javascript array).Now my aim to place those values in a div one by one and that div should attach to the textbox similar to Autocomplete extender.
View 4 Replies
Feb 11, 2011
Textbox is now woking as per the requirment:
HTML:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AutoComplete.aspx.cs" Inherits="AutoComplete" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!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">
[Code]....
When I browse the web service in the browser, it is working fine but not working on aspx
View 1 Replies
Dec 20, 2010
how to implement autocomplete extender? i want to take datas from a particular table and store in autocomplete textbox.
View 5 Replies
Jul 7, 2010
I implemented autocomplete extender,functionality is working great but my issue is with CSS.It works as expected in Firefox(it applys all stylesheets perect) but in IE it is not behaving as expected it is showing the list about 10 pixels left to the text box.
googled couple of things but none of them were working for me.
My stylesheet:
.listItem
{
background-color: white;
padding: 1px;
}
.highlightedListItem
[Code]....
View 1 Replies
Apr 22, 2010
i have installed AjaxControlToolkit for framework 3.5 . my application is in virtual folder on the server which has Autocomplete Extender control, when i browse, control is not returning any list nor any error message. it is working fine in the localhost, is it because of the subfolder or any other reason i dont understand
View 2 Replies
Jun 16, 2010
I'm yet another programmer who find out that AJAX autocomplete extender doesn't work although I've searched several pages and saw where the biggest problems occur.I'm using ASP.NET 2.0 and AJAX for the same version. Few months ago I've included modalPopupExtender in to the same project and it's working fine.However with AutoCompleteExtender have no luck..ASPX page:
[Code]....
and web service:
[Code]....
I was using this site for reference:ttp://dotnetslackers.com/Community/blogs/kaushalparik/archive/2008/06/06/autocomplete-textbox-using-ajax-autocompleteextender-from-database.aspxBut when I type something in textbox nothing happenes. However in IE8 I got message that there is script error.
View 13 Replies
Jul 21, 2010
In my recent project i have used auotcomplete extender. it work well with simple textbox
Now i want to use it with gridview , in my application for fill product details for any order i have used gridview if user wants to add multiple products so by making class create list of objects of that class and bind to gridview i am able to add row. in that row one field stock code now on that i want to use autocomplete extender as per below code
[Code]....
View 4 Replies
Mar 24, 2011
I am using AutoComplete ASP.NET AJAX Control toolkit AutoCompleteExtender control When I am using my web service as Service Path, its not working.my web services code below
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
using System.Web.Script.Services;
namespace OnlineSalesGrid
{
/// <summary>
/// Summary description for sample
/// </summary>
[WebService(Namespace = [URL]]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class sample : System.Web.Services.WebService
{
[WebMethod]
public static string[] GetCompletionList(string prefixText, int count)
{
List<string> returnData = new List<string>();
SqlConnection con = new SqlConnection("Data Source=CARPATHIA\SQLEXPRESS;Initial Catalog=OnlinesaleGrid;Persist Security Info=True;User ID=sa;Password=c0rpusdata");
string sql = "select Customer_Name from Customer_Master where Customer_Name like '%" + prefixText + "%'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read()) { returnData.Add(reader["Customer_Name"].ToString()); }
return returnData.ToArray();
}
[WebMethod]
public static string[] GetCompletionList1(string prefixText, int count)
{
List<string> returnData = new List<string>();
SqlConnection con = new SqlConnection("Data Source=CARPATHIA\SQLEXPRESS;Initial Catalog=OnlinesaleGrid;Persist Security Info=True;User ID=sa;Password=c0rpusdata");
string sql = "select Customer_Code,Customer_Name from Customer_Master where Customer_Code like '%" + prefixText + "%'";
SqlCommand cmd = new SqlCommand(sql, con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (reader.Read())
{
returnData.Add(reader["Customer_Code"].ToString());
}
return returnData.ToArray();
}
}
}
Html Code is
<asp:ScriptManager ID="toolscpt1" runat="server" >
<Services>
<asp:ServiceReference Path="~/sample.asmx" />
</Services>
</asp:ScriptManager>
<asp:TextBox
ID="txtcname" runat="server" CssClass="textbox" onBlur='funblurcolor(this.id)' onFocus='funfocuscolor(this.id)'
ontextchanged="txtcname_TextChanged1" onkeypress="javascript:if(window.event.keyCode == 13) document.getElementById('txtphno').focus" ></asp:TextBox>
<asp:AutoCompleteExtender ID="txtname_AutoCompleteExtender"
runat="server" Enabled="True" ServiceMethod ="GetCompletionList" ServicePath="~/sample.asmx"
MinimumPrefixLength="1" CompletionSetCount ="12" EnableCaching ="true" CompletionInterval ="500"
TargetControlID="txtcname" ></asp:AutoCompleteExtender>
View 14 Replies
Jun 25, 2010
I have used autocomplete extender in my web application. It works perfectly on localhost, but when i try to access from different machine its not working.
View 6 Replies
Feb 11, 2010
I'm using Sys.UI.DataView and i have input of type text. I bind this input using live binding syntax and it works, but i want to add to this input autocomplete funcionallity.The problem is that autocomplete extender needs server side asp:TextBox and i can't find how to implement livebindng on this server control...
<asp:TextBox runat="server" id="txtTagsEdit">{{Name}}</asp:TextBox>
.... this do not works.
View 1 Replies
Jun 15, 2010
i need to pass two parameter in a autocomplete extender.below is my code and here i pass one parameter for autocomplete extender in web service.
[Code]....
here i pass a parameter :prefixtext.but in this query i need to pass one more parameter.i.e in that query one more condition i need like finanicial year. like where upper(reg_no) like @prefix and adm_fnyr=@fnyr.
so how can i pass and execute like this.i mean i need those reg_no which not in hreadmission table in same finanical year.
View 3 Replies
Mar 30, 2010
I have an ASP.NET AJAX autocomplete extender with CompletionListCssClass=autocomplete_completionListElement :
.autocomplete_completionListElement
{
width:500px;
margin : 0px!important;
background-color : inherit;
color : windowtext;
border : buttonshadow;
border-width : 1px;
border-style : solid;
overflow :auto;
height : 200px;
text-align : left;
}
But for some odd reason the width of the auto complete list always takes up the width of the textbox even when I set the width to 500px.
View 2 Replies