About Dropdownlist in ASp:content page
-
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
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.
-
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
Thanks for reply!!! No Its not working . the error was ddlLan does not exist in this current context.
try and try untill reach success..
-
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.
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..
-
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
-
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
i m working on VS2008
try and try untill reach success..
-
i m working on VS2008
try and try untill reach success..
-
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
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..
-
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
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..
-
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..
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.
-
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..