D
Diego TERCERO
Hi...
I'm working on a tool for editing text resources for a family of software
product my company produces.
These text resources are found in a SQL Server database, in a table called
"Resource" with the following structure :
Resource{[id],en,fr,es}
Yes.. these are the only languages supported actually.
A couple of rows in that table would look like this :
id | en | fr | es |
0000001 | Open |Ouvrir | Abrir |
0000002 | Close | Fermer | Cerrar |
etc...
I have a DataSet object, that I have filled with a SqlDataAdapter,
therefore, the first table of my Dataset is called "Resource" and has
exactly the same structure than the Table in the database.
I have a ListBox component that uses this DataSet as its DataSource. Its
DataMember property is the "Resource" table and its display member depends
on which is the primary display language that the user has chosen.
So the typical display of this listbox, if the user has chosen 'en' would be
:
Open
Close
.....
Then, when a user selects one of the list items, I use the selected row to
fill a DataGrid component in order to allow the user to edit all language
versions of the resource in a DataGrid.
Now here comes my problem. If I use a filtered version of this DataSet as
the DataSource of my DataGrid (for example a DataViewManager), the grid will
have exactly the same look than the table I have shown above. That doesn't
work for me, cause some resources could be very long error messages,
therefore, I would like to show each column of the table as a row in the
datagrid, something like this (assuming that I have chosen the item 0000001
Language | Value
en | Close
fr | Fermer
es | Cerrar
As for now, I have manually done this transformation by creating a table
called "ResourceItem" in the DataSource bounded to my DataGrid which I fill
by looping on the columns of the selected row. Here's a sample :
foreach(DataColumn col in drSelectedRow.Tables["Resource"].Columns){
DataRow newGridRow = dsGridDataSet.Tables["ResourceItem"].Rows.NewRow();
newGridRow["Language"] = col.ColumnName;
newGridRow["Value"] = drSelectedRow[col].ToString();
dsGridDataSet.Add(newGridRow);
}
I don't like this solution 'cause it's finally not a matter of datastructure
but a matter of display. I just would like to be able to show the columns of
my original DataSet as rows in my DataGrid. Any idea how can I achieve that
?
Thanxs,
Diego
P.S. : I'm aware of the cool ways to manage Globalization in .Net and
resource files, but this is not my question. The purpose of my tool is to
edit resource files for legacy software programmed in VB6 or in ASP 4.0. So
the edition of resources is to be done with this tool I'm working on in C#
but the edited resource files are intended to be used by other older
software.
I'm working on a tool for editing text resources for a family of software
product my company produces.
These text resources are found in a SQL Server database, in a table called
"Resource" with the following structure :
Resource{[id],en,fr,es}
Yes.. these are the only languages supported actually.
A couple of rows in that table would look like this :
id | en | fr | es |
0000001 | Open |Ouvrir | Abrir |
0000002 | Close | Fermer | Cerrar |
etc...
I have a DataSet object, that I have filled with a SqlDataAdapter,
therefore, the first table of my Dataset is called "Resource" and has
exactly the same structure than the Table in the database.
I have a ListBox component that uses this DataSet as its DataSource. Its
DataMember property is the "Resource" table and its display member depends
on which is the primary display language that the user has chosen.
So the typical display of this listbox, if the user has chosen 'en' would be
:
Open
Close
.....
Then, when a user selects one of the list items, I use the selected row to
fill a DataGrid component in order to allow the user to edit all language
versions of the resource in a DataGrid.
Now here comes my problem. If I use a filtered version of this DataSet as
the DataSource of my DataGrid (for example a DataViewManager), the grid will
have exactly the same look than the table I have shown above. That doesn't
work for me, cause some resources could be very long error messages,
therefore, I would like to show each column of the table as a row in the
datagrid, something like this (assuming that I have chosen the item 0000001
Language | Value
en | Close
fr | Fermer
es | Cerrar
As for now, I have manually done this transformation by creating a table
called "ResourceItem" in the DataSource bounded to my DataGrid which I fill
by looping on the columns of the selected row. Here's a sample :
foreach(DataColumn col in drSelectedRow.Tables["Resource"].Columns){
DataRow newGridRow = dsGridDataSet.Tables["ResourceItem"].Rows.NewRow();
newGridRow["Language"] = col.ColumnName;
newGridRow["Value"] = drSelectedRow[col].ToString();
dsGridDataSet.Add(newGridRow);
}
I don't like this solution 'cause it's finally not a matter of datastructure
but a matter of display. I just would like to be able to show the columns of
my original DataSet as rows in my DataGrid. Any idea how can I achieve that
?
Thanxs,
Diego
P.S. : I'm aware of the cool ways to manage Globalization in .Net and
resource files, but this is not my question. The purpose of my tool is to
edit resource files for legacy software programmed in VB6 or in ASP 4.0. So
the edition of resources is to be done with this tool I'm working on in C#
but the edited resource files are intended to be used by other older
software.