Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I am using Asp.Net (w/ C#) and I am dynamically generating a stringbuilder to create html code. My question is, how do you control where the code goes on the .aspx page when using Response.Write(htmlStringContent).

Currently the info just appears at the top of the page and I want it to appear within a column (<td></td>) that I already have established as a holder.

 

Thanks

  • Administrators
Posted

Rather than using the response object you will probably be better of placing a literal control where you require the HTML to be and then assign the result of the string builder to that.

Out of curiosity what does this html string contain as there may be built in controls that require less effort than building your own html.

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Posted

The html string will have just a table with one row and two columns. In each column will have <a href> tags

 

<table>

<tr>

<td>

<a href='someDynamicData'>moreDynamicData</a>

<\td>

<\tr>

</table>

 

By the way, do you have an example of using literal controls? I am relatively new to .net?

 

Thanks

  • Administrators
Posted

the html would look like

</pre><table>
   
       
    

   
</tabl

and the code behind would be

Literal1.Text = " moreDynamicData"

 

However if you just want a simple link you may be better of with a HyperLink control

</pre><table>

	
		HyperLink
	

</tabl

with a code behind like

HyperLink1.Text = "moreDynamicData"
HyperLink1.NavigateUrl = "http://www.b3ta.com"  'or wherever

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...