Click here to Skip to main content
15,850,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Good Morning all

I have a set of checkboxes, each one contains a year as it's content beginning with 2005 and ending at 2013.

These years represent an attribute in a field from a REST service.
The field is "Year"

I would like the user to have the ability to check any number of these checkboxes and have a CLICK button that executes a query based on these selections.

i.e. If the user selects checkboxes, 2005, 2006, and 2009 the query will search the content of these checkboxes only.

Maybe adding what I have might help--

VB
Partial Public Class MainPage
    Inherits UserControl
    Dim _year As String


    Public Sub New()
        InitializeComponent()

    End Sub

    Private Sub btnExecute_Click(sender As Object, e As RoutedEventArgs)
        For Each myCheckBox As CheckBox In stkPanel.Children.OfType(Of CheckBox)().Where(Function(myCheckBoxx) myCheckBoxx.IsChecked.Equals(True))
            _year = myCheckBox.Content.ToString()
        Next


        Dim _QueryTask As New QueryTask("http://speedo:6080/arcgis/rest/services/ems/EMS_CALLS/MapServer/0")
        AddHandler _QueryTask.ExecuteCompleted, AddressOf QueryTask_ExecuteCompleted

        Dim _query As New ESRI.ArcGIS.Client.Tasks.Query()
        _query.OutFields.Add("Year")
        _query.Where = "Year = '" & _year & "'"
        _query.ReturnGeometry = True

        _QueryTask.ExecuteAsync(_query)

    End Sub

    Private Sub QueryTask_ExecuteCompleted(sender As Object, e As QueryEventArgs)
        Dim _layer As GraphicsLayer = TryCast(myMap.Layers("myLayer"), GraphicsLayer)
        _layer.Graphics.Clear()
        Dim _featureSet As FeatureSet = e.FeatureSet
        If _featureSet IsNot Nothing AndAlso _featureSet.Features.Count > 0 Then
            For Each _featureGraphic As Graphic In e.FeatureSet.Features
                _featureGraphic.Symbol = TryCast(LayoutRoot.Resources("red"), ESRI.ArcGIS.Client.Symbols.Symbol)
                _layer.Graphics.Add(_featureGraphic)
            Next _featureGraphic
        End If
    End Sub

End Class


Thank you - using Silverlight (XAML/VB)
Posted
Updated 2-Oct-13 6:39am
v2

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