asp.net - Is there a max limit a autocomplete extender can have? -
i have an autocomplete extender on page searches database based on last name. reason when searching "smith" should return 1564 results nothing being returned? when search other names works fine "jones" etc. thinking "smith" has rows , there limit or something? ideas?
<asp:textbox id="doctornametextbox" runat="server" height="24px" width="739px" font-size="small"></asp:textbox> <asp:autocompleteextender id="autocompleteextender" runat="server" delimitercharacters="" enabled="true" servicepath="autocomplete.asmx" servicemethod="getcompletionlist" targetcontrolid="doctornametextbox" minimumprefixlength="2" usecontextkey="true" contextkey="statedropdown" completionlistelementid="autocompletedropdownpanel" onclientitemselected="getselected" completionsetcount="20" showonlycurrentwordincompletionlistitem="true"> public function getcompletionlist(prefixtext string, count integer, byval contextkey string) string() try dim con sqlconnection dim cmd sqlcommand con = new sqlconnection dim test string test = contextkey con.connectionstring = "" con.open() cmd = new sqlcommand cmd.connection = con cmd.commandtext = "select npi, [entity type code], [provider last name (legal name)], [provider first name],[provider first line business mailing address], [provider business mailing address city name], [provider business mailing address state name], [provider business mailing address postal code] npidata ([provider business mailing address state name] = @state) , ([provider last name (legal name)] n'%' + @provider + n'%') order [provider first name]" cmd.parameters.addwithvalue("@provider", prefixtext) cmd.parameters.addwithvalue("@state", contextkey) dim customers list(of string) = new list(of string) dim reader sqldatareader = cmd.executereader() while reader.read customers.add(reader("provider last name (legal name)").tostring + ", " + reader("provider first name").tostring + " " + reader("provider first line business mailing address").tostring + " " + reader("provider business mailing address city name").tostring + ", " + reader("provider business mailing address state name").tostring + " " + reader("provider business mailing address postal code").tostring + " " + reader("npi").tostring) end while con.close() return customers.toarray catch ex exception msgbox(ex.tostring) end try end function
when list returned web service exceeds max jsonserialization limit of 102400 (string length), autocompleteextender
fails silently. way "fix" (although not practical) increase value in web.config so:
make sure have section in sectiongroup section. if don't, add it.
<sectiongroup name="system.web.extensions" type="system.web.extensions"> <sectiongroup name="scripting" type="system.web.extensions"> <sectiongroup name="webservices" type="system.web.extensions"> <section name="jsonserialization" type="system.web.extensions"/> </sectiongroup> </sectiongroup> </sectiongroup>
and set value:
<configuration> <system.web.extensions> <scripting> <webservices> <jsonserialization maxjsonlength="50000000"/> </webservices> </scripting> </system.web.extensions> </configuration>
Comments
Post a Comment