Link to home
Start Free TrialLog in
Avatar of evo_x
evo_xFlag for Romania

asked on

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

Avatar of karthitron
karthitron
Flag of India image

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.
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;
}
Avatar of evo_x

ASKER

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>
SOLUTION
Avatar of jkofte
jkofte
Flag of Türkiye image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evo_x

ASKER

Then is this possible with the label control?
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of evo_x

ASKER

ok, thanks !