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. About Dropdownlist in ASp:content page

About Dropdownlist in ASp:content page

Scheduled Pinned Locked Moved ASP.NET
csharphtmldesignsysadminlinux
12 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.
  • R Offline
    R Offline
    Rajeshwar Code Developer
    wrote on last edited by
    #1

    Hai see below code <%@ Page Theme="Default" MasterPageFile="~/Shared/main.Master" Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="CMCS.UI.Shell.Web.Login" %> <html> <head> <title> </title></head> <body> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <fieldset> <legend>Login</legend> <div>Login <p> <small><i>You need to be logged on in order to download the CMCS application. Please provide the username and password that was given to you, and click "Login".</i></small> </p></div> <div><label>Username</label></div> <div id="fUsername"> <asp:TextBox ID="Username" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Password</label></div> <div id="fPassword"> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Language</label></div> <div > <asp:DropDownList ID="ddlLan" runat="server"> asp:ListItemEnglish</asp:ListItem> asp:ListItemHebrew</asp:ListItem> asp:ListItemRussian</asp:ListItem> </asp:DropDownList> </div> <div id="fLogin"> <asp:Button ID="LoginButton" runat="server" CommandName="Log

    L S 3 Replies Last reply
    0
    • R Rajeshwar Code Developer

      Hai see below code <%@ Page Theme="Default" MasterPageFile="~/Shared/main.Master" Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="CMCS.UI.Shell.Web.Login" %> <html> <head> <title> </title></head> <body> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <fieldset> <legend>Login</legend> <div>Login <p> <small><i>You need to be logged on in order to download the CMCS application. Please provide the username and password that was given to you, and click "Login".</i></small> </p></div> <div><label>Username</label></div> <div id="fUsername"> <asp:TextBox ID="Username" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Password</label></div> <div id="fPassword"> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Language</label></div> <div > <asp:DropDownList ID="ddlLan" runat="server"> asp:ListItemEnglish</asp:ListItem> asp:ListItemHebrew</asp:ListItem> asp:ListItemRussian</asp:ListItem> </asp:DropDownList> </div> <div id="fLogin"> <asp:Button ID="LoginButton" runat="server" CommandName="Log

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Hi All Can u try the folloeing thing i think this will solve ur problem.

      string a = ddRole.SelectedItem.Text

      Thanks and regards, Amit Patel

      R 1 Reply Last reply
      0
      • R Rajeshwar Code Developer

        Hai see below code <%@ Page Theme="Default" MasterPageFile="~/Shared/main.Master" Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="CMCS.UI.Shell.Web.Login" %> <html> <head> <title> </title></head> <body> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <fieldset> <legend>Login</legend> <div>Login <p> <small><i>You need to be logged on in order to download the CMCS application. Please provide the username and password that was given to you, and click "Login".</i></small> </p></div> <div><label>Username</label></div> <div id="fUsername"> <asp:TextBox ID="Username" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Password</label></div> <div id="fPassword"> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Language</label></div> <div > <asp:DropDownList ID="ddlLan" runat="server"> asp:ListItemEnglish</asp:ListItem> asp:ListItemHebrew</asp:ListItem> asp:ListItemRussian</asp:ListItem> </asp:DropDownList> </div> <div id="fLogin"> <asp:Button ID="LoginButton" runat="server" CommandName="Log

        S Offline
        S Offline
        sashidhar
        wrote on last edited by
        #3

        I am not getting what you are trying to say but

        Rajeshwar Code- Developer wrote:

        You Should add runat="server" for example

        <div id="fPassword" runat="server" >

        Rajeshwar Code- Developer wrote:

        but the thing is i enable to see the ddllan id also.

        Whats The Point You Are explaining Here? :confused:

        DropDownList.SelectedValue

        is enough..!

        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

        R 1 Reply Last reply
        0
        • L Lost User

          Hi All Can u try the folloeing thing i think this will solve ur problem.

          string a = ddRole.SelectedItem.Text

          Thanks and regards, Amit Patel

          R Offline
          R Offline
          Rajeshwar Code Developer
          wrote on last edited by
          #4

          Thanks for reply!!! No Its not working . the error was ddlLan does not exist in this current context.

          try and try untill reach success..

          1 Reply Last reply
          0
          • S sashidhar

            I am not getting what you are trying to say but

            Rajeshwar Code- Developer wrote:

            You Should add runat="server" for example

            <div id="fPassword" runat="server" >

            Rajeshwar Code- Developer wrote:

            but the thing is i enable to see the ddllan id also.

            Whats The Point You Are explaining Here? :confused:

            DropDownList.SelectedValue

            is enough..!

            LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

            R Offline
            R Offline
            Rajeshwar Code Developer
            wrote on last edited by
            #5

            sashidar wht i m saying is. ex - ddllan.selectedvalue.tostring(); this code means we r selecting value in dropdownlist right. so but here i m using asp:content for masterpage. if i m trying to select dropdownlist in asp.cs page i m getting error ddllan does not exist in current context.

            try and try untill reach success..

            1 Reply Last reply
            0
            • R Rajeshwar Code Developer

              Hai see below code <%@ Page Theme="Default" MasterPageFile="~/Shared/main.Master" Language="C#" AutoEventWireup="true" CodeBehind="Login.aspx.cs" Inherits="CMCS.UI.Shell.Web.Login" %> <html> <head> <title> </title></head> <body> <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <asp:Login ID="Login1" runat="server"> <LayoutTemplate> <fieldset> <legend>Login</legend> <div>Login <p> <small><i>You need to be logged on in order to download the CMCS application. Please provide the username and password that was given to you, and click "Login".</i></small> </p></div> <div><label>Username</label></div> <div id="fUsername"> <asp:TextBox ID="Username" runat="server"></asp:TextBox> <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName" ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Password</label></div> <div id="fPassword"> <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox> <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password" ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="Login">*</asp:RequiredFieldValidator> </div> <div><label>Language</label></div> <div > <asp:DropDownList ID="ddlLan" runat="server"> asp:ListItemEnglish</asp:ListItem> asp:ListItemHebrew</asp:ListItem> asp:ListItemRussian</asp:ListItem> </asp:DropDownList> </div> <div id="fLogin"> <asp:Button ID="LoginButton" runat="server" CommandName="Log

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              Hi All, Are u working with visual studio 2005 then close the page and open it again and then write the code.. Vs 2005 gives this kind error to me also. Thanks and regards , Amit Patel

              R 1 Reply Last reply
              0
              • L Lost User

                Hi All, Are u working with visual studio 2005 then close the page and open it again and then write the code.. Vs 2005 gives this kind error to me also. Thanks and regards , Amit Patel

                R Offline
                R Offline
                Rajeshwar Code Developer
                wrote on last edited by
                #7

                i m working on VS2008

                try and try untill reach success..

                L 1 Reply Last reply
                0
                • R Rajeshwar Code Developer

                  i m working on VS2008

                  try and try untill reach success..

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  close both .cs and aspx file and then try i hope that will work because same probs i also face Thanks and regards, amit Patel

                  R 2 Replies Last reply
                  0
                  • L Lost User

                    close both .cs and aspx file and then try i hope that will work because same probs i also face Thanks and regards, amit Patel

                    R Offline
                    R Offline
                    Rajeshwar Code Developer
                    wrote on last edited by
                    #9

                    no Brother !! its not working. i m trying in master page so there were code is different i think so.

                    try and try untill reach success..

                    S 1 Reply Last reply
                    0
                    • L Lost User

                      close both .cs and aspx file and then try i hope that will work because same probs i also face Thanks and regards, amit Patel

                      R Offline
                      R Offline
                      Rajeshwar Code Developer
                      wrote on last edited by
                      #10

                      amit atleast i found the answer this is the code Dropdownlist ddl = new Dropdownlist(); ddl =(Dropdownlist)this.Master.FindControl("Contentmasterpage").FindControl("DropDownlist"); string strlan = ddl.selectedvalue;

                      try and try untill reach success..

                      S 1 Reply Last reply
                      0
                      • R Rajeshwar Code Developer

                        no Brother !! its not working. i m trying in master page so there were code is different i think so.

                        try and try untill reach success..

                        S Offline
                        S Offline
                        sashidhar
                        wrote on last edited by
                        #11

                        I Want to make clear with your Coding..! First If the ddl is in master page ant the code is normal aspx.cs which inherits the master page then You Have to find the control in aspx.cs Like

                        DropDownList mp = (DropDownList) Master.FindControl("ID");

                        Master Page[^] If the Code in Content page Then You No need to find the control..!

                        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                        1 Reply Last reply
                        0
                        • R Rajeshwar Code Developer

                          amit atleast i found the answer this is the code Dropdownlist ddl = new Dropdownlist(); ddl =(Dropdownlist)this.Master.FindControl("Contentmasterpage").FindControl("DropDownlist"); string strlan = ddl.selectedvalue;

                          try and try untill reach success..

                          S Offline
                          S Offline
                          sashidhar
                          wrote on last edited by
                          #12

                          I was out Thts Y i didnt Respond You..! Yep Thts Right..!:thumbsup:

                          LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

                          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