473,808 Members | 2,797 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datagrid Display Not Working

Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:

1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy , BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource " to select
Dataset11.

RUN.

The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?

Cindy

Jul 24 '06 #1
2 2216
You need to fill your dataset.
By default, a data adapter does not fill a dataset. The "Generate
Dataset" you are talking about only creates a dataset with "Strongly
Typed" tables and columns, which means your dataset has strong names
for the data in it.

To fill your dataset with data, go to the page_load event and insert
the code:

sqldataAdapter1 .Fill(dataset11 ) ' VB, change for c#
datagrid1.Datab ind() ' This line ensures that every page load causes
the data to bind to the datagrid

Ideally you would wrap the above 2 lines of code in:

if Not Page.IsPostback then
end if

This is because your datagrid might use paging. There's a walkthrough
on datagrids in MSDN help. You need to do a little more work to get
paging to work, but not much.

Steve

Cindy wrote:
Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:

1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy , BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource " to select
Dataset11.

RUN.

The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?

Cindy
Jul 24 '06 #2
Thanks! That worked perfectly!

le*********@hot mail.com wrote:
You need to fill your dataset.
By default, a data adapter does not fill a dataset. The "Generate
Dataset" you are talking about only creates a dataset with "Strongly
Typed" tables and columns, which means your dataset has strong names
for the data in it.

To fill your dataset with data, go to the page_load event and insert
the code:

sqldataAdapter1 .Fill(dataset11 ) ' VB, change for c#
datagrid1.Datab ind() ' This line ensures that every page load causes
the data to bind to the datagrid

Ideally you would wrap the above 2 lines of code in:

if Not Page.IsPostback then
end if

This is because your datagrid might use paging. There's a walkthrough
on datagrids in MSDN help. You need to do a little more work to get
paging to work, but not much.

Steve

Cindy wrote:
Hello. For some reason, I am able to "connect" to the Northwind
database whenever I use the wizard; however, when I run the
application, my datagrid does not display. Here are the exact steps I
am taking to try to get this to run:

1)New Project -->ASP.NET Application
2) From the Server Explorer, drag the Northwind Employees table onto
the WebForm1.aspx design view. SqlConnection1 and SqlDataAdapter1 are
created.
3) From the Toolbox, drag the Datagrid control onto the WebForm1.aspx
web page.
4) Click on SqlDataAdapter1 box, select "Configure Data Adapter," and
fill out the settings for my server -- server name is the only one,
check "Use Windows Integrated Security," select the Northwind database,
and click on Test Connection. Succeeded. (Funny thing: On the
"Advanced" tab, none of the permissions are checked and I can't change
them.)
5)Click next and select "Use SQL Statements" for the rest of the
wizard.
6) Keep standard query generated out of the Employees table. ("SELECT
EmployeeID, LastName, FirstName, Title, TitleOfCourtesy , BirthDate,
HireDate, Address, City, Region, PostalCode, Country, HomePhone,
Extension, Photo, Notes, ReportsTo, PhotoPath FROM Employees")
7) Finish.
8)Click on Generate Dataset. It creates Dataset11.
9) Click on the Datagrid and use the dropdown in "Datasource " to select
Dataset11.

RUN.

The explorer page is blank, even though I can see the column names in
the DESIGN mode. What is going on?

Cindy
Jul 24 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
945
by: DelphiBlue | last post by:
I have a Nested Datagrid that is using a data relations to tie the parent child datagrids together. All is working well with the display but I am having some issues trying to sort the child datagrid. HTML Datagrid1 TemplateColumn Table Header information Detail Information
3
2551
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would look like this :
3
3039
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can download a fully working C# sample with the Northwind.mdb here: www.insightgis.com.au/web/stuff/DataGridCombo.zip
2
4340
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
3
2603
by: Kumar | last post by:
Hi Folks, I have a question regarding conditional hyperlink in datagrid. I want to display Hyperlink if my QID values in (1,4,5,6) other wise i want to display just Qdescription with out hyperlink. <asp:hyperlinkcolumn headertext="Question" SortExpression="QDescription" datatextfield="QDescription"
0
894
by: nfedin | last post by:
I am trying to use a datagrid to display/edit some database information. I would like to use the datagrids inherent edit capabilities to do it. I have setup the datagrid to display the data properly and set up a function to save the data in the database using the datagrids UpdateCommand event. I did this and everything worked like a charm.... About a week later, I revisited the page and found now that the datagrid's events are not...
2
12604
by: simon | last post by:
hello, new to vb.net, have a few questions about DataGrid. I have a dataGrid that is working pulling a dataset back from a stored proc and binding to the datagrid for display the datagrid's first column is a textbox(TemplateColumn), the other 3 columns are just display(BoundColumn). (1) if the value of the textbox is 0, then i'd like to change it null, so the box is empty
5
2913
by: rn5a | last post by:
In my application, I want to populate all the directories & files existing in a directory on the server in a DataGrid. To ensure that all the directories get listed first followed by all the files, I am appending all the directories with 0 & all the files with 1. Moreover, each directory & file listed in the DataGrid will have a corresponding CheckBox. To differentiate between directories & files, I am adding the string "*D" (without the...
2
1011
by: Mark B | last post by:
I have a Datagrid working fine, outputting: Group Most Popular Product Code -------- ------------------------------- Earth.New Zealand 32 Earth.New Zealand
7
3037
by: Mark B | last post by:
Can someone write some VB.Net example code for me that does this: 1) Creates a gridview control with the results of a SQL stored procedure that has 1 parameter (text) 2) Adds an extra column that displays the result of a VB.Net function that uses a value from an existing column I have spent 4 hours trying to do this after Googling for examples... There are many new concepts that I haven't had much experience with...
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10373
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10374
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9195
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5547
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5685
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4331
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.