Gridview columns visible

panjul

Member
Joined
Jun 7, 2007
Messages
21
Programming Experience
Beginner
Guys, i want to ask about gridview.
This is my code :
query = sql.SetSELECT("AsmbID,AsmbDesc,Remark,Material_Cost,Process_Cost,Expense", "MAssembly")

GridView1.DataSource = sql.FillDataSet(query).Tables.Item(0)
GridView1.DataBind()

then i just want to show only my first(0) coloumn, and this is the code :
'GridView1.Columns(1).Visible = False
'GridView1.Columns(2).Visible = False
'GridView1.Columns(3).Visible = False
'GridView1.Columns(4).Visible = False
'GridView1.Columns(5).Visible = False
but there is an error said :
Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
i've debugg my code, and there is a coloumn in my dataset, but if we show in gridview, there no column, but if i want to show all my field, there will be there.
is there somebody can help me ?:confused::confused::confused:
 
OK, so if you put a break point in, and then once broke can you see what your tables hold?

If there is no datatable in your dataset then that line is the issue. if you can see data then it's something wrong with the way you have bound your grid columns.
 
Back
Top