Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / June 2007

Tip: Looking for answers? Try searching our database.

Web Form DataGrid not displaying  - please help me!!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
almurph@altavista.com - 29 Jun 2007 18:44 GMT
Hi,

    This is weird, please help. Its probably very simple but I'm stuck! I
have populated a dataset with some data from a session variable:

Dim dsTables As DataSet = Session("soLookupTables")

    And now I am trying to display it to a DataGrid widget using the
following code:

Dim myTable As DataTable = dsTables.Tables("CNTYNAMES")
Me.DataGrid1.DataSource = myTable.DefaultView

    Problem is though - nothing is appearing o nthe Web form page. I've
tried everything

a. try-catches (no errors thrown)
b. Closing down and opening up (no change)
c. DataGrid properties - everything looks okay

    There is definitely data in the dataset. 2 tables to be exact. In the
one specified there are 16 rows. I have used code like:

Me.Label1.Text = dsTables.Tables("CNTYNAMES").Rows(0).Item(0)

    and have seens some sensible data. I just don't know why the DataGrid
is not displaying. Please help me I'm stuck!!!

Thanks,
Al.
Mike - 29 Jun 2007 20:24 GMT
do you have data in your dataset?
to check that you can do

dataset.writeXML("filename.xml");

and then you can open the XML file and verify you are getting data back.

try that and see what happens,

Signature

Mike
'IGotYourDotNet'
http://igotyourdotnet.blogspot.com/

> Hi,
>
[quoted text clipped - 26 lines]
> Thanks,
> Al.
Mike - 29 Jun 2007 20:26 GMT
I don't see

datagrid1.databind();

in your code snippet

what happens?

> Hi,
>
[quoted text clipped - 26 lines]
> Thanks,
> Al.
Mark Rae - 29 Jun 2007 20:32 GMT
> Dim myTable As DataTable = dsTables.Tables("CNTYNAMES")
> Me.DataGrid1.DataSource = myTable.DefaultView

You have done the first two stages of the three that are required here:

1) Instantiated a DataSet
2) Told your DataGrid that it will be using the DataSet as its DataSource

What you haven't done is actually bind the data to the DataGrid:
Me.DataGrid1.DataBind

Signature

http://www.markrae.net


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.