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

Using RadGridView and BindingNavigator

9 Answers 296 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Derek
Top achievements
Rank 1
Derek asked on 16 Oct 2008, 04:17 PM
Hi,
All I want to do is save any changes that I make to my RadGridView. I have tried using the BindingNavigator but the buttons don't seem to work. I also set the connection and datasource dynamically, which is SQL Server (I couldn't add the connection the way you did in your tutorial as it was access, but for some reason I couldn't chose SQL Server or any ODBC connection either). 

I'm new to WinForms, so maybe it's just inexperience but any help would be great, all I want to do is Add, Update and Delete!

Thanks a lot.

9 Answers, 1 is accepted

Sort by
0
Nick
Telerik team
answered on 17 Oct 2008, 06:25 PM
Hello Derek,

Thank you for you questions.

Select the gridview - from the property grid on the right open the drop down window of the DataSource property. Then click on Add Project Data Source link and follow the wizard. There is an ODBC connection. 

Changes in the gridview are automatically reflected to your datasource (add, update, delete).

You can find more details on these actions in the documentation.

Do not hesitate to contact me back if you need further assistance.

Regards,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 20 Oct 2008, 08:47 AM
Thanks for the reply. I don't see but an ODBC connection, but that's not my problem anymore. I dynamically set the datasource, so how do I programmatically set Inser, update and delete ? 

Thanks for all your help.

Derek.

0
Nick
Telerik team
answered on 20 Oct 2008, 04:24 PM
Hi Derek,

The answer to your question depends on the datasource you use. Provided that you use a dataset the next paragraph will be of help to you:

The changes in the grid reflects immediately in your datasource (this is applicable for all datasources) so you have to persist your datasource. Please refer to the following external page. There is a DataSet example with a demonstration how to use the someadapter.Update(DataSet, ...) method which you may call at the end of your application. All changes including deletion and adding will be updated from your from your datasource (the DataSet) to your database after calling the Update method.

In short, you have to persist only your DataSource - dataset, ArrayList, BindingList, etc. The grid will always be syncronized with the datasource - two-way (visual appearing items with the items in your datasource). But you should decide when to update the database in the disconnected model employed by the DataSet - namely calling the updated method of your adapter.

If this is not an answer to your question, please open a support ticket and send us a sample application. Also do not hesitate to ask me further questions.
 

Sincerely yours,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 21 Oct 2008, 11:29 AM
hi, thanks for the reply but the link appears to be broken.
0
Nick
Telerik team
answered on 21 Oct 2008, 03:24 PM
Hello Derek,

Sorry for the inconvenience. Here is the correct external link.

Greetings,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 22 Oct 2008, 09:44 AM
Thanks for that but I am trying to get the BindingNavigator working with the RadGridView. So for example instead of clicking 'Click here to add a new row' I want to code the 'new' button to insert a new row.

Thanks for your help.
0
Nick
Telerik team
answered on 23 Oct 2008, 02:13 PM
Hello Derek,

Set the radGridView DataSource property and BindingNavigator BindingSource to the same binding source. Then the arrow buttons, the delete button, and the add button should work. Pressing the add button (plus sign) form the BindingNavigator creates an empty row which is moved to the bottom of the gridview and gets selected.

If you want to turn off the "Click here to add a new row" message (and the feature as a whole), please set MasterGridViewTemplate.AllowAddNewRow to false. This will disable adding new rows through "Click here to add a new row", but you will be able to add rows through the BindingNavigator add button.

I have attached a sample project. Do not hesitate to contact me back if you have further questions.
 
 
Greetings,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Derek
Top achievements
Rank 1
answered on 23 Oct 2008, 02:45 PM

That fixed my problem, thanks, however your example doesn't work in Visual Basic 2008 express. What was the example developed in ?


Thanks
Derek.

0
Nick
Telerik team
answered on 24 Oct 2008, 11:03 AM
Hello Derek,

I am glad that your application works now. The sample project was developed on Visual Studio Profesional 2005 SP1.

Do not hesitate to contact me if you have further questions.

Best wishes,
Nick
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
GridView
Asked by
Derek
Top achievements
Rank 1
Answers by
Nick
Telerik team
Derek
Top achievements
Rank 1
Share this question
or