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. Visual Basic
  4. Pass parameter to webusercontrol

Pass parameter to webusercontrol

Scheduled Pinned Locked Moved Visual Basic
questionhelptutorial
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.
  • B Offline
    B Offline
    Bjorn T J M Spruit
    wrote on last edited by
    #1

    Hi everyone, I'm building a page which has a webusercontrol on it. The webusercontrol is there for the sole purpose of displaying controls(calendar, texbox, etc...) on demand. The parameters the webusercontrol uses to detirmine what to show, is given by the page the webusercontrol is on. How can I pass a parameter from the page to the webusercontrol ? I'll need to build some sort of 'listener' in the webusercontrol I built, but I'm not sure how to go about doing that. Some help would be much appreciated.

    M 1 Reply Last reply
    0
    • B Bjorn T J M Spruit

      Hi everyone, I'm building a page which has a webusercontrol on it. The webusercontrol is there for the sole purpose of displaying controls(calendar, texbox, etc...) on demand. The parameters the webusercontrol uses to detirmine what to show, is given by the page the webusercontrol is on. How can I pass a parameter from the page to the webusercontrol ? I'll need to build some sort of 'listener' in the webusercontrol I built, but I'm not sure how to go about doing that. Some help would be much appreciated.

      M Offline
      M Offline
      Marcus J Smith
      wrote on last edited by
      #2

      I would suggest simply storing the values you need for the web user control in a Session variable. But pay attention to the order of events so you know where to store the change, I believe the user control is dealt with after the Page Load but before the button click so you would need to have a call to that logic in the Page Load or earlier.


      Cleako

      B 1 Reply Last reply
      0
      • M Marcus J Smith

        I would suggest simply storing the values you need for the web user control in a Session variable. But pay attention to the order of events so you know where to store the change, I believe the user control is dealt with after the Page Load but before the button click so you would need to have a call to that logic in the Page Load or earlier.


        Cleako

        B Offline
        B Offline
        Bjorn T J M Spruit
        wrote on last edited by
        #3

        What would that look like in code ? Take into account that there could be 0 to N parameters being returned. And there can be several parameters of the same type. For instance: More than one date parameter required, which means that it should return two or more calendar controls on screen.

        M 1 Reply Last reply
        0
        • B Bjorn T J M Spruit

          What would that look like in code ? Take into account that there could be 0 to N parameters being returned. And there can be several parameters of the same type. For instance: More than one date parameter required, which means that it should return two or more calendar controls on screen.

          M Offline
          M Offline
          Marcus J Smith
          wrote on last edited by
          #4

          I suppose you could build something similar to a comma separated string and store it so it would be Session("WUCParameters") = ParamValue1,ParamValue2,ParamValue3 then on the Web User Control you simply split it into a string array. Dim arParams() as String = Session("WUCParameters").ToString.Split(",") For i as Integer = 0 to arParams.GetUpperBound() 'Do something for each value listed Next


          Cleako

          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