Salve ragazzi
nn tiesco a risolvere..nella pagina del Datalist ho fatto così :
<script>
Request.QueryString.Get("Doc_ID");
</script>
<asp:HyperLink ID="HyperLink1" Runat="server"
NavigateUrl=<%# "~/dettagli.aspx?Doc_ID=" + DataBinder.Eval(Container.DataItem, "Doc_ID") %>> VEDI </asp:Hyperlink>
nella pagina dettagli.aspx :
<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Data.SqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
SqlConnection myConnection;
string strConnectionString;
protected void Page_Load(Object Src, EventArgs E)
{
myConnection = new SqlConnection("");
myConnection.ConnectionString = strConnectionString;
myConnection.Open();
String strSql = "SELECT * FROM upload WHERE Doc_ID = @Doc_ID ";
Request.QueryString.Get("Doc_ID");
SqlDataReader odDataReader;
SqlCommand odCmd;
odCmd = new SqlCommand(strSql, myConnection);
odDataReader = odCmd.ExecuteReader();
lbl1.text = odDataReader["Nome"].toString();
lbl2.text = odDataReader["Cognome"].toString();
lbl3.text = odDataReader["Titolo"].toString();
myConnection.Close();
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ItemTemplate>
<b>Autore:</b><br />
<asp:Label ID="lbl1" runat="server" Width="100" Text='<%# Eval("Nome") %>'></asp:Label>
<asp:Label ID="lbl2" runat="server" Width="100" Text='<%# Eval("Cognome") %>'></asp:Label>
<asp:Label ID="lbl3" runat="server" Width="100" Text='<%# Eval("Titolo") %>'></asp:Label>
</div>
</form>
</body>
</html>
ma mi da questo errore :
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0117: 'System.Web.UI.WebControls.Label' does not contain a definition for 'text'
Source Error:
Line 27: odDataReader = odCmd.ExecuteReader();
Line 28:
Line 29: lbl1.text = odDataReader["Nome"].toString();
Line 30: lbl2.text = odDataReader["Cognome"].toString();
Line 31: lbl3.text = odDataReader["Titolo"].toString();
Source File: c:\Inetpub\wwwroot\tesi\dettagli.aspx Line: 29
dove sbaglio?