Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

bind dropdown if statement

Posted on 2010-09-20
4
Medium Priority
?
337 Views
Last Modified: 2012-06-27
Hello,

I'm trying to do this and it errors with  Input string was not in a correct format

        Dim i As Integer
        For i = 0 To surveyNameDropdown.Items.Count - 1
            If ds.Tables(0).Columns("surveyActive").ColumnName = True Then
                surveyNameDropdown.Items(i).Attributes.Add("style", "color:Red".ToString())
            End If

Column in database called surveyActive with the data type set as  bit

Thanks in advance..
0
Comment
Question by:GrantBailey
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 35

Expert Comment

by:YZlat
ID: 33718611
try
Dim i As Integer
        For i = 0 To surveyNameDropdown.Items.Count - 1
            If ds.Tables(0).Columns("surveyActive").ColumnName = 1 Then
                surveyNameDropdown.Items(i).Attributes.Add("style", "color:Red".ToString())
            End If

Open in new window

0
 
LVL 35

Expert Comment

by:YZlat
ID: 33718619
if data type is bit, then use 1 or 0 instead of true or false
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 1000 total points
ID: 33718649
What exactly you want to compare by: ds.Tables(0).Columns("surveyActive").ColumnName = True

If you want to compare it to the value of surveyActive then you will have to loop through the row and then get the column value like:
Convert.ToBoolean(ds.Tables(0).Rows(0)(1) == true
'this is getting value of first row second column.
0
 

Author Closing Comment

by:GrantBailey
ID: 33832651
Thanks again guru_sami.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
Sometimes in DotNetNuke module development you want to swap controls within the same module definition.  In doing this DNN (somewhat annoyingly) swaps the Skin and Container definitions to the default admin selections.  To get around this you need t…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question