Last post Apr 01, 2011 10:24 PM by Decker Dong - MSFT
Mar 30, 2011 09:16 AM|nzurita|LINK
Hello, I'm trying to extend de GridView control with a Custom Server Control, I'm doing ok with extended properties but when I get to methods that need to re-apply or modifiy the DataSource I don't get any data in the grid, though the SQLDataSource actually
retrieve data. Here is my MyGridView.applyFilter() method, which should filter the data but actually shows an empty GridView, but as I sayed, the DataSource has data. I try to find (FindControl) the
SQLDataSource of the GridView (Me) and modifiy its paramters, then
DataBind Me to apply the changes...
Public Sub applyFilter(ByRef container As Control, ByVal param_names() As String)
Dim final As Boolean = False
Dim NFiltro As Integer = 1
Dim ctlFilter As New Control
If Not container Is Nothing Then
Dim TheSQLDataSource As New SqlDataSource
TheSQLDataSource = container.FindControl(Me.DataSourceID)
If Not TheSQLDataSource Is Nothing Then
.SelectCommand = "My_StoredProcedure"
.SelectCommandType = SqlDataSourceCommandType.StoredProcedure
Do While Not (final)
ctlFilter = container.FindControl("bfiltro" & NFiltro)
'....APPLY FILTER VALUES TO STORED PROC PARAMS...
TheSQLDataSource.DataBind() '<- GRIDVIEW APPEARS EMPTY, BUT THE SP RETUNRNS DATA
Me.DataBind() '<- GRIDVIEW APPEARS EMPTY, BUT THE SP RETUNRNS DATA
What am I doing wrong? why is the gridview empty?
Apr 01, 2011 10:24 PM|Decker Dong - MSFT|LINK
I think you are calling DataBind() method to a SqlDataSource instead of GridView, DataList or some other data presentation controls.
Maybe you should apply DataBind() method to GridView or some other data presentation controls instead.