FIROZ ANSARI

FIROZ ANSARI

  • NA
  • 52
  • 5.6k

About Drop down List

Nov 17 2016 1:51 AM
Hi   Guys   
 
Please Help me i am getting this error  whenever i am selecting any data from drodown lisy
 
[WebMethod]
public static List<ListItem> GetClassgrp()
{
string query = "select CODE,DESC_E from S_CLASS_GRP Order By 1";
string connectionstring = ConfigurationManager.ConnectionStrings["constrIND"].ConnectionString;
using (OracleConnection con = new OracleConnection(connectionstring))
{
using (OracleCommand cmd = new OracleCommand(query))
{
List<ListItem> classgrp = new List<ListItem>();
cmd.CommandType = CommandType.Text;
cmd.Connection = con;
con.Open();
using (OracleDataReader sdr = cmd.ExecuteReader())
{
while (sdr.Read())
{
classgrp.Add(new ListItem
{
Value = sdr["CODE"].ToString(),
Text = sdr["DESC_E"].ToString()
});
}
}
con.Close();
return classgrp;
}
}
}
 
and this method i am calling by JQuery Ajax
 
$.ajax({
type: "POST",
url: "DropDwonPopulate.aspx/GetClassgrp",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (r) {
var ddlCLG = $("[id*=ddlCLG]");
ddlCLG.empty().append('<option selected="selected" value="%">All</option>');
$.each(r.d, function () {
ddlCLG.append($("<option></option>").val(this['Value']).html(this['Text']));
});
}
});
 and this is my error 

Answers (2)