Need to shorten a server control ClientId to be accessible from JavaScript. This example creates a custom hyperlink control with shorted ClientID sans control id.
using System;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
/// <summary>
/// Summary description for hyperlink
/// </summary>
///
namespace Gasta.CustomControl
{
public class href : HyperLink
{
public override string ClientID
{
get
{
return this.ID;
}
}
}
}
Web.config <- add
<pages>
<add tagPrefix="custom" namespace="My.CustomControl"></add>
</pages>
ASPX
<custom:href runat="server" id="li_nav_web" href="/Default.aspx" mce_href="/Default.aspx">Web</custom:href></h1>
Reference
http://msdn.microsoft.com/en-us/library/yhzc935f.aspx
http://blog.danbartels.com/archive/2005/11/11/1110.aspx