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. How do you display function output in contentplaceholders

How do you display function output in contentplaceholders

Scheduled Pinned Locked Moved ASP.NET
question
6 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.
  • M Offline
    M Offline
    MeterMan
    wrote on last edited by
    #1

    I have a masterpage and on it i have a contentplaceholder called maincontent I have a contentpage called content.aspx Inside content.aspx i have I the content.aspx.vb I have a function that generates a dynamic table or me based on the number of rows in a datatable. How can i get the content to go to the correct contentplaceholder? basically I need smething like this mygridfunction() But i do not know the correct syntax. cause the mygrid doesn't nothing more than do a series of response.writes with table tags thanks in advance. Win32newb "Programming is like Sex, make a mistake and you end up providing support for a long time" -- modified at 22:23 Friday 7th April, 2006

    M 1 Reply Last reply
    0
    • M MeterMan

      I have a masterpage and on it i have a contentplaceholder called maincontent I have a contentpage called content.aspx Inside content.aspx i have I the content.aspx.vb I have a function that generates a dynamic table or me based on the number of rows in a datatable. How can i get the content to go to the correct contentplaceholder? basically I need smething like this mygridfunction() But i do not know the correct syntax. cause the mygrid doesn't nothing more than do a series of response.writes with table tags thanks in advance. Win32newb "Programming is like Sex, make a mistake and you end up providing support for a long time" -- modified at 22:23 Friday 7th April, 2006

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      There are a couple of ways to do that: + You can use the code render block (inline expression <%= ...%>, to write the html markup to the content page:

      <asp:Content ...>
      <%= mygridfunction() %>
      </asp:Content>

      For more information, see Embedded Code Blocks in ASP.NET Web Pages [^] + In the Content control, you can place a Literal/Label control, then assign the html markup to the Text property of these controls. And your mygridfunction method should return the markup as the result of the method instead of writing it out to the output stream of the Response object.

      M 1 Reply Last reply
      0
      • M minhpc_bk

        There are a couple of ways to do that: + You can use the code render block (inline expression <%= ...%>, to write the html markup to the content page:

        <asp:Content ...>
        <%= mygridfunction() %>
        </asp:Content>

        For more information, see Embedded Code Blocks in ASP.NET Web Pages [^] + In the Content control, you can place a Literal/Label control, then assign the html markup to the Text property of these controls. And your mygridfunction method should return the markup as the result of the method instead of writing it out to the output stream of the Response object.

        M Offline
        M Offline
        MeterMan
        wrote on last edited by
        #3

        Okay sorry but curious about the second method. I understand the part of placing the label in the control lets say for instance lblSomething are you saying I can do something like this Protected function mygridfunction(byVal dt as datatable) as string { ....

        } then lblSomething = mygridfunction() I see what your saying but how would i have it convert the html tagging as in making the table in the lable if you will. thanks sorry for allt he questions just confused. MeterMan "Live life to its fullest because, you never know when it will be taken away."

        M 1 Reply Last reply
        0
        • M MeterMan

          Okay sorry but curious about the second method. I understand the part of placing the label in the control lets say for instance lblSomething are you saying I can do something like this Protected function mygridfunction(byVal dt as datatable) as string { ....

          } then lblSomething = mygridfunction() I see what your saying but how would i have it convert the html tagging as in making the table in the lable if you will. thanks sorry for allt he questions just confused. MeterMan "Live life to its fullest because, you never know when it will be taken away."

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          MeterMan wrote:

          lblSomething = mygridfunction()

          The above code should look like this:

          lblSomething.Text = mygridfunction()

          and you can place this code somewhere for example in the Page_Load event.

          M 1 Reply Last reply
          0
          • M minhpc_bk

            MeterMan wrote:

            lblSomething = mygridfunction()

            The above code should look like this:

            lblSomething.Text = mygridfunction()

            and you can place this code somewhere for example in the Page_Load event.

            M Offline
            M Offline
            MeterMan
            wrote on last edited by
            #5

            no i understand that part but what i'm saying is how do i convert tags to code cause i'm wondering if put the able tag in a lable do i get < t a b l e> or does it actually make the table cause my understanding lable.text take a string value and displays it to the string. so basically im wondering if the tags will show as tags or if the html will automatically format them.. Hope I'm making sense. thanks again. MeterMan "Live life to its fullest because, you never know when it will be taken away."

            M 1 Reply Last reply
            0
            • M MeterMan

              no i understand that part but what i'm saying is how do i convert tags to code cause i'm wondering if put the able tag in a lable do i get < t a b l e> or does it actually make the table cause my understanding lable.text take a string value and displays it to the string. so basically im wondering if the tags will show as tags or if the html will automatically format them.. Hope I'm making sense. thanks again. MeterMan "Live life to its fullest because, you never know when it will be taken away."

              M Offline
              M Offline
              minhpc_bk
              wrote on last edited by
              #6

              MeterMan wrote:

              cause i'm wondering if put the able tag in a lable do i get < t a b l e> or does it actually make the table cause my understanding lable.text take a string value and displays it to the string. so basically im wondering if the tags will show as tags or if the html will automatically format them..

              Don't worry about this since the Label or Literal control does not encode the html tags. Why don't you just give a try :)?

              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