How to take master page control value in .aspx page

Discussion in 'ASP .Net' started by Deep, Sep 11, 2010.

  1. Deep

    Deep Guest

    Dear friends,

    Please tell me how to take master page control value in .aspx
    page.
    I have a master page name master1.master, which holds one drop down
    <asp:DropDownList ID="ddlName" runat="server">
    <asp:ListItem>Vinod</asp:ListItem>
    <asp:ListItem>Manoj</asp:ListItem>
    <asp:ListItem>Alok</asp:ListItem>
    <asp:ListItem>Amit</asp:ListItem>
    <asp:ListItem>Osho</asp:ListItem>
    <asp:ListItem>Ganesh</asp:ListItem>
    </asp:DropDownList>

    and suppose one other page home.aspx which inherits this master page.
    where I want to find ddlName selected value on selectedIndexChanged of
    dropdown.

    Thanks in Advance
    Vinod Kumar
     
    Deep, Sep 11, 2010
    #1
    1. Advertising

  2. Deep

    Cubaman Guest

    On Sep 11, 9:19 pm, Deep <> wrote:
    > Dear friends,
    >
    >          Please tell me how to take master page control value in .aspx
    > page.
    > I have a master page name master1.master, which holds one drop down
    > <asp:DropDownList ID="ddlName" runat="server">
    >                 <asp:ListItem>Vinod</asp:ListItem>
    >                 <asp:ListItem>Manoj</asp:ListItem>
    >                 <asp:ListItem>Alok</asp:ListItem>
    >                 <asp:ListItem>Amit</asp:ListItem>
    >                 <asp:ListItem>Osho</asp:ListItem>
    >                 <asp:ListItem>Ganesh</asp:ListItem>
    >             </asp:DropDownList>
    >
    > and suppose one other page home.aspx which inherits this master page.
    > where I want to find ddlName selected value on selectedIndexChanged of
    > dropdown.
    >
    > Thanks in Advance
    > Vinod Kumar


    Hello:
    Cast the property "Master" of home.aspx to your MasterPage class.

    MyMasterpageClass mpc = this.Master;
    string myValue = mpc.ddlName.SelectedValue;


    Best Regards
     
    Cubaman, Sep 13, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Doug McCann
    Replies:
    1
    Views:
    1,037
    William Brogden
    Aug 5, 2004
  2. Zeba
    Replies:
    1
    Views:
    498
    Mark Rae
    Feb 22, 2007
  3. Roger Frei
    Replies:
    3
    Views:
    724
    Michael Nemtsev
    Apr 27, 2007
  4. Nathan Sokalski
    Replies:
    25
    Views:
    1,442
    Nathan Sokalski
    Mar 4, 2010
  5. SerpentKiss2010
    Replies:
    0
    Views:
    2,497
    SerpentKiss2010
    Apr 6, 2011
Loading...

Share This Page