Monday, 9 June 2014

Set Currently On page in asp.net

On master page

 protected void Page_Load(object sender, EventArgs e)
    {
 if (!IsPostBack)
            {
 string pageValue = setpagevalue(pageName);
            if (pageValue != "")
            { lbl_showpage.Text = pageValue; }
         }
}

//Method

  public string setpagevalue(string pagename)
    {

        string valdata = pagename;
        switch(valdata){
            case "ASP.homepage_aspx": return "Home Page"; break;
            case "ASP.admin_aspx": return "Administration Page"; break;
         
         
             //default
            default: return string.Empty;
                break;      
        }
    }


//On Menu
<ul>
 <li runat="server" id="id1"><a href='Page Name' onclick="setpagevalue('Page Name');">
                                    <span>VFA Member Profile</span></a></li>
 <li runat="server" id="id2"><a href='Page Name' onclick="setpagevalue('Page Name');">
                                    <span>VFA Member Profile</span></a></li>

</ul>


//Javascript-

 <script type="text/javascript">

            function setpagevalue(valuepage) {

            }
        </script>

No comments:

Post a Comment

How to highlight selected text in notepad++

  –> To highlight a block of code in Notepad++, please do the following steps step-1  :- Select the required text. step-2  :- Right click...