webforms - Calling two over loaded web method by jquery in asp.net(web form) page -
i have 2 method having same attribute called [webmethod] 1 take parameter , 1 parameter less.when trying call parameter less page method jquery error occur.i know overloading of web method in asp.net webform page not possible. if possible making mistake.
here sample code
my 2 web method defined in aspx code behind page
[webmethod] public static string getfaxui() { string outputtoreturn = ""; //system.threading.thread.sleep(5000); page pageholder = new page(); bbareman.usercontrols.ucfax ctl = (bbareman.usercontrols.ucfax)pageholder.loadcontrol("~/usercontrols/ucfax.ascx"); htmlform tempform = new htmlform(); tempform.controls.add(ctl); pageholder.controls.add(tempform); stringwriter output = new stringwriter(); httpcontext.current.server.execute(pageholder, output, false); outputtoreturn = output.tostring(); return outputtoreturn; } [webmethod] public static string getfaxui(string country) { string outputtoreturn = ""; //system.threading.thread.sleep(5000); page pageholder = new page(); bbareman.usercontrols.ucfax ctl = (bbareman.usercontrols.ucfax)pageholder.loadcontrol("~/usercontrols/ucfax.ascx"); ctl.localizeui(country); htmlform tempform = new htmlform(); tempform.controls.add(ctl); pageholder.controls.add(tempform); stringwriter output = new stringwriter(); httpcontext.current.server.execute(pageholder, output, false); outputtoreturn = output.tostring(); return outputtoreturn; } here way calling web method jquery
jquery.ajax({ type: "post", url: "faxui.aspx/getfaxui", data: {}, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (data) { shtml = data.d; shtml = $(shtml).find('#content').html(); $shtml = $(shtml) $shtml.css({ 'display': 'none' }).appendto('div#dialog'); $.dotimeout(1000, function () { $(".ui-dialog").animate({ left: (($(window).width() - 346) / 2) + 'px', top: (($(window).height() - 305) / 2) + 'px', height: '305px', width: '346px' }, 200, function () { $("#dialog").removeclass("busystyles").find('#faxmain').fadein(2000); $("#dialog").css({ height: '26px' }); }); }); }, error: function (xmlhttprequest, textstatus, errorthrown) { alert(textstatus); } }); before same code working moment on load method getfaxui() getting error. please guide me making mistake. thanks
Comments
Post a Comment