Il debbuger non da nessun errore va lisco come l'olio...
Cmq va bene ti incollo tutto...
codice:
<td class="style2" valign="top"> <asp:ListView ID="ListView1" runat="server" DataKeyNames="ID_Attivita" DataSourceID="AccessDataSource2" Visible="False"> <ItemTemplate> <span style="background-color: #E0FFFF;color: #333333;">
<%# Eval("Titolo") %>
</span> </ItemTemplate> <AlternatingItemTemplate> <span style="background-color: #FFFFFF;color: #284775;">
<%# Eval("Titolo") %>
</span> </AlternatingItemTemplate> <EmptyDataTemplate> <span>Non è stato restituito alcun dato.</span> </EmptyDataTemplate> <InsertItemTemplate> <span style="">Titolo: <asp:TextBox ID="TitoloTextBox" runat="server" Text='<%# Bind("Titolo") %>' />
Testo: <asp:TextBox ID="TestoTextBox" runat="server" Text='<%# Bind("Testo") %>' />
<asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Inserisci" /> <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Cancella" />
</span> </InsertItemTemplate> <LayoutTemplate> <div ID="itemPlaceholderContainer" runat="server" style="font-family: Verdana, Arial, Helvetica, sans-serif;"> <span ID="itemPlaceholder" runat="server" /> </div> <div style="text-align: center;background-color: #5D7B9D;font-family: Verdana, Arial, Helvetica, sans-serif;color: #FFFFFF;"> <asp:DataPager ID="DataPager1" runat="server" PageSize="10"> <Fields> <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> <asp:NumericPagerField /> <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" ShowNextPageButton="False" ShowPreviousPageButton="False" /> </Fields> </asp:DataPager> </div> </LayoutTemplate> <EditItemTemplate> <span style="background-color: #999999;">ID_Attivita: <asp:Label ID="ID_AttivitaLabel1" runat="server" Text='<%# Eval("ID_Attivita") %>' />
Titolo: <asp:TextBox ID="TitoloTextBox" runat="server" Text='<%# Bind("Titolo") %>' />
Testo: <asp:TextBox ID="TestoTextBox" runat="server" Text='<%# Bind("Testo") %>' />
<asp:Button ID="UpdateButton" runat="server" CommandName="Update" Text="Aggiorna" /> <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" Text="Annulla" />
</span> </EditItemTemplate> <SelectedItemTemplate> <span style="background-color: #E2DED6;font-weight: bold;color: #333333;"> ID_Attivita: <asp:Label ID="ID_AttivitaLabel" runat="server" Text='<%# Eval("ID_Attivita") %>' />
Titolo: <asp:Label ID="TitoloLabel" runat="server" Text='<%# Eval("Titolo") %>' />
Testo: <asp:Label ID="TestoLabel" runat="server" Text='<%# Eval("Testo") %>' />
</span> </SelectedItemTemplate> </asp:ListView>
<asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/attivita.mdb" SelectCommand="SELECT * FROM [Descrizione] ORDER BY [Titolo]"> </asp:AccessDataSource>
</td>
Il codice che sta sopra fa riferimento alla pagina Attivita.aspx...
Mentre questo qui sotto fa riferimento alla pagina all_attivita.aspx...
codice:
using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Net; using System.IO; using System.Data.OleDb; using System.Data; using System.Drawing.Drawing2D; using System.Drawing; using System.Drawing.Imaging; public partial class all_attivita : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (Request.Params["ID_Attivita"] != null) { String ConnString; OleDbConnection cn; OleDbCommand cmd; OleDbDataReader rdr; String sql; ConnString = "Provider=Microsoft.Jet.OleDb.4.0; Data Source=" + Server.MapPath("App_Data/attivita.mdb"); cn = new OleDbConnection(ConnString); cn.Open(); sql = "SELECT ID_Attivita,Titolo,Testo FROM Descrizione WHERE ID_Attivita= " + Request.Params["ID_Attivita"]; cmd = new OleDbCommand(sql, cn); rdr = cmd.ExecuteReader(); DataTable tabella = new DataTable("Descrizione"); tabella.Load(rdr); Label1.Text = tabella.Rows[0]["Titolo"].ToString(); Label2.Text = tabella.Rows[0]["Testo"].ToString(); } else { Label1.Text = "Non ci sono notizie da visualizzare"; Label2.Text = "Non ci sono notizie da visualizzare"; } } }
Speriamo che tu riesca a fare qualcosa