Last post Dec 13, 2013 10:27 AM by Siva Krishna Macha
Dec 13, 2013 09:42 AM|nvielbig|LINK
How do you go about doing inline styling in VB? see this for example (note that this didn't work):
String = "<style=""text-align:center;""This is text that should be centered!.</style></br></br> This text should not be centered. </br>"
Dec 13, 2013 09:50 AM|Siva Krishna Macha|LINK
You could use yourControl.Style property.
A beginner's reference:
Dec 13, 2013 09:55 AM|nvielbig|LINK
Siva - thanks.
This string is all apart of the same label control.
Dec 13, 2013 10:01 AM|Siva Krishna Macha|LINK
Ok, it looks the ending tag > is missing for <style - So that could be problem. I have underlined the exact symbol below.
Dec 13, 2013 10:04 AM|Siva Krishna Macha|LINK
Please ignore my earlier response. First of all, we should not use <style></style>
We can put the style to any HTML or asp elements as below: <span style=""></span>
Dec 13, 2013 10:09 AM|Siva Krishna Macha|LINK
So the updated code looks like this
Label1.Text = "<span style=""color:red;"">This is text that should be centered!.</span></br></br> This text should not be centered. </br>"
I have just used different style (color instead of align).
I would like to share you another side note here:
+If you use LabelControl then, you get the final source to the browser as <span>YourContentHere</span> i.e.,
<span id=YourControlID><span style="color:red;"> This text is..<span><br />This text should not...</span>
+However, if you use Literal control, you will not get the additional span tag as highlighted in bold above - but you will get the content as is.
Hope this helps. Please mark this as answer if this answers your question.
Dec 13, 2013 10:18 AM|nvielbig|LINK
Thank you for your time!
Dec 13, 2013 10:27 AM|Siva Krishna Macha|LINK
You're welcome, Glad that I could help you.