I am creating a master page for admin-side of my application, which is using asp.net 4.0 framework and webforms. I have different user controls for sidemenu in different pages. I need to determine which user control is to be loaded at runtime only. I thought of using jquery ajax for this. Can anyone help me on this?
I tried the following jquery but this is alert ‘error occured’
$(document).ready(function () {
alert("Ready");
// $(".admin_side_menu").load("Shared/AdminManageDataSideMenu.ascx");
$.ajax({
type: "POST",
url: "Shared/AdminManageDataSideMenu.ascx",
contentType: "application/html; charset=utf-8",
dataType: "html",
success: function (data) {
// var object = JSON.parse(data);
alert("success" + data);
(".admin_side_menu").append(data);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
debugger;
alert("Error Occured!");
}
});
});
you will need to make an
ashxhandler that will return you the user control likenow you can call the handler via jquery like
Reference: https://stackoverflow.com/a/4597341/413670