Link to home
Start Free TrialLog in
Avatar of archinpalli
archinpalli

asked on

C# STRING

Experts,

I need urgent help with a string. ie I have a drop down list which has one of the value $100,00.
in my code i get this value using ddlList1.SelectedItem.Text,  I need to do some validation in code something like this
if(ddlList1.SelectedItem.Text>$100,00)
{

}
how do i convert this to do validation, If i write above like that, It has a $ sign and a charcter. which is not accepatble.
Any urgent help is appreciated
Avatar of Daniel Reynolds
Daniel Reynolds
Flag of United States of America image

You will need to use System.Convert.... () to get the value of the string to a number variable. Wrap it in a try/catch in case the value is not a number.

then compare the value to your rule.
Avatar of archinpalli
archinpalli

ASKER

Can you post a sample code if you have in mind
ASKER CERTIFIED SOLUTION
Avatar of MuhammadAdil
MuhammadAdil
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial