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

XmlDocument Binding - Need Multi-Level XmlNode Support From RadGridView

1 Answer 21 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 13 Mar 2012, 05:05 PM
I need to bind this document to the RadGridView and have a child data template for each row where the parametercollection node exists.  

<!-- edited with XML Spy v3.5 NT (http://www.xmlspy.com) -->
<MethodInformation>
    <tenantid>0</tenantid>
    <namespaceName>BusinessServer.BusinessPolicies.ServiceContractsComponent</namespaceName>
    <className>ServiceContractsBusPolicyMgr</className>
    <methodName>ExtractVouchersAndPostToInvoice</methodName>
    <runAsynchronously>Y</runAsynchronously>
    <autoRestart/>
    <parameters>
        <parameter>
            <name>contractsequencein</name>
            <value/>
        </parameter>
        <parameter>
            <name>subsequencein</name>
            <value/>
        </parameter>
        <parameter>
            <name>billingdatein</name>
            <value/>
        </parameter>
        <parameter>
            <name>requestclosedatein</name>
            <value/>
        </parameter>
        <parameter>
            <name>additionalparametersin</name>
            <parametercollection>
                <parameter>
                    <name>tablename</name>
                    <value/>
                    <name>columnname</name>
                    <value>posting_group</value>
                    <name>columnvalue</name>
                    <value>KL</value>
                </parameter>
            </parametercollection>
        </parameter>
        <parameter>
            <name>theplaceidtobillin</name>
            <value/>
        </parameter>
        <parameter>
            <name>theinvoiceconsolidationruleidin</name>
            <value/>
        </parameter>
    </parameters>
</MethodInformation>

The following code (where strXml variable is the xml as string above) doesn't support viewing the parameters inside of parametercollection element.

                  
XmlDataProvider xProviderResource =
new XmlDataProvider();
XmlDocument xParameterDoc =
new XmlDocument();
xParameterDoc.LoadXml(strXml);      
xProviderResource.IsAsynchronous =
false;          
xProviderResource.Document = xParameterDoc;    
xProviderResource.XPath =
"MethodInformation/parameters/parameter";  
IEnumerable<XmlNode> iXnodeEnum = xProviderResource.Data
as IEnumerable<XmlNode>;
ObservableCollection<XmlNode> obsElementCollection =
new ObservableCollection<XmlNode>(iXnodeEnum);
radGridView2.ItemsSource = obsElementCollection;

We have an ID with telerik support. My company purchased both WPF and ASP.NET AJAX controls.  If someone can provide an email address I will send the ID directly to them so I can get a higher priority support.  

Dan

1 Answer, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 19 Mar 2012, 10:35 AM
Hello,

For more complex hierarchical data stored in XAML I would recommend to parse it into dot net objects and feed RadGridView with these objects. To provide the hierarchy each object should expose an IEnumerable Children property to be used for the child GridViews.
I am attaching a small example . Just for the illustration it uses some primitive XML parsing in order to provide the data in a shape consumable form RadGridView.

In addition : You may ask your license holder to add you as a license developer.

The option to add you to the license is provided in the license holder's account under "Manage Licensed Users". Once you are assigned to a license, you'll be able to access our support ticketing system under "Get Support >> Contact Support Team".
Regards,

Pavel Pavlov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Share this question
or