Thursday, April 28, 2011

Something wrong with my GridView code...

this code never fills the grid view I know that somthing is wrong here the code

Imports System.Data
Imports ZidduDataSetTableAdapters
Partial Class _Default
    Inherits System.Web.UI.Page
    Dim filesAdp As New FilesTableAdapter
    Dim filestable As New ZidduDataSet.FilesDataTable
    Protected Sub btnfill_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnfill.Click
        Me.GridView1.DataSource = filesAdp.GetData
        Me.GridView1.DataBind()
    End Sub
End Class

and I already created the dataset with wizard called ZidduDataSet.xsd and the adapter name is FilesTableAdapter

can any one help?

From stackoverflow
  • i am not a VB coder, but i think you should call Databind() function on Page Load event too.

    hope this helps.

  • the only thing wrong with the code is that filestable is never used. If your gridview isn't showing up then you have a problem else where i think.

    1. btnfill_Click isn't getting called. Check the .aspx markup to make sure the event handler is referenced.
    2. filesAdp.GetData doesn't return any data.
    3. GridView1 isn't visible on the page.

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.