TECH_NET
asked on
Creating ASPGrid at run time
I have a web form that display the data grid. The data grid is bound to a stored procedure based on the criteria being passed.
I am no problem when i invoke the method that binds the data grid for the first time.(ie when i pass the parameter)
Now when i pass a different value to the parameter, i need the grid to show results that where passed as parameter on FIRST EXECUTION.
I can easily have 2 data grid to accomplish this. But if i am not sure how many times the paramter would be changed , how do i accomplish showing the datagrid with results based on the criteria being passed.
Attached are my methods i am using.
I am no problem when i invoke the method that binds the data grid for the first time.(ie when i pass the parameter)
Now when i pass a different value to the parameter, i need the grid to show results that where passed as parameter on FIRST EXECUTION.
I can easily have 2 data grid to accomplish this. But if i am not sure how many times the paramter would be changed , how do i accomplish showing the datagrid with results based on the criteria being passed.
Attached are my methods i am using.
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
'Loop through the search request and show search results for each request
Dim aList, x
If Len(Request.QueryString("RefID")) > 0 Then
aList = Split(Request.QueryString("RefID"), "*~*")
For x = 0 To UBound(aList)
BindGrid(CInt(aList(x)))
Next
End If
Catch ex As Exception
End Try
End Sub
Sub BindGrid(ByVal iSearchID As Integer)
Try
Dim objSearchResults As New CommuterDALTableAdapters.objCommuterSearchRequestReportsTableAdapter
dgGrid.DataSource = objSearchResults.FetchSearchMatches(iSearchID)
dgGrid.DataBind()
Catch ex As Exception
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.