Nov 20, 2009, 1:20 PM
Bind Grito do Datatable
I know that this is an argument already discussed here... but I cannot find the solution...
so... that's my problem:
I have a grid with column generated dinamically from DB in the page_load event (and here there's no problem...I see the columns)
after that, the user have to click a button and get data from DB, but after databind my grid is always empty!
here my code
:
markup code
at the end, i see just my grid with correct columns but without data...
Thanks
so... that's my problem:
I have a grid with column generated dinamically from DB in the page_load event (and here there's no problem...I see the columns)
after that, the user have to click a button and get data from DB, but after databind my grid is always empty!
here my code
:
markup code
<ext:Button ID="ButtonCerca" runat="server" Text="Submit">
<AjaxEvents>
<Click OnEvent="ButtonCerca_Click"></Click>
</AjaxEvents>
</ext:Button>
<ext:Store ID="StoreGriglia" runat="server">
<Reader>
<ext:JsonReader ReaderID="RIGA_ID">
<Fields>
<ext:RecordField Name="RIGA_ID">
</ext:RecordField>
</Fields>
</ext:JsonReader>
</Reader>
</ext:Store>
<ext:GridPanel runat="server" ID="Griglia" StoreID="StoreGriglia">
</ext:GridPanel>
vb.codeProtected Sub ButtonCerca_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles ButtonCerca.Click
Dim SQL, SQL_FIELDS As String
'### Here i get from session the structure of my Datatable/Grid
Dim Vista As ClVista = Session(costanti.Utente.VISTA_CORRENTE)
Dim ElencoCampi As List(Of ORM.Ff3dPcVisteStruct) = Vista.VistaStruct
SQL = "SELECT "
SQL_FIELDS = ""
'######### fields list
For Each Campo As ORM.Ff3dPcVisteStruct In ElencoCampi
If SQL_FIELDS <> "" Then SQL_FIELDS += ", "
SQL_FIELDS += Campo.Campo
'### Add field to store
StoreGriglia.Reader(0).Fields.Add(Campo.Campo)
Next
SQL = SQL & SQL_FIELDS & " FROM " & Vista.Vista.Vista & " WHERE rownum<100"
Dim cn As New Connessione.connessione(Vista.Vista.Istanza)
Dim DT As New DataTable
Try
DT = cn.EseguiQueryDT(SQL)
Catch ex As Exception
End Try
cn.Close()
'#### Here my DT has data inside
StoreGriglia.DataSource = DT
StoreGriglia.DataBind()
Griglia.DataBind() '####i try with this too!
End Sub
at the end, i see just my grid with correct columns but without data...
Thanks