Protected Sub Search(ByVal sender As Object, ByVal e As EventArgs)
Using con As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("constr").ConnectionString)
Using cmd As SqlCommand = New SqlCommand("ServiceDay_getServiceDays", con)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@Service", chkServices.SelectedItem.Value)
cmd.Parameters.AddWithValue("@Day", GetCheckedItems(chkDays))
Using da As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
da.Fill(dt)
gvServices.DataSource = dt
gvServices.DataBind()
End Using
End Using
End Using
End Sub
Private Function GetCheckedItems(ByVal checkBoxList As CheckBoxList) As String
Dim checkedItems As String = String.Empty
For Each item As ListItem In checkBoxList.Items
If item.Selected Then
checkedItems += item.Text & ","
End If
Next
checkedItems = checkedItems.Remove(checkedItems.Length - 1)
Return checkedItems
End Function

Disclaimer: This site is started with intent to serve
the ASP.Net Community by providing forums (question-answer) site where people can
help each other. The content posted here is free for public and is the content of
its poster. The site does not provide any warranties for the posted content. If
you feel any content is violating any terms please
contact.

Disclaimer

This site makes use of Cookies. Please refer Privacy Policy for more details.