Opening blank .ASPX file
-
A NEW html file can easily be opened by creating a javascript function with: " function Name { contents = "This is my page" contents += "I like it a lot" Win1=window.open('', 'Window1', 'resizable, height=200, width=200'); Win1.document.writeln(contents); } My problem, is that the "window.open" (as far as i know) only opens html pages. I've tried putting into the "conents" variable all necessary SCRIPT from my aspx page i wish to create on the fly, but the problems i'm encountering are: 1) The new page does not recognize any tags 2) There is no code behind the file I've tried putting the class definitions that would normally be behind the .aspx file inside script tags for the main page itself, but that seems to have no effect (not even errors showing up) Is it possible to open a .ASPX page on the fly? If so, how?
-
A NEW html file can easily be opened by creating a javascript function with: " function Name { contents = "This is my page" contents += "I like it a lot" Win1=window.open('', 'Window1', 'resizable, height=200, width=200'); Win1.document.writeln(contents); } My problem, is that the "window.open" (as far as i know) only opens html pages. I've tried putting into the "conents" variable all necessary SCRIPT from my aspx page i wish to create on the fly, but the problems i'm encountering are: 1) The new page does not recognize any tags 2) There is no code behind the file I've tried putting the class definitions that would normally be behind the .aspx file inside script tags for the main page itself, but that seems to have no effect (not even errors showing up) Is it possible to open a .ASPX page on the fly? If so, how?
Craigpt wrote: I've tried putting into the "conents" variable all necessary SCRIPT from my aspx page i wish to create on the fly, but the problems i'm encountering are: 1) The new page does not recognize any tags 2) There is no code behind the file This is because
document.writeln(contents)
is client-side. asp:whatever tags and codebehind are processed server-side. If you are trying to create aspx page from java script, you can't do that. But if you want to open aspx page from JS, it works just like with html pages. Actually, if you want your JS to determine contents of created page, you can pass some information in query (e.g.window.open('http://tempuri.org/mypage.aspx?showClientInfoID=5',...)
. Length of URI is very limited, so obviously you can't pass whole content of new page, rather "parameters" that will tell you ASP.NET application what to render inside mypage.aspx. Does it help? David -
Craigpt wrote: I've tried putting into the "conents" variable all necessary SCRIPT from my aspx page i wish to create on the fly, but the problems i'm encountering are: 1) The new page does not recognize any tags 2) There is no code behind the file This is because
document.writeln(contents)
is client-side. asp:whatever tags and codebehind are processed server-side. If you are trying to create aspx page from java script, you can't do that. But if you want to open aspx page from JS, it works just like with html pages. Actually, if you want your JS to determine contents of created page, you can pass some information in query (e.g.window.open('http://tempuri.org/mypage.aspx?showClientInfoID=5',...)
. Length of URI is very limited, so obviously you can't pass whole content of new page, rather "parameters" that will tell you ASP.NET application what to render inside mypage.aspx. Does it help? DavidBasically what i'm trying to do, is create a user control of a DateTimePicker for asp.net. It's easy enough to create a user control of the linked image, or button, and just have it accept the controlName as a parameter, and then call an aspx page that includes the calendar and such. Unfortunately, i'm lazy, and thus don't want to have to include both a user control AND an aspx page into my project. So i figured i'd try to create the calendar page on the fly in a JS function in the user control itself.
-
Basically what i'm trying to do, is create a user control of a DateTimePicker for asp.net. It's easy enough to create a user control of the linked image, or button, and just have it accept the controlName as a parameter, and then call an aspx page that includes the calendar and such. Unfortunately, i'm lazy, and thus don't want to have to include both a user control AND an aspx page into my project. So i figured i'd try to create the calendar page on the fly in a JS function in the user control itself.
I think you can't do that. You was able to create image or button, because these controls have direct HTML counterparts. Calendar does not. hmm what you possibly can do is create html page with <object> and host Calendar or whatecer you need in IE ( see here[^]) You'll have to stick with IE however.Okay, I think there is some way how to host .NET controls in mozilla, but IIRC it's not nice. David