Binding Course Information
function Changeddl () {
$.ajax ({
Type: "Post",
URL: "Changezsdhandler.ashx",
Data: "Username=" + $.trim ($ ("#hidUserName"). Val ()),
DataType: "Text",
Success:function (data) {
if (Data! = "") {
$ ("#ddlKc"). Append (data);
}
}
});
}
<select id= "DDLKC" >
</select>
Code in AJAX
if (context. request["username"]! = NULL)
{
Username = context. request["username"]. ToString ();
DataTable dt = Kmbll. BINDKC (username);
StringBuilder Sboptione = new StringBuilder ();
Sboptione.append ("<option value= ' 0 ' > = = = Please select the course ¨¬=== </option>");
if (dt! = NULL)
{
if (dt. Rows.Count > 0)
{
foreach (DataRow dr in Dt. Rows)
{
Sboptione.append ("<option value=\" "+ dr[" Kmid "] +" \ ">" + dr["kmname"] + "</option>");
}
}
}
Context. Response.Write (Sboptione.tostring ());
}
Else
{
Context. Response.Write ("");
}
Context. Response.End ();
Using the AJAX binding drop-down list