473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Easy Question. Create a datagrid filled with data without any code on web page?

I am using visual studio 2003. I user the server explorer and drag a table
onto a webform.

The program creates a "Connection" and an SQLDataAdapter Generates the
"Select, Insert, Delete" statments.

I right click on the SQLDataAdapter and chose Generate Dataset.

I drag a datagrid on to the form. Chose the SQLDataAdapter and dataset in
the properties.

I then run the webpage and I get nothing. When I do a preview on the
SQLDataAdapter I see the data in the table.

So what is my problem? Is there some documentation on how to use these
controls in this manner instead of alway writing code behind the scenes?

Thanks,

Rog
Nov 19 '05 #1
2 1181
DataAdapter itself can not be a datasource of datagrid, you should use
fill method to build dataset or datatable. then use dataset's dataview
as a datasource of datagrid. hope it helps.

Roger wrote:
I am using visual studio 2003. I user the server explorer and drag a table
onto a webform.

The program creates a "Connection" and an SQLDataAdapter Generates the
"Select, Insert, Delete" statments.

I right click on the SQLDataAdapter and chose Generate Dataset.

I drag a datagrid on to the form. Chose the SQLDataAdapter and dataset in
the properties.

I then run the webpage and I get nothing. When I do a preview on the
SQLDataAdapter I see the data in the table.

So what is my problem? Is there some documentation on how to use these
controls in this manner instead of alway writing code behind the scenes?

Thanks,

Rog

Nov 19 '05 #2
No matter what you do, drag and drop wise, you will have a couple of lines to
add:

this.sqlConnection1.Open();
this.sqlDataAdapter1.Fill(this.dataSet11);
Page.DataBind(); //Can also be DataGrid1.DataBind();

At least until the 2.0 Framework, where the SqlDataSource automatically does
this call.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Roger" wrote:
I am using visual studio 2003. I user the server explorer and drag a table
onto a webform.

The program creates a "Connection" and an SQLDataAdapter Generates the
"Select, Insert, Delete" statments.

I right click on the SQLDataAdapter and chose Generate Dataset.

I drag a datagrid on to the form. Chose the SQLDataAdapter and dataset in
the properties.

I then run the webpage and I get nothing. When I do a preview on the
SQLDataAdapter I see the data in the table.

So what is my problem? Is there some documentation on how to use these
controls in this manner instead of alway writing code behind the scenes?

Thanks,

Rog

Nov 19 '05 #3

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

Similar topics

2
by: VM | last post by:
When I display data to a Windows datagrid I usually fill the underlying table (in another class) and then, once it contains all the data, I attach it to the grid. But there are some processes that...
0
by: Jason | last post by:
I am pretty new to C# so bare with me... The design of my website utilizes tables on every page that look almost identical, save the data they are displaying. I have written the code to create...
6
by: ad | last post by:
I use the code to create a DataGrid and filled with data, But the DataGrid1 didn't display in WebForm. How can I display the DataGrid after creating it? DataGrid DataGrid1 = new DataGrid();
1
by: Moshfegh Hamedani | last post by:
Hi there, I found this question in Amit Kalani's preparation book for exam 70-15 (Developing Web Applications with C#). I think it's a very stupid question! It says the correct answer is A but...
4
by: Rod | last post by:
I posted a message to this group yesterday asking how to pass parameters to a web form that is the source of an IFrame on a parent web form. I've gotten my answer, and it works. Thanks! Now I...
6
by: Shawn | last post by:
Hi. I already have a datagrid where I'm using paging. I have a stored procedure that fills a temp table with 200-500 rows and then sends back 10 records at the time. When I go to page 2 the SP...
3
by: james crosthwaite via .NET 247 | last post by:
Hi, I'm pretty new to .NET and i'm having a major problem which ireally need some help with. I am developing an application for my office which allows usersto book rooms. I have a Booking Form...
12
by: Bishoy George | last post by:
I have a dataset called ds1 filled with 2 tables Employees and Customers from Northwind database. I have dropdownList called ddLastName with the following properties: ddLastName.DataSource =...
27
by: max | last post by:
Hello, I am a newbye, and I'm trying to write a simple application. I have five tables with three columns; all tables are identical; I need to change some data in the first table and let VB...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.