Geeks With Blogs
Gaurav Taneja Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

        //Function to get the HTML name of the server control from the Client Id

    // Parameters:

    //  clientId - Control.ClientId

    //  serverId - Control.id

    private string GetHTMLNameById(string clientId, string serverId)

    {

        int pos = serverId.IndexOf('_');

        string HTMLName = "";

        if(pos >= 0)

        {

            pos = clientId.IndexOf(serverId);

            HTMLName = clientId.Remove(pos, serverId.Length);

            HTMLName = HTMLName.Replace('_', '$');

            HTMLName += serverId;

        }

        else

            HTMLName = clientId.Replace('_', '$');

        return HTMLName;

    }

Posted on Monday, September 4, 2006 10:00 AM .Net | Back to top


Comments on this post: How to get the HTML name attribute of ASP.Net Control

# re: How to get the HTML name attribute of ASP.Net Control
Requesting Gravatar...
use the control.UniqueID to get the value for name attribute
Left by vinod on Oct 22, 2006 3:16 PM

Your comment:
 (will show your gravatar)


Copyright © Gaurav Taneja | Powered by: GeeksWithBlogs.net