Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 4th, 2007, 12:01 PM
Authorized User
Join Date: Nov 2007
Location: , , Ireland.
Posts: 67
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Hughesie78
Default Validation based on dropdown list value

I’m trying to determine if a textbox needs validation based on the value selected in the drop down list.
               <asp:DropDownList ID="dp_Marital_status" runat="server">
                        <asp:ListItem Text="Divorced" Value="divorced"></asp:ListItem>
                        <asp:ListItem Text="Married" Value="married"></asp:ListItem>
                        <asp:ListItem Text="Single" Value="single"></asp:ListItem>
                        <asp:ListItem Text="Unknown" Value="unknown"></asp:ListItem>
                        <asp:ListItem Text="Widow" Value="widow"></asp:ListItem>
                        <asp:ListItem Text="Separated" Value="separated"></asp:ListItem>
                        <asp:ListItem Text="Other" Value="other"></asp:ListItem>
<asp:TextBox runat="server" ID="txt_Emp_Name" Width="370px">

<asp:RequiredFieldValidator ID=valrEmployername runat=server Display=dynamic Text=*
ErrorMessage="Employer name required" Enabled=false
 ControlToValidate=txt_Emp_Name >

Code behind:
    protected void employment_type_On_textChanged(object sender, EventArgs e)
        string strEmploymentType = Convert.ToString(dp_Emp_Type.SelectedValue);
        if (strEmploymentType.ToString() = "retired")
            valrEmployername.enabled = true;


When I run this I get the error:
CS0131: The left-hand side of an assignment must be a variable, property or indexer
Thank You
  #2 (permalink)  
Old December 4th, 2007, 12:11 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi

hi there.. try taking out () from the tostring...



================================================== =========
Read this if you want to know how to get a correct reply for your question:
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
================================================== =========
I know that CVS was evil, and now i got the proof:
================================================== =========

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list maha .NET Framework 2.0 7 April 28th, 2007 12:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
HELP WITH DROPDOWN LIST enavas Excel VBA 1 April 6th, 2004 02:08 PM

All times are GMT -4. The time now is 08:38 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.