GridView Refresh/Visibility

  • Thread starter Thread starter mail
  • Start date Start date
M

mail

Hi I'm very new to asp.net and I'm trying to make a little program for
learning purpose.

I want to read an XML File and get some data that is stored in it. (The
XML-File isn't always the same so I want to fill my DataView by hand
and not via a fix Datasource)

My problem is the Dataview is filled but the GridView/Webpage isn't
shown/refreshed.

Here is the code for filling the dataview

Dim MyDataSet As New DataSet
MyDataSet.ReadXml(xml)
GridView1.DataSource = MyDataSet.Tables("character")
GridView1.DataBind()


I bet it's only a simple problem and easy to solve but I'm trying
around now for a couple of hours and can't see the datagrid. (If I use
a fix Datasource then it works)

Hope someone can help me
Matthias
 
Hi Matthias,

A couple of things to check...

Are you sure the dataset is being filled?

One way to check is to put this code in to see what's there:
Dim MyDataSet As New DataSet
MyDataSet.ReadXml(xml)
MyDataSet.WriteXml("c:\mydataset.xml")

Also, do you have the correct name for the table? You could try:

GridView1.DataSource = MyDataSet.Tables(0)


BTW, I think you meant GridView rather than DataView.

Ken
 
Hi Ken thx for the answer.
The data is in the dataset (tried it with you xmlwrite example)
The name is the Correct for the table even if I try it with (0) it
doesn't work.
And yes sure GridView, was a little late when I wrote the Post.
 
What I forgot to add If I check my GridView with
gridview1.Rows(0).Cells(1).Text
I get the correct Text so the GridView is filled but never shown.

Is it possible that it has something to do with the
AutogenerateColumns? I have 1 Userdefinded Column because I don't need
to show all Columns, But gridview1.columns.count returns 0.
 
Ah found my mistake I have set the Gridview to nothing before filling
it now it works, but another question:

Now I have all the data with autogenerated columns, but I don't want to
show all the columns, how can I force it to usedefinded Columns. I have
1 unserdefined but this one is allways empty
 
Back
Top