2.0: custom attributes not rendered for textbox

T

Tim_Mac

hi,
i have the following code in an aspx page, inside a server form:

<asp:TextBox ID="txtPageTitle" runat="server"
dir='<%# this.HtmlTextDirection %>'
lang='<%# this.HtmlLanguageCode %>'>
</asp:TextBox>

the dir and lang attributes are not included at all in the rendered
html.

the unusual thing is that i use the same code inside the
EditItemTemplate of a GridView and it works correctly.

can anyone tell me why the two scenarios behave differently? i would
obviously like to have the attributes rendered wherever they exist in
the aspx source.

thanks
tim
 
J

Joey

I'll bet it will work if you do it with code...

this.txtPageTitle.Attributes.Add("dir",this.HtmlTextDirection.ToString());
this.txtPageTitle.Attributes.Add("lang",this.HtmlLanguageCode.ToString());
 
T

Tim_Mac

hi joey. yeah i know that works, but it isn't always easy to get a
handle on the textbox for dynamic controls, or controls in a gridview
etc.

it is just a peculiarity that i would like to understand.
tim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top