Solved

TextBox rendered as <h1> tag

Posted on 2011-03-23
8
558 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
 
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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Developer portfolios can be a bit of an enigma—how do you present yourself to employers without burying them in lines of code?  A modern portfolio is more than just work samples, it’s also a statement of how you work.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now