Protected Sub sqlDataSource1_Selecting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceSelectingEventArgs) Handles sqlDataSource1.Selecting
If Dropdownlist1.SelectedValue = "1" Then
sqlDataSource1.SelectCommand = "SELECT * FROM NEWS "
Else
sqlDataSource1.SelectCommand = "SELECT * FROM NEWS " & _
"WHERE DEPART_ID='" & Dropdownlist1.SelectedValue & "'"
End If
End Sub
Protected Sub ddl_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddl.SelectedIndexChanged
If ddl.SelectedValue = 1 Then
dsrc.SelectCommand = "SELECT * FROM NEWS "
dsrc.DataBind()
Else
dsrc.SelectCommand = "SELECT * FROM NEWS WHERE เงื่อนไขอ่ะ " & ddl.SelectedValue
dsrc.DataBind()
End If
End Sub