c# - AutoCompleteExtender suddenly stopped working -
i have implemented ajaxcontroltoolkit autocompleteextender in 1 of projects , working fine. 1 day when opened project, autocompleteextender stopped working. other features of toolkit calendar control working fine.
to investigate issue, tried creating new web application , copied same code in new application worked fine. can sombody this.
i using version 4.1.50731 of ajaxcontroltoolkit , below code have written.
register assembly:
<%@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="cc1" %>
aspx page:
<form id="form1" runat="server"> <div> <span class="span-formitem"> <asp:label id="lblname" runat="server" text="name"></asp:label><br /> <cc1:toolkitscriptmanager runat="server" id="toolkitscriptmanager1" enablepagemethods="true"></cc1:toolkitscriptmanager> <asp:textbox id="txtname" runat="server"></asp:textbox> <cc1:autocompleteextender servicemethod="searchemployees" minimumprefixlength="3" completioninterval="100" enablecaching="false" completionsetcount="10" targetcontrolid="txtname" id="autocompleteextender1" runat="server" firstrowselected="false"> </cc1:autocompleteextender> </span> </div> </form>
code getting data:
[system.web.script.services.scriptmethod()] [system.web.services.webmethod()] public static list<string> searchemployees(string prefixtext, int count) { using (sqlconnection conn = new sqlconnection()) { conn.connectionstring = "data source=dd-sql21;database=cmcm;user id=cmcm;password=xx@12xx"; using (sqlcommand cmd = new sqlcommand()) { cmd.commandtext = "select top 15 employeename" + " employee_master" + " employeename '%" + prefixtext + "%'" + " order (case when employeename '" + prefixtext + "%' 1" + " when employeename '% " + prefixtext + "%' 2" + " else 3" + " end);"; cmd.parameters.addwithvalue("@searchtext", prefixtext); cmd.connection = conn; conn.open(); list<string> employees = new list<string>(); using (sqldatareader sdr = cmd.executereader()) { while (sdr.read()) { employees.add(sdr["employeename"].tostring()); } } conn.close(); return employees; } } }
Comments
Post a Comment