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

Clear All Cells Value and rebind datasource ADODB.Recordset

4 Answers 157 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Kencana
Top achievements
Rank 1
Kencana asked on 09 Sep 2016, 10:04 AM

Hi..Telerik Team

How to clear all cells value after binding a data then reload data. Here's my code.

Class Module

    Public Function GetDataTable(ByVal Query As String) As DataTable
        Dim adapter As New SqlDataAdapter()
        Dim mydt As New DataTable()
        Using Conn As New SqlConnection(DBConnection)
            adapter.SelectCommand = New SqlCommand(Query, Conn)
            adapter.Fill(mydt)
        End Using
        Return mydt
    End Function

---> i use above function to binding data into my grid and succeed

- Click NEW button then clear all cells value just loaded.My code as below

    Me.RadGridView1.DataSource = New DataTable()

- Click LOAD button to load another data

    dim vQstr as string = "SELECT * FROM table"

    RadGridView1.DataSource = objDB.GetDataTable(vQStr)

1. problem is when i load another data, my grid didnt show any data. Please kindly help

2. can manually save gridview data records into database by clicking a button, but user allows to add, edit and delete row before do saving

Thank you

4 Answers, 1 is accepted

Sort by
0
Kencana
Top achievements
Rank 1
answered on 09 Sep 2016, 10:08 AM

Just info.. in VB6 i can use code below to clear my grid and rebind my data as well

msflexgrid1.clear

msflexgrid1.rows = 2

0
Hristo
Telerik team
answered on 09 Sep 2016, 03:26 PM
Hi Kencana,

Thank you for writing.

Before getting to your question, we would like to check something related to your license. Your account shows no purchases and it seems that you have not downloaded the WinForms suite from our site. Since it is our policy to support users in good account standing, I would kindly ask you to give us more details on the license you are using:
- In case you have downloaded it from another site/account, please let us know so that we can update your account and provide you with proper support services; 

- In case you have obtained a copy of our controls through the company you work for, please ask the account holder to add you as a License Developer to the purchase. This will give you full access to the products your company has purchased, to our downloads section, and to our support ticketing system.

Additionally, all your questions will be reviewed according to the license you have. More information on License Developers you can find here: http://www.telerik.com/faq. I have moved your Forum post to our support ticketing system (which is private communication channel) to avoid sharing confidential information in the public Forums. You can find the ticket in Your Telerik Account.

As to your first question, setting the data source to null or to a new DataTable object should be enough to update the grid. The code snippet you sent me appears to be incomplete and I cannot test it. Please send me a sample project according to your setup.
Regarding your other question, please check the following documentation article demonstrating how the database can be updated using ADO.NET: http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
0
Kencana
Top achievements
Rank 1
answered on 10 Sep 2016, 03:27 AM

Hi..Hristo

To clear your doubt.

I am downloaded Telerik from official site (www.telerik.com) since last year. I am stop using Telerik since early of 2016 because of several reasons. then at this moment try to testing Telerik again because interest how RadGrid serve a data. I am still can using Telerik with free trial license on my new computer that downloaded first time.

Anyway from the link http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net you post havent solve the problem.

0
Hristo
Telerik team
answered on 13 Sep 2016, 02:12 PM
Hi Kencana,

Thank you for writing.

The data bound object used to populate the grid records is updated from the grid control. Depending on the chosen approach to interact with your database it is up to you to decide how you will update it.

You can also check the following forum threads discussing a similar topic: I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik by Progress
Check out the Windows Forms project converter, which aids the conversion process from standard Windows Forms applications written in C# or VB to Telerik UI for WinForms. For more information check out this blog post and share your thoughts.
Tags
GridView
Asked by
Kencana
Top achievements
Rank 1
Answers by
Kencana
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or