Tutorials to .com

Tutorials to .com » Dotnet » Control-and-components » DataGrid control (a)

DataGrid control (a)

Print View , by: iSee ,Total views: 12 ,Word Count: 561 ,Date: Wed, 20 May 2009 Time: 7:33 PM

Because it is just beginning to learn asp.net, the most important reasons is because of work, it is not using asp.net to develop software, so the learning time on a number of relatively less, learn more slowly, and together with this person I odd stupid, so there is the following article.

Holding a book asp.net eating for a long time, see the DataGrid control when introduced, can not help but want to try to be a small procedure. Books to the two examples, one is automatically generated out of, another one is generated out manually, I choose to manually generate out. Code is as follows:

<% @ Page language = vb runat = server debug = true%>
<% @ Import namespace = "system"%>
<% @ Import namespace = "system.data"%>
<% @ Import namespace = "system.data.oledb"%>
<% @ Import namespace = "system.data.sqlclient"%>
<% @ Import namespace = "system.text"%>
<% @ Import namespace = "system.IO"%>
<% @ Import namespace = "system.web"%>
<% @ Import namespace = "system.web.UI"%>
<% @ Import namespace = "system.web.UI.Webcontrols"%>


<script language=vb runat=server>

sub page_load (byval sender as object, byval e as eventargs)

dim conn as oledbconnection
dim command as oledbdataadapter
dim ds as new dataset

conn = new oledbconnection ( "Provider = SQLOLEDB.1; Persist Security Info = False; User ID = sa; Initial Catalog = client; Data Source = vvv")
command = new oledbdataadapter ( "select * from infoclient", conn)
command.fill (ds, "infoclient")

datagrid1.datasource = ds.tables ( "infoclient"). defaultview
datagrid1.databind

end sub
</ script>
<html>
<head>
<title> Customer Management - Customer Information </ title>
</ head>
<body>

<asp: datagrid
id = datagrid1
width = 90%
autogeneratecolumns = false
backcolor = beige
alternatingitemstyle-backcolor = cornsilk
bordercolor = black
showfooter = false
cellpadding = 3
cellspacing = 0
font-name = arial
font-size = 8pt
forecolor = black
headerstyle-backcolor = burlywood
headerstyle-font-bold = true
runat = "server"
> </ asp: datagrid>


</ body>
</ html>

database there are data, but when run shows nothing, a blank page, may I ask what is wrong?

, finally understood that when you choose autogeneratecolumns = false, that is generated out manually when the columns must be set, boundcolumns such controls to the list will show you, if we chose autogeneratecolumns = false, and columns do not have a collection, then told how to manually generate it out?

On the DataGrid control the use of asp.net, I have a lot of problems, understand that after engaging in it as I would like to have written the article, are also considered to have accumulated little experience of its own, but also like me to paste the side halo to provide points of knowledge point.



.Net Control and components Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.