This is a migrated thread and some comments may be shown as answers.

[Solved] Binding ChackBoxColumn Values

1 Answer 83 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Timothy
Top achievements
Rank 1
Timothy asked on 29 Oct 2010, 12:02 AM
I have a Grid connected to a SQL Table. I am displaying the data via a WCF service. I have a column in my SQL Table labeled "NASSync" The Column is set to type "int" and has a value of either 0 or 1 in the Table. I have referenced it in the WCF Service as below,

 

 

Imports System.ServiceModel
Imports System.ServiceModel.Activation
Imports System.Collections.Generic
Imports System.Data
Imports System.Data.SqlClient
Imports SilverlightWithWCFService.Web
  
<ServiceContract(Namespace:="Web"), AspNetCompatibilityRequirements(RequirementsMode:=AspNetCompatibilityRequirementsMode.Allowed)> _
  
Public Class SampleService
  
<OperationContract()> _
  
Public Function GetList() As List(Of AcxiomDBCallInfo)
  
Dim nwConn As String = System.Configuration.ConfigurationManager.ConnectionStrings("AcxiomConnectionString").ConnectionString
Dim checkList = New List(Of AcxiomDBCallInfo)()
Using conn As New SqlConnection(nwConn)
Const sql As String = "SELECT Hostname, NAS_Sync FROM CheckListItemss"
conn.Open()
Using cmd As New SqlCommand(sql, conn)
Dim dr As SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
If dr IsNot Nothing Then
Do While dr.Read()
Dim data = New AcxiomDBCallInfo With {.Hostname = dr.GetString(0), .NASSync = dr.GetBoolean(1)}
checkList.Add(data)
Loop
End If
Return checkList
End Using
End Using
End Function
' Add more operations here and mark them with [OperationContract]
End Class

When I run the SilverLight application I see the following in the Grid,

Hostname    NasSync
blahblah    True
blahblah2   True
blahblah3   False

I want the NasSync Column to be a checkbox column and be check or unchecked depending on the value of the .NasSync Property.

How do I do this?

This is how the gridview is currently being populated,

 

 

 

 

Private Sub client_GetListCompleted(ByVal sender As Object, ByVal e As GetListCompletedEventArgs)
TaskGrid.ItemsSource = e.Result
          
End Sub

 

 

 

 

 

 

 

Thanks,
Tim





 

 

1 Answer, 1 is accepted

Sort by
0
Maya
Telerik team
answered on 29 Oct 2010, 07:30 AM
Hi Timothy,

I have already answered to the other forum thread you started. In order to make our communication consistent, it would be better to follow a single thread on the topic.
 

Greetings,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Timothy
Top achievements
Rank 1
Answers by
Maya
Telerik team
Share this question
or