Solved

TextBox rendered as <h1> tag

Posted on 2011-03-23
8
563 Views
Last Modified: 2012-05-11
How can I make a textbox to be rendered in the html file as <h1> tag?

I have this detailsview template and I have tried to put the textbox inside the <h1> tag, but in the html file the <h1> tag is not included...

<EditItemTemplate>
            <h1>
                 <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Car_Category") %>'></asp:TextBox>
             </h1>
           </EditItemTemplate>

Open in new window

0
Comment
Question by:evo_x
  • 3
  • 3
  • 2
8 Comments
 
LVL 5

Expert Comment

by:karthitron
ID: 35204561
Textbox style will not get updated by placing it between the <h1> tag. <h1> tag will update the style of the innerText and not innerHTML. So, placing a textbox inside a <h1> will not work.

So, write a StyleSheet class (resembling h1 tag style properties) and set the class to this textbox. So, your textbox text will look like <h1> tag style. Let me know, you want different.
0
 
LVL 9

Expert Comment

by:jkofte
ID: 35204726
Give your textbox a CssClass property.
Then in that class define the css properties for your textbox for it to look like h1 tag.
<asp:TextBox ID="TextBox1" runat="server" CssClass="Class1" Text='<%# Bind("Car_Category") %>'></asp:TextBox>
in your style tag
.Class1
{
font-size:18px;
font-weight:bold;
}
0
 
LVL 2

Author Comment

by:evo_x
ID: 35206452
I don't want just look like a h1 tag, but I want to be rendered in the html file to <h1>mytextbox text</h1>
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 9

Assisted Solution

by:jkofte
jkofte earned 333 total points
ID: 35206948
unfortunately it is not possible using a textbox.

you can use a literal instead.

Literal1.Text = "<h1>" + "MyText" + "</h1>"

Open in new window

0
 
LVL 9

Accepted Solution

by:
jkofte earned 333 total points
ID: 35206968
I mean textbox will always be rendered as HTML input tag in client side.  So, it is not possible to remove the input tags.
0
 
LVL 2

Author Comment

by:evo_x
ID: 35208762
Then is this possible with the label control?
0
 
LVL 5

Assisted Solution

by:karthitron
karthitron earned 167 total points
ID: 35208868
Yes it is possible with label control. <h1> will reflect with Label or Literal or DIV tag or SPAN tag.
0
 
LVL 2

Author Comment

by:evo_x
ID: 35209675
ok, thanks !
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question