Home All Groups Group Topic Archive Search About
Author
17 Jan 2007 6:57 PM
David Thielen
Hi;

To get google autofill to work we need controls like:
<input id="address:Name" type="text" name="address:Name" size="20" />

However, for a TextBox there is no name property and IDs won't take a : as
they are also C# variable names.

How can I set this the a TextBox?

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Author
18 Jan 2007 6:29 AM
Steven Cheng[MSFT]
Hello Dave,

As for the client-side "id" and "name" attributes of ASP.NET webcontrols,
they're generated according to ASP.NET's container based naming schema.
Also, for server-side identity(control's ID), such characer like ":" is not
allowed. If you do want to customize the "id" and "name" attribute value
(rendered in client-side html), one way is to overridde the "ClientID" and
"UniqueID" propety. e.g.

=====================
public class PostBackControl : WebControl, INamingContainer,
IPostBackEventHandler
    {
       .................................


        public override string ClientID
        {
            get
            {
                return "prefix:"+ this.ID;
            }
        }

        public override string UniqueID
        {
            get
            {
                return "prefix:" + this.ID;
            }
        }

.................
}
=================

see the following article also:

http://west-wind.com/WebLog/posts/4605.aspx

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.