Click here to Skip to main content
14,924,138 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
<script type="text/javascript" language="javascript">
   $(document).ready(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "QuotaMaster.aspx/BindDatatoDropdown",
data: "{}",
dataType: "json",
success: function(data) {
$.each(data.d, function(key, value) {
$('#<%=ddlmode.ClientID%>').append($("<option></option>").val(value.mode_id).html(value.planmode));
});
},
error: function(result) {
alert(result);
}
});
});
    
    </script>


QuotaMaster.aspx

C#
[WebMethod]
protected static BindModeDetails[] BindDatatoDropdown()
{
   try
   {
      DataTable dt = new DataTable();
      List<BindModeDetails> bindMode = new List<BindModeDetails>();
      using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["constring"].ConnectionString))
      {
         using (SqlCommand cmd = new SqlCommand("select mode_id ,planmode From tbl_planmode",con))
         {
            if (con.State == ConnectionState.Closed)
            {
               con.Open();
            }
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(dt);

            foreach (DataRow drRow in dt.Rows)
            {
               BindModeDetails mode = new BindModeDetails();
               mode.mode_id = int.Parse(drRow["mode_id"].ToString());
               mode.Planmode = drRow["planmode"].ToString();
               bindMode.Add(mode);
            }

            if (con.State == ConnectionState.Open)
            {
               con.Close();
            }
         }
      }
      return bindMode.ToArray();
   }
   catch (Exception ex)
   {
      throw ex;
   }
}

public class BindModeDetails
{
   public int mode_id
   {
      get;
      set;
   }
   public string Planmode
   {
      get;
      set;
   }
}



im getting




How do i solve it
Posted
Updated 14-May-14 3:28am
v4
Comments
Vi(ky 13-May-14 10:04am
   
Try to debug & see on which line of code error throw
King Fisher 14-May-14 9:23am
   
i am new to this.i don't know how to debug properly.i runned this form and i press f12 then its throw the error.
Bernhard Hiller 15-May-14 3:12am
   
Configure the server such taht it shows exception details. And then tell us the details.

1 solution

Hi...
It may be problem for IIS 7.0 using the Application Pool integrated pipeline mode.

1) Try this in web.config file.
XML
<system.webServer>
        <validation validateIntegratedModeConfiguration="false" />
</system.webServer>

Thank u.
   
Comments
King Fisher 13-May-14 9:33am
   
i have this lines already ;)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900