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. General Programming
  3. C#
  4. Dynamically assign QueryString to SRC?

Dynamically assign QueryString to SRC?

Scheduled Pinned Locked Moved C#
question
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.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have an , I need X to be a string variable that each time it is generated by a method : void generateX(Obj sender, EventArgs e) { X="sth";} But when I assign <iframe src="sample.aspx?id=<%=X %>" />, it does not work? How I can pass X value to src of iframe? Chris#</x-turndown>

    D 1 Reply Last reply
    0
    • L Lost User

      I have an , I need X to be a string variable that each time it is generated by a method : void generateX(Obj sender, EventArgs e) { X="sth";} But when I assign <iframe src="sample.aspx?id=<%=X %>" />, it does not work? How I can pass X value to src of iframe? Chris#</x-turndown>

      D Offline
      D Offline
      David Wengier
      wrote on last edited by
      #2

      make your generateX() routine return a string, and use <iframe src="sample.aspx?id=<%= generateX() %>" /> And why do you have the parameters on generateX? -- David Wengier Sonork ID: 100.14177 - Ch00k

      L 1 Reply Last reply
      0
      • D David Wengier

        make your generateX() routine return a string, and use <iframe src="sample.aspx?id=<%= generateX() %>" /> And why do you have the parameters on generateX? -- David Wengier Sonork ID: 100.14177 - Ch00k

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        GenerateX() method has to be void, since it gets called by a listBox control: onSelectedIndexChanged="GenerateX". This purpose of this method is to generate a sqlWhereClause, X is a public variable I defined in top (outside of this method), and I intended to use X value to pass to an url as querystring. It seems that use my method does not give me anything. But if view source of the web page, I can see the values replaced x in the spot. Then I tried to put IFrameName.src=".." in GenerateX() method, it said src is not found. How I can make a method return string while I need to have this void function to correspond to an ListBox onChange event? Any thought may enlight me ! Thanks in advance. Chris#</x-turndown>

        D 1 Reply Last reply
        0
        • L Lost User

          GenerateX() method has to be void, since it gets called by a listBox control: onSelectedIndexChanged="GenerateX". This purpose of this method is to generate a sqlWhereClause, X is a public variable I defined in top (outside of this method), and I intended to use X value to pass to an url as querystring. It seems that use my method does not give me anything. But if view source of the web page, I can see the values replaced x in the spot. Then I tried to put IFrameName.src=".." in GenerateX() method, it said src is not found. How I can make a method return string while I need to have this void function to correspond to an ListBox onChange event? Any thought may enlight me ! Thanks in advance. Chris#</x-turndown>

          D Offline
          D Offline
          David Wengier
          wrote on last edited by
          #4

          Chris# wrote: I can see the values replaced x in the spot. If the value is being inserted into the page properly, but not being passed to the sample.aspx page, then maybe you need to HTMLEncode it first. -- David Wengier Sonork ID: 100.14177 - Ch00k

          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