Utilizzo di un GridView

FAQ di programmazione in .NET

Utilizzo di un GridView

Messaggioda alesslud » dom set 09, 2007 8:05 pm

using System.Web.UI.HtmlControls;
using System.Xml.Linq;
using MySql.Data.MySqlClient;
Utilizzo di un GridView:


public partial class test_Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
MySqlConnection conn = new MySqlConnection();
ConnectionMysql myConn = new ConnectionMysql();
conn = myConn.getConnection();
MySqlCommand command = new MySqlCommand("select * from test", conn);
MySqlDataReader reader = command.ExecuteReader();
Console.WriteLine("Ciao");
GridView1.DataSource = reader;
GridView1.DataBind();
}
}
alesslud
Site Admin
 
Messaggi: 779
Iscritto il: mer nov 08, 2006 8:09 am

Test.aspx

Messaggioda alesslud » dom set 09, 2007 8:05 pm

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test.aspx.cs" Inherits="test_Test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>

<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

</div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</form>
</body>
</html>
alesslud
Site Admin
 
Messaggi: 779
Iscritto il: mer nov 08, 2006 8:09 am


Torna a .NET

Chi c’è in linea

Visitano il forum: Nessuno e 1 ospite

cron