ASP.Net Ajax Error: There was an error processing the request

Last Reply one month ago By dharmendr

Posted one month ago

hi all

At the beginning of typing in the text box

This message appears and when you click Accept, the message will disappear without any problems on the page

It appears only once

{"Message":"There was an error processing the request.","StackTrace":"","ExceptionType":""}


public partial class daily : System.Web.UI.Page
    public static List<string> GetCompletionList(string prefixText)
        using (OracleConnection con = new OracleConnection("data source=localhost:1521/orcl; user id=alhakimy; password=alhakimyyes;"))
            using (OracleCommand com = new OracleCommand())
                com.CommandText = "select doc_no, doc_name from doctors where city_no= " + HttpContext.Current.Session["city_no"].ToString() + " and doc_name like '%" + prefixText + "%' ";
                com.Parameters.Add("TextBox1", prefixText);
                com.Connection = con;
                List<string> summ = new List<string>();
                using (OracleDataReader sdr = com.ExecuteReader())
                    while (sdr.Read())
                        summ.Add(string.Format("{0}-{1}", sdr["DOC_NAME"], sdr["Doc_NO"]));//اذا اضفنا عمود جملة السكلته سنضيفه هنا كالبقية
                return summ;
    protected void Submit(object sender, EventArgs e)
        string doc_name = Request.Form[TextBox1.UniqueID];
        string doc_no = Request.Form[hfdoc_no.UniqueID];
        ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Name: " + doc_name + "\\nNO: " + doc_no + "');", true);


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

<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!DOCTYPE html>

<html xmlns="">
<head runat="server">
    <meta charset="utf-8" />   <!-- قبول الرموز في المتصفح -->
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />   <!-- توافق العمل مع اكسبلورر -->
    <meta name="viewport" content="width=device-width, initial-scale=1" />   <!-- التوافق مع الموبايل -->
    <title>Daily Report</title>
    <script type="text/javascript" src=""></script>
    <script type="text/javascript" src=""></script>
    <link rel="Stylesheet" type="text/css" href="" />
    <script type="text/javascript">
    $(function () {
            source: function (request, response) {
                    url: '<%=ResolveUrl("~/daily.aspx/GetCompletionList") %>',
                    data: "{ 'prefixText': '" + request.term + "'}",
                    dataType: "json",
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    success: function (data) {
                        response($.map(data.d, function (item) {
                            return {
                                label: item.split('-')[0],
                                val: item.split('-')[1]
                    error: function (response) {
                    failure: function (response) {
            select: function (e, i) {
            ///////////هذا القسم يقو باضهار رساله في حاله قام المستخدم بكتابة اسم من خارج القائمة
            change:function(e, ui){
                    alert("الاختيار من القائمة فقط");
            minLength: 1
    <form id="form1" runat="server">
        <asp:TextBox ID="TextBox1" runat="server" onpaste="return false" oncopy="return false" oncut="return false" Height="30px" style="font-size: large; font-weight: 700" Width="235px"  Enabled="False" autocomplete="off"></asp:TextBox>


Posted one month ago

I will get back to you soon.

Posted one month ago

Hi alhakimyyes,

I have checked your code.

There is no issue with it.

In web.config under <system.web> add <customerrors mode="Off" /> to see full exception and let me know.

You might be facing maxJsonLength. So try to set this property and check. 

ASP.Net AJAX Error: The length of the string exceeds the value set on the maxJsonLength property