We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add to detail manually

Thread ID:

Created:

Updated:

Platform:

Replies:

149968 Dec 16,2019 02:25 PM UTC Dec 17,2019 12:42 PM UTC WinForms 1
loading
Tags: SfDataGrid
Jeff
Asked On December 16, 2019 02:25 PM UTC

Using a sfDataGrid, using master/detail.  Pulling in information from my WooCommerce site.  Two things I am having trouble doing:

1) I want to remove some columns in the details section

2) The details section is not automatically adding data that I retrieve.  Such as the billing information.  How can I add this to my dictionary so that it's included in the datasource? Here is my code:

Dim baseUrl = "https://www.example.com/wp-json/wc/v3/"
        Dim key = "ck_1234"
        Dim secret = "cs_1234"
        Dim rest As RestAPI = New RestAPI(baseUrl, key, secret, False)
        Dim wc As WCObject = New WCObject(rest)
        'Dim orders = Await wc.Order.GetAll
        Dim orders = Await wc.Order.GetAll(New Dictionary(Of String, String) From {
        {"per_page", "100"}
})



Attachment: billing_c6daa5e4.zip

Susmitha Sundar [Syncfusion]
Replied On December 17, 2019 12:42 PM UTC

Hi Jeff, 
 
Thank you for using Syncfusion controls. 
  
Please find the details for your reported queries. 
 
Query 1: I want to remove some columns in the details section 
 
You can get the DetailsViewGrid from GetDetailsViewGrid() method. And then you can remove the columns from that grid. Please refer the below code snippet, 
 
VB#: 
Private Sub RemoveButton_Click(ByVal sender As Object, ByVal e As EventArgs) Handles RemoveButton.Click 
       Dim detailViewGrid = sfDataGrid1.GetDetailsViewGrid(2) 
       detailViewGrid.Columns.RemoveAt(1) 
       sfDataGrid1.TableControl.Invalidate() 
End Sub 
 
Query 2: The details section is not automatically adding data that I retrieve 
 
You can add new data to the DetailsViewDataGrid data source. Please refer the below code snippet, 
 
VB#: 
Private Sub AddNewRow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click 
       Dim orderDetails = New OrderDetails(10000, 12, 23, 5, 10, "ALFKI", New Date(2019, 12, 17)) 
       Dim detailViewGrid = sfDataGrid1.GetDetailsViewGrid(2) 
       Dim collection As ObservableCollection(Of OrderDetails)=TryCast(detailViewGrid.DataSource, ObservableCollection(Of OrderDetails)) 
       collection.Add(orderDetails) 
End Sub 
 
We have checked this with our 17.3.0.14 version. Its works fine from our end.  
We have prepared the sample for the same, please refer the below sample and let us know if you need further assistance. 
 
 
Regards, 
Susmitha S 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon