Is it possible to display a special character like trademark on an ASP button control? if so, how do I do that
You can use html codes such as © = © and ™ = ™ etc in the text property of your button.
For a more detailed list of these codes: http://www.ascii.cl/htmlcodes.htm
example:
<asp:Button ID="tradeMarkButton" runat="server" Text="TradeMark™" />
Use character map (press start, run and type charmap then enter) select the special character, copy to the clipboard and paste into the text property of the control.
Related
I am trying to add symbol to readonly textbox.
I have tried like below.
aspx file:
<asp:TextBox ID="XcoordTextbox" runat="server"></asp:TextBox>
aspx.cs file:
XcoordTextbox.Text= "✂";
But the output ✂ text in the box. But I need symbol only in a button or textbox.
How can I do it?
You need to convert the code to the actual symbol:
XcoordTextbox.Text = HttpUtility.UrlDecode("✂");
I guess you could also try with the HtmlDecode method.
There are other overloads where you can also specify the encoding.
How to Display Html content in Textbox Control
Eg:
string text="<b>" + Hi How are you + "</b>";
txtEditor.Text=text.ToString();
I have to display those text in bold Letters, How do i achieve this
You can change the font property of the TextBox:
txtEditor.Font = new Font(txtEditor.Font, FontStyle.Bold);
See this link for an existing html editor. I strongly recommend that you carefully read the paragraph about Cross Site Scripting, whether you decide to use that control or not.
To display text bold in asp:textbox control, you can use style at design time or runtime
in .aspx page Design time
<asp:TextBox ID="textBox1" style="font-weight:bold;" runat="server"></asp:TextBox>
OR
in Code Behind
textBox1.Font.Bold = true;
You can try any one to get desired result. My suggestion over here is that use CSS style to get more advanced formatting in textbox
I was just wondering out of curiosity if it was possible to display large text from a database in a HTML or asp.net page with proper indenting and spacing?
As of right now, I have it displayed in a textbox and I'm using a highlight specific text feature incorporated in my site that doesn't function ONLY when the length of the text is greater then actual textbox. So I was thinking of displaying the data on a page and considering using Response.Write but the displayed text is all bunched together without proper indenting or spacing.
Ex.) instead of..."Hey Everyone how is everyone doing today? I am sample text"...is possible to display it as...
"Hey Everyone
How is everyone today? I am sample text"
Would anyone guide to any proper method that I could use or know of any info
New Line will be like \r\n in code behind text
Now, you can use Span or Literal control like below in HTML
HTML Side
<span id="span" runat="server"></span>
<asp:Literal id="literal" runat="server"></asp:Literal>
Code Behind side
span.InnerHtml = yourtext.Replace("\r\n","<br/>")
Without knowing anything about what format the text is stored in the DB (I'm assuming it's just regular spacing & carriage returns.
You could put it between <pre> tags. e.g.
ASPX
<pre>
<asp:Label ID="myTextArea" runat="server" />
</pre>
CODE BEHIND
myTextArea.Text = //Code to get text string from DB
If there are carraige returns already embedded in the text, you could do replace them with <p> tags, like:
string value = // get value from database ;
string formattedValue = string.Format("<p>{0}</p>", value.Replace("\r", "</p><p>"));
I need to write out a submit button in ASP.NET so that the button text value is HTML-encoded using the proper HTML entities for the various French characters with accents.
The button is simply declared as
<asp:Button id="button1" runat="server" />
If I do something like
button1.text = "Test é"
then it displays the button text correctly as Test é in the web page, but the HTML source is also Test é, which is not what I need -- I need either é or é.
If I do something like
button1.text = server.htmlencode("Test é")
then it displays Test é in the button text, i.e. Test é in the HTML source.
How do i solve this problem?
You should be able to set the text without encoding anything. You can try to set globalization setting in web.config inside system.web as follows(Not sure if ISO-8859-1 is the correct encoding for french):
<globalization uiCulture="fr-FR" culture="fr-FR" enableClientBasedCulture="true" responseEncoding="ISO-8859-1" fileEncoding="ISO-8859-1" />
I have created a ProductResources.resx file. The name and value fields contain the ® character. THis is the R with a circle around it. It is a reg trademark. Obviously this needs to be there. An the resource file itself gives a red circle with a question mark inside it. Please help.
Depending on the encoding you declare for the resx XML, you can probably use one of the following:
® (iso-8859-1 or utf-8)
™ (unicode)
here's what you must do:
add a app_local_resources folder(right click on your project --> add asp.net folder)
name the resource folder as the following: PageName.aspx.resx
add the button name and property ( eg. Button1.Text) in the resource file name field
copy (by just highlight the registered trade mark from any source and copy it, paste in the value field from here
go to your button and add the following such as:
asp:Button ID="Button1" runat="server" Text="" onclick="Button1_Click" meta:resourcekey="Button1"
alt text http://img7.imageshack.us/img7/2108/59469768.jpg
hope this is what you want :)