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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Complex Databinding Issues

Thread ID:

Created:

Updated:

Platform:

Replies:

2810 Feb 14,2003 12:51 PM UTC Feb 14,2003 02:26 PM UTC WinForms 1
loading
Tags: GridControl
Jeff De Roche
Asked On February 14, 2003 12:51 PM UTC

I am using the GridDataboundGrid and wish to bind to a table on my SQL server. Here is the issue: several row validation rules must be considered BEFORE any updates / inserts / deletes are done. For example, before an insert, I must ensure that certain columns in a row contain a certain value; and before a delete, I must ensure that ALL column values in a row are deleted, else, the delete should not fire. I will also be colorizing rows to indicate several row situations. My question is, can I facilitate these requirements using databinding? If so, in what event would it be best to include the validation checks (keeping in mind that the user might be modifying only a single cell, or a range of cells), and then process either the update / delete / insert? I am not using any of the wizardry to create my SQL connection, adapter, dataset, parameters or commands, as I have several dynamic values that must be used. (I have attached a txt version of my code) On a side note, I have a checkbox control in one of my columns and wish to save its value to the database with a '0' or '1' value, depending on its state, however, I keep getting an message that a or value is passing through. How can I avoid this? Thanks for any assistance.

Administrator [Syncfusion]
Replied On February 14, 2003 02:26 PM UTC

> I am using the GridDataboundGrid and wish to bind to a table on my SQL server. Here is the issue: several row validation rules must be considered BEFORE any updates / inserts / deletes are done. For example, before an insert, I must ensure that certain columns in a row contain a certain value; and before a delete, I must ensure that ALL column values in a row are deleted, else, the delete should not fire. I will also be colorizing rows to indicate several row situations. > For colorizing you should handle PrepareViewStyleInfo. > My question is, can I facilitate these requirements using databinding? If so, in what event would it be best to include the validation checks (keeping in mind that the user might be modifying only a single cell, or a range of cells), and then process either the update / delete / insert? > You can do validate the row in the RowLeave event. If the row was edited (Binder.IsEditing) then you could validate all columns and if some do not meet the criteria you set e.Cancel = true. For deleting values I am not exactlty sure. There are two events related to deleting cells or rows: Model.ClearingCells and GridDataBoundGrid.RowsDeleting / GridDataBoundGrid.RowsDeleted. Try them and see what better fits you. > On a side note, I have a checkbox control in one of my columns and wish to save its value to the database with a '0' or '1' value, depending on its state, however, I keep getting an message that a "true" or "false" value is passing through. How can I avoid this? > Do this: style = model.BaseStylesMap["Standard"].StyleInfo; style.CheckBoxOptions.CheckedValue = "1"; style.CheckBoxOptions.UncheckedValue = "0"; Stefan

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.

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

;