Due datagrid

venerdì 03 settembre 2004 - 00.46

thevalhalla Profilo | Newbie

Sto cercando di riscrivere questo codice in c#

http://www.dotnethell.it/articles/NestedDatagrid.aspx

ma ottengo questo errore:

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: CS0246: The type or namespace name 'DataRowView'
could not be found (are you missing a using directive or an assembly
reference?)

Source Error:


((DataRowView)Container.DataItem).CreateChildView("CustomerRelation")


inoltre, per questo campo:

<%# DataBinder.Eval(Container.DataItem, "campogenitore") %>

che campo devo utilizzare? di quale tabella?

grazie

GvnnRules Profilo | Senior Member

Hai provato a importare il namespace System.Data ?

using System.Data;

Ciaoz

Gvnn

thevalhalla Profilo | Newbie

già fatto

using system.data;

ma niente...

GvnnRules Profilo | Senior Member

posta un pò più di codice, volendo anche tutto, magari il problema è da un'altra parte ... bo, magari qualcun'altro riesce a darti una mano.

gvnn

thevalhalla Profilo | Newbie

grazie mille

html

Il codice sorgente non è stato renderizzato qui
perchè non c'è sufficiente spazio.
Clicca qui per visualizzarlo in una nuova finestra


Code behind

DsDati = new DataSet(); OleDbCommand myCommandEC = new OleDbCommand("SP_1", myConnection); myCommandEC.CommandType=CommandType.StoredProcedure; OleDbDataAdapter DataAdapt = new OleDbDataAdapter(myCommandEC); OleDbCommand myCommandEC2 = new OleDbCommand("SP_2", myConnection); myCommandEC2.CommandType=CommandType.StoredProcedure; OleDbDataAdapter DataAdapt2 = new OleDbDataAdapter(myCommandEC); DataAdapt.Fill(DsDati, "tabella1"); DataAdapt2.Fill(DsDati, "tabella2"); DataColumn Parent; DataColumn Child; DataRelation CustomerRelation; Parent = DsDati.Tables["tabella1"].Columns["IntestazioneAttivitaProgetto"]; Child = DsDati.Tables["tabella2"].Columns["ID"]; CustomerRelation = new DataRelation("CustomerRelation", Parent, Child, false); DsDati.Relations.Add(CustomerRelation); DataGrid1.DataSource = DsDati.Tables["tabella1"].DefaultView; DataGrid1.DataBind(); myConnection.Close();
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