How do you display function output in contentplaceholders
-
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
-
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
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 yourmygridfunction
method should return the markup as the result of the method instead of writing it out to the output stream of the Response object. -
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 yourmygridfunction
method should return the markup as the result of the method instead of writing it out to the output stream of the Response object.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."
-
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."
-
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.
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." -
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."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 :)?