473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DataGrid and XML document

I load a XML document in the DataGrid:

private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();

m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;

This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when

m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");

is done and MyDocument.xml is corrupted. Is there a way to avoid this?

-JK
Nov 16 '05 #1
4 5868
Jussi wrote:
I load a XML document in the DataGrid:

private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();

m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;

This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when

m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");

is done and MyDocument.xml is corrupted. Is there a way to avoid this?


http://www.syncfusion.com/FAQ/WinFor...c44c.asp#q653q

Cheers

Arne Janning
Nov 16 '05 #2
Hi,

When I read from a XML Document and assign -

DataSet.ReadXml(@"C:\Abc.Xml",XmlReadMode.Auto);
DataGrid.DataSource = DataSet;

I get the DataGrid filled, but the data is not filled in the datagrid. It
shows Table Name as a link, on clicking of which the grid is filled. Even
the DataGrid.Expand(-1) do not expand the rows.

Is there any way for this?

Thanks

Thejus

"Jussi" <a.*@a.com> wrote in message news:ee**************@TK2MSFTNGP09.phx.gbl...
I load a XML document in the DataGrid:

private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();

m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;

This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when

m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");

is done and MyDocument.xml is corrupted. Is there a way to avoid this?

-JK



Nov 16 '05 #3
Hi,

Add eventhandler for event CurCellChange of the datagrid control and see if the current row value is greater thatn your data size.
If yes, then discard the change (focus back to earlier selected row/cell).

HTH,
Ashutosh
"Thejus" <th*************@hotmail.com> wrote in message news:uh**************@tk2msftngp13.phx.gbl...
Hi,

When I read from a XML Document and assign -

DataSet.ReadXml(@"C:\Abc.Xml",XmlReadMode.Auto);
DataGrid.DataSource = DataSet;

I get the DataGrid filled, but the data is not filled in the datagrid. It
shows Table Name as a link, on clicking of which the grid is filled. Even
the DataGrid.Expand(-1) do not expand the rows.

Is there any way for this?

Thanks

Thejus

"Jussi" <a.*@a.com> wrote in message news:ee**************@TK2MSFTNGP09.phx.gbl...
I load a XML document in the DataGrid:

private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();

m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;

This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when

m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");

is done and MyDocument.xml is corrupted. Is there a way to avoid this?

-JK

Nov 16 '05 #4
Hi,

use following statement after populating the datagrid with the dataset.
dataGrid2.NavigateTo(0,"<your table name>");

-Ashutosh

"Thejus" <th*************@hotmail.com> wrote in message news:uh**************@tk2msftngp13.phx.gbl...
Hi,

When I read from a XML Document and assign -

DataSet.ReadXml(@"C:\Abc.Xml",XmlReadMode.Auto);
DataGrid.DataSource = DataSet;

I get the DataGrid filled, but the data is not filled in the datagrid. It
shows Table Name as a link, on clicking of which the grid is filled. Even
the DataGrid.Expand(-1) do not expand the rows.

Is there any way for this?

Thanks

Thejus

"Jussi" <a.*@a.com> wrote in message news:ee**************@TK2MSFTNGP09.phx.gbl...
I load a XML document in the DataGrid:

private System.Windows.Forms.DataGrid myDataGrid = new DataGrid();
private DataSet m_myDataSet = new DataSet();

m_myDataSet.ReadXml(@"C:\...\MyDocument.xml");
myDataGrid.DataSource = m_myDataSet;

This works fine and user can edit the loaded document. The problem is that I
don't want to give possibility to change the structure of the
MyDocument.xml. User should only change data in the already existing fields.
In the DataGrid user can create for example new rows and these are saved to
the MyDocument.xml when

m_myDataSet.WriteXml(@"C:\...\MyDocument.xml");

is done and MyDocument.xml is corrupted. Is there a way to avoid this?

-JK

Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my...
0
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my...
2
by: Bruce W.1 | last post by:
There's something I can't figure out. I added some javascript behavior to my datagrid, just like in this article, except in C# instead of VB: ...
1
by: Doug D via .NET 247 | last post by:
I really really need some insight on this problem I am trying to bind a strongly typed collection object to a datagrid. I already Inherited CollectionBase, but .NET says that it cannot find my...
1
by: msnews | last post by:
Hi -- I'm very, very new to ASP.Net, and I've been trying for several days to figure out how to update a datagrid AND refresh it on the client side so that the page doesn't refresh. I've torn my...
2
by: Javier | last post by:
Hi Everyone, I have a dynamic checkbox in a datagrid that uses the ITemplate interface and has the checkchanged event wired up. When the checkbox is checked, the event event handler that...
1
by: tshad | last post by:
I need to do some work with Javascript and my datagrid controls. I want to do something like: ********************************************************* function CheckQuestion() { var checkBox...
2
by: Mike Baugh | last post by:
I am using visual studio 2005 to develop a form using c# I have 3 datagrids on one form. I can set the row color based on a certain value in a column. However this color applies to all 3...
7
by: julian.tklim | last post by:
Hi, I need to build an editable Datagrid with add & delete buttons on each row using javascript. DataGrid need not be pre-populated with values. To make the thing complicated, one of the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.