|
/// <summary>
/// FileName: mycontrol.ascx.cs
///
/// Purpose: controls container
///
/// Author: 0garcia (og-bit.com)
///
/// Update/Fix History:
/// 0g01302007 Initial Implementation
/// </summary>
namespace ResolveClientId
{
using System;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
/// <summary>
/// Summary description for ValidateControl.
/// </summary>
public class myControl : System.Web.UI.UserControl
{
protected System.Web.UI.WebControls.TextBox mytext;
protected System.Web.UI.WebControls.Literal ctrlPrefix;
private void Page_Load(object sender, System.EventArgs e)
{
string name = this.ClientID;
string []elm =ctrlPrefix.ClientID.Split('_'); //get an array of values
ctrlPrefix.Text = ctrlPrefix.ClientID.Replace(elm[elm.Length - 1],""); //get the last element and replace from the id
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Software engineer, author & speaker who enjoys mentoring, learning, speaking and sharing with others about software development technologies. Microsoft MVP.
My Blog