This is a migrated thread and some comments may be shown as answers.

Insert, update and delte records from xml file

3 Answers 113 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bader
Top achievements
Rank 1
Bader asked on 14 Mar 2011, 09:41 AM

Hello,

I'm a new developer of winforms.
I'm trying to insert, update and delete records from the following xml file using the radgridview control (I'm using the 2009.3.9.1203 version):

"

<?xml version="1.0" encoding="utf-16"?>
<uTemplateData xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://********************************************">
  <GoodData xmlns:dppp2="http://***************************************************************************">
      
    <dppp2:LVPrm>
      <dppp2:Bnr i:nil="true" />
      <dppp2:CCount>2</dppp2:CCount>
      <dppp2:OSV>8542</dppp2:OSV>
      <dppp2:ParentId>0</dppp2:ParentId>
      <dppp2:RMM>2048</dppp2:RMM>
      <dppp2:bName i:nil="true" />
      <dppp2:bFvr>CHK</dppp2:bFvr>
      <dppp2:customSName></dppp2:customSName>
      <dppp2:hst>V42</dppp2:hst>
      <dppp2:mPath i:nil="true" />
      <dppp2:nNames xmlns:dppp4="http://********************************************************">
        <dppp4:string>MyName</dppp4:string>
      </dppp2:nNames>
      <dppp2:nGuids xmlns:dppp4="http://*********************************************************">
        <dppp4:string>My2Name</dppp4:string>
      </dppp2:nGuids>
      <dppp2:pArch>None</dppp2:pArch>
      <dppp2:sType>ATUP</dppp2:sType>
      <dppp2:uUM>false</dppp2:uUM>
      <dppp2:vtName>5u_4{Counter}</dppp2:vtName>
      <dppp2:vtType>mor</dppp2:vtType>
      <dppp2:trIp xmlns:dppp4="http://**********************************************************">
        <dppp4:mAd>73111160</dppp4:mAd>
        <dppp4:mFam>InterNetwork</dppp4:mFam>
        <dppp4:mHsh>0</dppp4:mHsh>
        <dppp4:mNmb xmlns:dppp5="http://*********************************************************">
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
        </dppp4:mNmb>
        <dppp4:mScpId>0</dppp4:mScpId>
      </dppp2:trIp>
      <dppp2:tCrName>ctii_rl</dppp2:tCrName>
      <dppp2:tEName>Nwa</dppp2:tEName>
      <dppp2:tPName>AutoDefault</dppp2:tPName>
    </dppp2:LVPrm>
      
    <dppp2:LVPrm>
      <dppp2:Bnr i:nil="true" />
      <dppp2:CCount>2</dppp2:CCount>
      <dppp2:OSV>8542</dppp2:OSV>
      <dppp2:ParentId>0</dppp2:ParentId>
      <dppp2:RMM>2048</dppp2:RMM>
      <dppp2:bName i:nil="true" />
      <dppp2:bFvr>CHK</dppp2:bFvr>
      <dppp2:customSName></dppp2:customSName>
      <dppp2:hst>V42</dppp2:hst>
      <dppp2:mPath i:nil="true" />
      <dppp2:nNames xmlns:dppp4="http://********************************************************">
        <dppp4:string>MyName</dppp4:string>
      </dppp2:nNames>
      <dppp2:nGuids xmlns:dppp4="http://*********************************************************">
        <dppp4:string>My2Name</dppp4:string>
      </dppp2:nGuids>
      <dppp2:pArch>None</dppp2:pArch>
      <dppp2:sType>ATUP</dppp2:sType>
      <dppp2:uUM>false</dppp2:uUM>
      <dppp2:vtName>5u_4{Counter}</dppp2:vtName>
      <dppp2:vtType>mor</dppp2:vtType>
      <dppp2:trIp xmlns:dppp4="http://**********************************************************">
        <dppp4:mAd>7311160</dppp4:mAd>
        <dppp4:mFam>InterNetwork</dppp4:mFam>
        <dppp4:mHsh>0</dppp4:mHsh>
        <dppp4:mNmb xmlns:dppp5="http://*********************************************************">
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
          <dppp5:uShort>0</dppp5:uShort>
        </dppp4:mNmb>
        <dppp4:mScpId>0</dppp4:mScpId>
      </dppp2:trIp>
      <dppp2:tCrName>ctii_rl</dppp2:tCrName>
      <dppp2:tEName>Nwa</dppp2:tEName>
      <dppp2:tPName>AutoDefault</dppp2:tPName>
    </dppp2:LVPrm>
      
  
  </GoodData>
</uTemplateData>

"
You see that the above xml is more complex than the xml file which supported the radgridview.
So, I'm asking you as new developer of winforms to help me step by step in order to insert, update and delete records from the above xml.

If the radgridview is not intended for supporing such xml files, Please, guide me how to achieve the requirement using another control.

It is appreciated to send me a code with an explaination.

Regards,
Bader

3 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 14 Mar 2011, 12:12 PM
Hello Bader,

I have to ask if you have the possibility to update to the latest version of telerik controls.
My main concern is that even if i help you with a solution, because i don't have the 2009 version a lot of this would not be compatible.

Best Regards,
Emanuel Varga
Telerik WinForms MVP
0
Bader
Top achievements
Rank 1
answered on 14 Mar 2011, 02:19 PM
Hello,

Thank you for your reply,
Unfortunatily, I can't update to the latest version of telerik controls now.
Any way, I will be happy if you send me the solution. I will try it in the trial verion. because, I think I have to update it within the nearest few weeks.

Of course, I'm still looking for a good solution for the 2009.3.9.1203 version.

Regards,
Bader
0
Martin Vasilev
Telerik team
answered on 16 Mar 2011, 05:32 PM
Hi Bader,

Thank you for writing.

RadGridView does not support direct binding to xml data. However, you can implement such a scenario by using a DataSet loaded from xml. You should be aware that RadGridView will be bound to the DataSet, but there is not a way to update the xml source like a database (for example with TableAdapter's Update method). Instead, you should use ReadXml method to load data, and WriteXml to save the changed data. You can find some details in our product documentation.

I also would second the Emanuel's advice for upgrading to the latest version. It contains a lot of bug fixes and improvements and this will allow us to provide you with quicker responses.

Best wishes,
Martin Vasilev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
GridView
Asked by
Bader
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Bader
Top achievements
Rank 1
Martin Vasilev
Telerik team
Share this question
or