Find MasterPage Control

2 posts, 0 answers
  1. Mugil
    Mugil avatar
    21 posts
    Member since:
    Mar 2013

    Posted 05 Dec 2013 Link to this post


         I have anchor tag in my masterpage.I want to find that control.

         And want to trigger confirm alert  in onclick of that control.

    Thanking you,


  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 05 Dec 2013 Link to this post

    Hi Mugil,

    Please have a look into the following C# code to find the Master Page anchor tag in the Content Page and trigger a confirm alert on the Click event of the anchor tag.

    Content Page C# :
    protected void Page_Load(object sender, EventArgs e)
        //acceesing the anchor tage in the content page
        HtmlAnchor anchortag=(HtmlAnchor) this.Master.FindControl("anchor1");
        //assigning click event for the anchor tag
        anchortag.ServerClick += new EventHandler(anchortag_ServerClick);
    void anchortag_ServerClick(object sender, EventArgs e)
        //confirm alert
        Page.ClientScript.RegisterStartupScript(this.GetType(), "confirmDelete", "confirm('Are you sure you want to delete this?');", true);

  3. DevCraft R3 2016 release webinar banner
Back to Top