I am working with radautocompletebox to fetch email addresses for a user from sharepoint userprofile.
i have a webservice method created that returns the matching email address.
the first time it works and when i search again for another user or same user whenever i type anything in the box it throws the erro called object refrence not set to an instance of object. but if i reload the page again then it works.
here is the code for my webservices and the rad autocompletebox.
i have a webservice method created that returns the matching email address.
the first time it works and when i search again for another user or same user whenever i type anything in the box it throws the erro called object refrence not set to an instance of object. but if i reload the page again then it works.
here is the code for my webservices and the rad autocompletebox.
//error i am getting at the browser when i type anything second time in the radautocompletebox...SCRIPT5022: Sys.InvalidOperationException: Type Telerik.Web.UI.AttributeCollection has already been registered. The type may be defined multiple times or the script file that defines it may have already been loaded. A possible cause is a change of settings during a partial update. ScriptResource.axd?d=QJ81aqhAwulu2hIOFMDEkrm2EPI_p5Rwn1qI6uFkGM6jPgRdNCdVCW-Ayu0H8f67BVUhz1dDf0p53SEzAsTbe86n4C8no9dnNoDIOecQwHTcrKnohckOhEi-82CZIS9S59Q-OnLMc6Zo--sMwRT5nIG_jACybbgI7netGoKwKlFGkZtn0&t=ffffffffb868b5f4, line 1717 character 42SEC7115: :visited and :link styles can only differ by color. Some styles were not applied to :visited. //web service method that returns the selected email address of the input typed in the radautcompletebox[WebMethod] public AutoCompleteBoxData FilterEmailaddress(RadAutoCompleteContext context) { string prefixText = context.Text.ToString(); List<AutoCompleteBoxItemData> result = new List<AutoCompleteBoxItemData>(); AutoCompleteBoxData dropdowndata = new AutoCompleteBoxData(); List<String> existingemailadd = UserEmailAddress(); var q = from string s in existingemailadd where s.ToLower().StartsWith(prefixText.ToLower().Trim()) select s; foreach (string s in q) { AutoCompleteBoxItemData itemdata = new AutoCompleteBoxItemData(); itemdata.Text = s; itemdata.Value = s; result.Add(itemdata); } if (result.Count > 0) { dropdowndata.Items = result.ToArray(); } return dropdowndata; } //list returing the emailaddresses for all users from the userprofile private List<String> UserEmailAddress() { List<String> emailaddress = new List<string>(); HttpContext context = System.Web.HttpContext.Current; string protocol = context.Request.ServerVariables["HTTPS"].ToString().Equals("ON", StringComparison.CurrentCultureIgnoreCase) ? "https" : "http"; string port = context.Request.ServerVariables["SERVER_PORT"].ToString(); string server = context.Request.ServerVariables["Server_Name"].ToString(); string address = string.Format("{0}://{1}:{2}", protocol, server, port); SPSecurity.RunWithElevatedPrivileges(delegate { using (SPSite site = new SPSite(address)) { try { SPServiceContext servicecontext = SPServiceContext.GetContext(site); UserProfileManager userProfileManager = new UserProfileManager(servicecontext); foreach (UserProfile user in userProfileManager) { string emailadd = (string)user["WorkEmail"].Value; emailaddress.Add(emailadd); } } catch (Exception ex) { } } }); return emailaddress; } // Radautocompletebox in aspx<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" AllowCustomEntry="true" DropDownHeight="150px" DropDownWidth="250px" runat="server" InputType="Text" Filter="Contains"> <TextSettings SelectionMode="Single" /> <WebServiceSettings Path="/_layouts/WebServices/emailService.asmx" Method="FilterEmailaddress" /> </telerik:RadAutoCompleteBox>