Click here to Skip to main content
15,915,975 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
In one drop down list two name one is Enable and second Is disable
then the type of column in bit then what should be in query that if enabled is select then it should take 1 otherwise 0


dropdownlist1.selectedvalue.tosting ();
is not working .

error is--Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the varchar value 'Enable' to data type bit.
Posted

try this:

C#
int i = DropDownList1.SelectedIndex;


int i is just a variable put database column name here if requried
 
Share this answer
 
v2
Set the value of Enable=0 and Disable=1 and put the datatype int.

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900