Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
sheena
Starting Member
45 Posts |
Posted - 2007-05-16 : 14:44:59
|
Hello frdz,I want to check the condition in the dropdownlistbox which value is selected.Depending on that i want to set enable or visible property to false for some controls.So,that the user can not enter into it.I m using asp.net with C# 2005.I don't know it can be performed in the C#.but thento i have tried pls tell me where i have done the big mistake.thanxs in adv. protected void Page_Load(object sender, EventArgs e) { bool cmbitem = false; if (cmbrecmode.SelectedValue = "Cash") { cmbitem = true; cmbbankname.Enabled = false; tbcheqno.Enabled = false; tbchequedt.Enabled = false; }This code is not allowing me to atleast compile the program.So tell me how to correct it. |
|
sheena
Starting Member
45 Posts |
Posted - 2007-05-16 : 14:54:47
|
Compiler Error Message: CS0029: Cannot implicitly convert type 'string' to 'bool' |
|
|
dfiala
Posting Yak Master
116 Posts |
Posted - 2007-05-16 : 14:58:18
|
in C#:= is an assignment operator== is an evaluation operatoryou need to use == hereif (cmbrecmode.SelectedValue == "Cash") { cmbitem = true; cmbbankname.Enabled = false; tbcheqno.Enabled = false; tbchequedt.Enabled = false; }Dean FialaVery Practical Software, IncNow with Blogging...http://www.vpsw.com/blogbabyMicrosoft MVP |
|
|
sheena
Starting Member
45 Posts |
Posted - 2007-05-17 : 00:53:47
|
thanxs very much...for finding mistake.Ok,one another problem can anyone tell me which validator should be used to select the particular value from the drop-down list.I have 3 values 0 - Select Mode1 - Cash2 - CreditNow,the user if selects the index 0 value then also it takes and stores into the database which i don't want.I think validator control can be used but what conditions should be put for that ?? |
|
|
|
|
|