TextBox rendered as <h1> tag

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

LVL 2
evo_xAsked:
Who is Participating?
 
jkofteConnect With a Mentor Commented:
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
 
karthitronCommented:
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
 
jkofteCommented:
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
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
evo_xAuthor Commented:
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
 
jkofteConnect With a Mentor Commented:
unfortunately it is not possible using a textbox.

you can use a literal instead.

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

Open in new window

0
 
evo_xAuthor Commented:
Then is this possible with the label control?
0
 
karthitronConnect With a Mentor Commented:
Yes it is possible with label control. <h1> will reflect with Label or Literal or DIV tag or SPAN tag.
0
 
evo_xAuthor Commented:
ok, thanks !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.