Autor Beitrag
pepe-je
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 12.09.11 17:06 
Ich möchte eine Zeile aus einem GridView auslesen und in eine DataTable einfügen. Dazu
muß GridViewRow in DataRow konvertiert werden.
Hat jemand einen Rat, wie das zu machen ist?
Schon jetzt vielen Dank.
pepe-je


Moderiert von user profile iconTh69: Topic aus C# - Die Sprache verschoben am Mo 12.09.2011 um 17:13
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Mo 12.09.11 20:47 
Wo kommen denn die Daten des DGV her? Ist dessen DataSource denn nicht bereits eine DataTable?

_________________
>λ=
pepe-je Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mo 12.09.11 22:07 
Das Gridview ist innerhalb einer Methode, die durch Anklicken eines Knotens in einem Treeview aufgerufen wird, nach Filterung eines DataViews gefüllt worden.
Nun muß ich innerhalb einer anderen Methode auf den Inhalt dieses Gridview zugreifen. Das würde einfach gehen, wenn ich den Inhalt in eine DataTable bringe. Dazu muß ich aber
GridViewRow in DataRow
konvertieren. Leider kenne ich das Verfahren dazu nicht.
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Mo 12.09.11 22:55 
Zitat:
nach Filterung eines DataViews gefüllt worden.


Ein DataView hat eine ToTable Methode.
Kha
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 3803
Erhaltene Danke: 176

Arch Linux
Python, C, C++ (vim)
BeitragVerfasst: Mo 12.09.11 23:14 
user profile iconRalf Jansen hat folgendes geschrieben Zum zitierten Posting springen:
Zitat:
nach Filterung eines DataViews gefüllt worden.


Ein DataView hat eine ToTable Methode.
Das sollte gar nicht nötig sein. In DataGridViewRow.DataBoundItem sollte in dem Fall eine DataRowView stecken, in der wiederum die ursprüngliche DataRow steckt. Am besten einfach mal unter dem Debugger nachschauen.

_________________
>λ=
pepe-je Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Di 13.09.11 13:08 
Da ich in ASP.NET arbeite habe ich keine DataGridView sondern eine GridView.
Es bleibt also das Problem, wie GridViewRow in DataRow konvertieren.
Ralf Jansen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 4708
Erhaltene Danke: 991


VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
BeitragVerfasst: Di 13.09.11 13:26 
Das DataItem der GridViewRow sollte ein DataRowView sein wenn du eine DataTable gebunden hast. Die DataRowView hat wiederum ein Row Property mit der DataRow. Das sollte aber eine der ursprünglichen DataRows aus der gebunden Datatable sein. in der andere/neuen Datatable müsstest du also eine Copy importieren (ImportRow) da eine DataRow nur zu einer DataTable gehören darf.
pepe-je Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 23



BeitragVerfasst: Mi 14.09.11 17:55 
Euch allen vielen Dank für die Anregungen
pepe-je