1

Again, I've looked around to try to find some posts on this and there are many but none that address my specific question (that I could find).

What I am looking : I have a projects and it loads different pages (.aspx) in an iframe dynamically. Now I am trying to remove iframe and add a div and load aspx pages inside that div, using this :

$("#containerDiv").load("test/default.aspx", function () {
});

it loads aspx page easily but I am unable to execute C# code which is written in default.aspx.cs may be its not a good practice but I want to know is there any solution of my problem.

shytikov
  • 9,155
  • 8
  • 56
  • 103
Haseeb Akhtar
  • 1,233
  • 3
  • 16
  • 32
  • look [here](http://stackoverflow.com/questions/202538/using-jquery-for-ajax-with-asp-net-webforms). I think you have to load an .asmx file, not an .aspx one – Catalin Apr 01 '13 at 10:49
  • As far my knowledge It is not going to work. As you are trying. Moreover if it is a part of your application then you can do trick (`jquery ajax`, `httphandler` etc) to keep the page working. – शेखर Apr 01 '13 at 10:57
  • @Shekhar, You are right, this would be my last step if I'll not get any solution. – Haseeb Akhtar Apr 01 '13 at 11:00
  • Also if you load a new `.aspx` page so there will be two `form tags` which is not allowed in `asp.net` and on postback you will get exception. – शेखर Apr 01 '13 at 11:03

1 Answers1

0

$.load will not your c# code why because it load only the contents of your aspx page not of aspx.cs. Use user controls instead.

If need help how to implement user control refer this link.

Ken Clark
  • 2,500
  • 15
  • 15