Binding a dropdownlsit to a button to determine datagrid rows
I am using ASP (not ASP.net) and SQL Server
I have a datagrid that I want filtered data to appear in. To do that, I created a dropdownlist which is populated from the same table as the datagrid, however now I'm stuck on how to update the datagrid with the selection that's been made in the dropdownlist. I'd like to use a button. Can anyone help me with this?
Here's my existing code:
<%
ConnString = "DSN=LocalUpload;"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open("Provider=SQLOLEDB.1;Password=helpdesk;Persist Security Info=True;User ID=HelpDesk;Initial Catalog=HelpDesk;Data Source=s9DCA3E")
Set rs = SERVER.CreateObject("ADODB.Recordset")
' first have to get the Department records to fill the drop down....
' Set SQL statement
strSQL = "SELECT * From Departments WHERE DepartmentID > 0 ORDER BY DepartmentName ASC"
' Open Recordset Object
rs.Open strSQL,conn, adOpenStatic
%>
Select A Department:
<% Do While Not rs.EOF
Response.Write (" " & rs("DepartmentName"))
rs.MoveNext
Loop
rs.Close
Set rs=Nothing
%>
!
<%
If Request.QueryString("qryDepartment") = "" Then
Response.Write("Please select a Department from the list.")
Else
' Build query
Set rs = SERVER.CreateObject("ADODB.Recordset")
' first have to get the Department records to fill the drop down....
' Set SQL statement
strSQL = "Select a.ProblemStatusId,b.TeamMemberName,c.problemTitle,e.DepartmentName,a.ProblemStatus From(((ProblemsUsersDeptsReps d Inner Join Departments e on d.DepartmentID = e.DepartmentID) Inner Join Problems c on d.ProblemID = c.ProblemID) Inner Join ProblemStatus a on d.ProblemsUsersDeptsRepsID = a.ProblemsUsersDeptsRepsID) Inner Join TeamMembers b on a.TeamMemberId = b.TeamMemberId Where (UPPER(a.ProblemStatus) = 'OPEN') and (e.DepartmentName = 'strsql') ORDER BY e.DepartmentName"
Request.QueryString("qryDepartment") & "'))"
' Open Recordset Object
rs.Open strSQL,conn,adOpenStatic
If rs.RecordCount = 0 Then
Response.Write("No records found for Department " & Request.QueryString("qryDepartment"))
Else
Response.Write(" Items Found for Department: " & Request.QueryString("qryDepartment") & " ")
' Build a table here
Response.Write("
")
Response.Write("
")
Response.Write("
Problem ID
")
Response.Write("
Team Member Name
")
Response.Write("
Title
")
Response.Write("
Departments
")
Response.Write("
Status
")
Response.Write("
")
Do While Not rs.EOF
Response.Write("
")
Response.Write("
" & rs("ProblemStatusID") & "
")
Response.Write("
" & rs("TeamMemberName") & "
")
Response.Write("
" & rs("ProblemTitle") & "
")
Response.Write("
" & rs("DepartmentName") & "
")
Response.Write("
" & rs("ProblemStatus") & "
")
Response.Write("
")
rs.MoveNext
Loop
rs.Close
Response.Write("
")
End If
End If
Set rs=Nothing
conn.Close
Set conn=Nothing
%>
Insert Link
Insert the URL that your highlighted text will link to.
Link URL:
Insert Video
Copy the video's "embed" tag into Embedded Video below.