2.0: custom attributes not rendered for textbox

  • Thread starter Thread starter Tim_Mac
  • Start date Start date
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
 
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());
 
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
 
Back
Top