ASPX Page
<script type="text/javascript">
$(document).ready(function () {
GetItemName();
})
function GetItemName() {
var pageUrl = '<%=ResolveUrl("/Forms/MaterialRequest.aspx")%>';
var projectStatus = $("#<%=ddlCategory.ClientID%>").val();
debugger;
$.ajax({
type: "POST",
url: pageUrl + '/getItemName',
data: '{ItemId:' + projectStatus + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function OnlocationsPopulated(dvList) {
$("#<%=ddlItemName.ClientID%>").empty();
if (dvList.d.length > 0) {
$("#<%=ddlItemName.ClientID%>").removeAttr("disabled");
for (i = 0; dvList.d.length > i; i++) {
$("#<%=ddlItemName.ClientID%>").append("<option value=" + dvList.d[i].Value + ">" + dvList.d[i].Text + " </option>");
}
}
else {
$("#<%=ddlItemName.ClientID%>").empty().append('<option selected="selected" value="0">--Select--<option>');
}
}
});
}
</script>
Coad behind
[System.Web.Services.WebMethod]
public static ArrayList getItemName(string ItemId)
{
string id = ItemId;
ArrayList dvList = new ArrayList();
dvList = BLL.Sales.clsMaterialRequest.GetItemDetails1(ItemId);
return dvList;
}
<script type="text/javascript">
$(document).ready(function () {
GetItemName();
})
function GetItemName() {
var pageUrl = '<%=ResolveUrl("/Forms/MaterialRequest.aspx")%>';
var projectStatus = $("#<%=ddlCategory.ClientID%>").val();
debugger;
$.ajax({
type: "POST",
url: pageUrl + '/getItemName',
data: '{ItemId:' + projectStatus + '}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function OnlocationsPopulated(dvList) {
$("#<%=ddlItemName.ClientID%>").empty();
if (dvList.d.length > 0) {
$("#<%=ddlItemName.ClientID%>").removeAttr("disabled");
for (i = 0; dvList.d.length > i; i++) {
$("#<%=ddlItemName.ClientID%>").append("<option value=" + dvList.d[i].Value + ">" + dvList.d[i].Text + " </option>");
}
}
else {
$("#<%=ddlItemName.ClientID%>").empty().append('<option selected="selected" value="0">--Select--<option>');
}
}
});
}
</script>
Coad behind
[System.Web.Services.WebMethod]
public static ArrayList getItemName(string ItemId)
{
string id = ItemId;
ArrayList dvList = new ArrayList();
dvList = BLL.Sales.clsMaterialRequest.GetItemDetails1(ItemId);
return dvList;
}
No comments:
Post a Comment