Problemi con master/details

venerdì 07 aprile 2006 - 11.07

Gabri.NET Profilo | Newbie

ciao a tutti il mio problema è questo...

ho una pagina che mi visualizza una gridview con dati presi da Db mysql (nome, cognome e id)

è stata presa la decisione di visualizzare i dettagli dell'utente selezionato tramite querystring in un'altra pagina..

nella nuova pagina ho inserito una detailsview per visualizzare i dettagli ma non so come fargli prendere il valore dell'id selezionato precedentemente...con access e sql server c'ho impiegato 30 secondi ma con mysql non so proprio come fare....
vi posto il codice:

PAGINA ELENCOUTENTI.aspx

<%@ Page Language="C#" Debug="true"%>
<%@ Import Namespace="System.Data"%>

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

<script runat="server">
void Page_Load(Object obj, EventArgs e)
{
DataSet ds = new DataSet();

MySql.Data.MySqlClient.MySqlConnection Conn = new MySql.Data.MySqlClient.MySqlConnection();
Conn.ConnectionString = "Server=XXX;Port=3306;Database=XXX;Uid=XXX;Pwd=XXX;";
Conn.Open();

MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM t01_utente ORDER BY t01_cognome", Conn);
da.Fill(ds, "t01_utente");

Grid.DataSource = ds.Tables["t01_utente"].DefaultView;
Grid.DataBind();
Conn.Close();
}



</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Pagina senza titolo</title>
<img src="../ci.png" border="0" width="280" height="90" alt="" >
<b>AREA DI SVILUPPO PCP.NET</b>
</head>
<body bgcolor="#E6E6FF" text="#000000" link="#000080" vlink="#800080" alink="#ff0000">
<form id="form1" runat="server">
<hr />
<b>AREA DI SVILUPPO PCP.NET</b>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
Menù Principale - Operatore connesso:
<asp:Label ID="lblNome" runat="server" />
<hr />
<br />
<br />
<table>
<tr>
<td valign="top">
<asp:GridView runat="server" ID="Grid" AutoGenerateColumns="False" DataKeyNames="t01_id_utente" >
<asp:BoundField HeaderText="COGNOME" DataField="t01_cognome" SortExpression="t01_cognome"/>
<asp:BoundField HeaderText="NOME" DataField="t01_nome" SortExpression="t01_nome"/>
<asp:BoundField HeaderText="ID UTENTE" DataField="t01_id_utente" Visible="False" ReadOnly="true" SortExpression="t01_id_utente"/>
<asp:HyperLinkField DataNavigateUrlFields="t01_id_utente"
DataNavigateUrlFormatString="~/Super_User/DettaglioUtente.aspx?id={0}"
HeaderText="VAI AL DETTAGLIO" Text="Vai" ItemStyle-HorizontalAlign="center"/>
</Columns>
</asp:GridView>
</td>
</tr>
</table>
<br />
</form>
</body>
</html>


E QUESTA E LA PAGINE DETTAGLIOUTENTE.ASPX

<%@ Page Language="C#" Debug="true"%>
<%@ Import Namespace="System.Data" %>

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

<script runat="server">
void Page_Load(Object obj, EventArgs e)
{
DataSet ds = new DataSet();

MySql.Data.MySqlClient.MySqlConnection Conn = new MySql.Data.MySqlClient.MySqlConnection();
Conn.ConnectionString = "Server=xxx;Port=3306;Database=xxx;Uid=xxx;Pwd=xxx;";
Conn.Open();

MySql.Data.MySqlClient.MySqlDataAdapter da = new MySql.Data.MySqlClient.MySqlDataAdapter("SELECT * FROM t01_utente WHERE ([t01_id_utente] = ?)", Conn);
da.Fill(ds, "t01_utente");

View.DataSource = ds.Tables["t01_utente"].DefaultView;
View.DataBind();
Conn.Close();
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Pagina senza titolo</title>
<img src="../ci.png" border="0" width="280" height="90" alt="" >
<b>AREA DI SVILUPPO PCP.NET</b>
</head>
<body bgcolor="#E6E6FF" text="#000000" link="#000080" vlink="#800080" alink="#ff0000">
<form id="form1" runat="server">
<hr />
<b>AREA DI SVILUPPO PCP.NET</b>
&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp
Menù Principale - Operatore connesso:
<asp:Label ID="lblNome" runat="server" />
<hr />
<br />
<asp:Button ID="btnRitorna" runat="server" Text="Torna all'elenco" PostBackUrl="~/Super_User/ElencoUtenti.aspx"/><br />
<br />
<br />
<asp:DetailsView ID="View" runat="server" AutoGenerateRows="false" DataKeyNames="t01_id_utente">
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<EditRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<Fields>
<asp:BoundField HeaderText="ID UTENTE" DataField="t01_id_utente" SortExpression="t01_id_utente"/>
<asp:BoundField HeaderText="COGNOME" DataField="t01_cognome" SortExpression="t01_cognome"/>
<asp:BoundField HeaderText="NOME" DataField="t01_nome" SortExpression="t01_nome"/>
<asp:BoundField HeaderText="LOGIN" DataField="t01_login" SortExpression="t01_login"/>
<asp:BoundField HeaderText="PASSWORD" DataField="t01_password" SortExpression="t01_password"/>
<asp:BoundField HeaderText="FORNITORE" DataField="t01_id_fornitore" SortExpression="t01_id_fornitore"/>
<asp:BoundField HeaderText="GRUPPO" DataField="t01_id_gruppo" SortExpression="t01_id_gruppo"/>
<asp:BoundField HeaderText="SIGLA" DataField="t01_sigla" SortExpression="t01_sigla"/>
</Fields>
</asp:DetailsView>
</form>
</body>
</html>

spero in un vostro aiuto...ciao
Guarda qua, con quest'unico dito avrei potuto farti uscire la vita dalla bocca!!

zcaotica Profilo | Newbie

Salve a te Gabri

In tutta onestà non ho capito il tuo problema.
Cioè con Access l'hai già fatto?
Il problema è come passare il parametro all'altra pagina o il fatto che non riesci a valorizzare la query ?
(o altro?)

Ciao da Zio Zeta

Gabri.NET Profilo | Newbie

grazie ho risolto tutto...il problema era che non riucivo a passare la query usando mysql ma è tutto a posto ora...
il nuovo problema è un'altro...devo poter modificare i dati della details view (sempre con mysql come database) e devo usare l'evento modechanging ma non ho proprio idea di come funzioni....spero di trovare qualche guida in giro...

se puoi aiutarmi grazie in anticipo... ciao




Guarda qua, con quest'unico dito avrei potuto farti uscire la vita dalla bocca!!
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5