Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Opening blank .ASPX file

Opening blank .ASPX file

Scheduled Pinned Locked Moved ASP.NET
javascripthtmltoolshelpquestion
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Craigpt
    wrote on last edited by
    #1

    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?

    D 1 Reply Last reply
    0
    • C Craigpt

      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?

      D Offline
      D Offline
      DavidNohejl
      wrote on last edited by
      #2

      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

      C 1 Reply Last reply
      0
      • D DavidNohejl

        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

        C Offline
        C Offline
        Craigpt
        wrote on last edited by
        #3

        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.

        D 1 Reply Last reply
        0
        • C Craigpt

          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.

          D Offline
          D Offline
          DavidNohejl
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups