Data.aspx dosyasynda dikkat çeken nokta <asp:datagrid> etiketi içerisindeki geli?mi? ve fonksiyonel etiketlerdir.Bu etiketler sayesinde olu?turdu?umuz datagrid’in özelliklerini , boyunu, yazy rengini ve tipini gibi birçok özelli?i de?i?tirebiliyoruz.Bir sonraki makalemde bu özelliklerin kullanyly?yny, verileri syralama methodlaryny anlatycam.Yyi çaly?malar...
-----data.aspx ------
<%@ Page Language="vb" AutoEventWireup="false" src="data.aspx.vb" Inherits="data" %>
<HTML>
<HEAD>
<title>DataGrid</title>
</HEAD>
<body >
<form id="Form1" method="post" runat="server">
<ASP:DataGrid
id="listtalepler"
runat="server"
Width="90%"
BorderColor="black"
CellPadding=3
CellSpacing="0"
Font-Name="Trebuchet MS"
Font-Size="10pt"
ForeColor="Black"
BackColor="Beige"
HeaderStyle-BackColor="Burlywood"
HeaderStyle-Font-Bold="True"
AutoGenerateColumns="False">
<Columns>
<asp:BoundColumn
HeaderText="AD"
DataField="ad"
/>
<asp:BoundColumn
HeaderText="Soyad"
DataField="soyad"
/>
</Columns>
</asp:DataGrid>
</form>
</body>
</HTML>
-----data.aspx.vb-------
Imports System.Data
Imports System.Data.OleDb
Public Class data
Inherits System.Web.UI.Page
Protected WithEvents listtalepler As System.Web.UI.WebControls.DataGrid
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim DBConn As OleDbConnection
Dim DBCommand As OleDbDataAdapter
Dim DSPageData As New DataSet()
DBConn = New OleDbConnection("provider=" _
& "Microsoft.Jet.OLEDB.4.0;" _
& "DATA SOURCE=" _
& Server.MapPath("db/veritabanim.mdb;"))
DBCommand = New OleDbDataAdapter _
("Select * From tbltalep " _
& " order by ad" , DBConn)
DBCommand.Fill(DSPageData, _
"talepler")
listtalepler.DataSource = _
DSPageData.Tables("talepler").DefaultView
listtalepler.DataBind()
End If
End Sub
End Class