Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How to access the contain of master page in our cs file?

How to access the contain of master page in our cs file?

Scheduled Pinned Locked Moved ASP.NET
questiontutorial
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    keyur satyadev
    wrote on last edited by
    #1

    i have one master page which contain the menu and its menuitem. i have to access the menu or menuitem in my other .cs file(it has master page)? how can i access this?

    B 1 Reply Last reply
    0
    • K keyur satyadev

      i have one master page which contain the menu and its menuitem. i have to access the menu or menuitem in my other .cs file(it has master page)? how can i access this?

      B Offline
      B Offline
      butchzn
      wrote on last edited by
      #2

      If what you asking is how to access controls in a Master Page from code-behind...

      MyMasterPage myMaster = (MyMasterPage)this.Master;

      string ImgStr = "images/test.gif";

      //Calling a method from MyMasterPage
      myMaster.setMasterHeaderImages(ImgStr);
      myMaster.Page.Title = "Test Page Title";

      Check http://aspadvice.com/blogs/kiran/archive/2005/11/27/14016.aspx[^] here.

      K 1 Reply Last reply
      0
      • B butchzn

        If what you asking is how to access controls in a Master Page from code-behind...

        MyMasterPage myMaster = (MyMasterPage)this.Master;

        string ImgStr = "images/test.gif";

        //Calling a method from MyMasterPage
        myMaster.setMasterHeaderImages(ImgStr);
        myMaster.Page.Title = "Test Page Title";

        Check http://aspadvice.com/blogs/kiran/archive/2005/11/27/14016.aspx[^] here.

        K Offline
        K Offline
        keyur satyadev
        wrote on last edited by
        #3

        i have menu in master page and i have to access it in other cs(eg. default.aspx.cs) file.

        R 1 Reply Last reply
        0
        • K keyur satyadev

          i have menu in master page and i have to access it in other cs(eg. default.aspx.cs) file.

          R Offline
          R Offline
          raju melveetilpurayil
          wrote on last edited by
          #4

          ContentPlaceHolder content; content = Master.FindControl("ContentPlaceHolder1") as ContentPlaceHolder; for ex TextBox txt=content.FindControl("txtName") as TextBox; Raju.M

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups