HI,
I have several questions about the wingrid and rowedittemplate.
When adding a row to a grid how can I make it so that the wingrid refreshes and put the the added row on its place in the sorting order of the wingrid can this be done with a simple refresh of do I need to do something else.
When using a rowedittemplate is there a possibility to validate the data enter prior to editing the row.
on some of the edittemplates I'm using the key field is a calculated one and needs to be calculated prior to inserting the new row in the database or updating the new row in the database.
in rowtemplates is there a possiblity to have an onchange event or a validate event triggered on the the fields on the template?
How can you set the focus to the first field on the template that is editable?
Grid export to excel, I have a tool in a ribbon that allows when clicked the export a grid to excell but the problem is that my grids are in MDIChilderen so how can i give the right grid to the export function.
Best Regards
Ronny Gilisen
Hi,
Is the ZipCodeID displayed in the grid? Is it in the grid's DataSource?
It seems to me that this field should not be editable in either the grid or the RET. So you should be populating it in the grid's InitializeRow event based on the other two fields.
If you want to update it as the user types then trap the CellChange event of the grid and update the field inside that event based on the current Text of the cell being edited.
rgilbeb said:The second is that when the user selects a country different from Belgium that the ProvinceID field should be disabled.
Similarly, trap the CellChange / InitializeRow and set the Activation property on the ProvinceId field appropriately.
Hi Ronny,
rgilbeb said:When adding a row to a grid how can I make it so that the wingrid refreshes and put the the added row on its place in the sorting order of the wingrid can this be done with a simple refresh of do I need to do something else.
band.SortedColumns.Refresh will refresh the sort order of the rows. Of you can call the RefreshSortPosition on a single row if you know there's only one row out of order.
rgilbeb said:When using a rowedittemplate is there a possibility to validate the data enter prior to editing the row.
There are any number of events you can use for this like BeforeExitEditMode, BeforeCellUpdate, and BeforeRowUpdate on the grid. Or you can use the Validating event of the cell proxies on the RowEditTemplate.
rgilbeb said: on some of the edittemplates I'm using the key field is a calculated one and needs to be calculated prior to inserting the new row in the database or updating the new row in the database. in rowtemplates is there a possiblity to have an onchange event or a validate event triggered on the the fields on the template?
You could set the field value in BeforeRowInsert (which fires after the new row is created) or perhaps BeforeRowUpdate (which fires before the row is committed to the underlying data source.
rgilbeb said:How can you set the focus to the first field on the template that is editable?
Focus will automatically be set to the control corresponding to the cell the user clicked on, or the first control in the tab order if they click on something other than a cell.So you will probably want to set the tab order if you rearranged the controls on the RET.
rgilbeb said:Grid export to excel, I have a tool in a ribbon that allows when clicked the export a grid to excell but the problem is that my grids are in MDIChilderen so how can i give the right grid to the export function.
I'm not sure I understand the question. Do you mean you don't know how to find the grid on the active form? The parent form has a property for ActiveMdiChild you can use to get the active form. Then you access the grid property on that form. You might have to set the grid Modifiers to public so that you can access it from the parent form. Or else expose the grid publicly or internally in some other way.
The problem I'm having is that I have prommactically created a RowedtTemplate and example is a template that allows the user to create and edit Zipcodes. The templates has following Items:
ZIPCodeID
CountryID (Valuelist with all countries)
ProvinceID (Valuelist withh all Belgian Provinces)
Zipcode
City/Locality
The ZIPCodeID is a calculated field which consist of the CountryID (2 Charcter ISO Code) underscore the zipcode and the 3 first characters of the City. I would like to show the ZIPCodeID while the user is filling in the fields it consists of. That is my first problem.
The second is that when the user selects a country different from Belgium that the ProvinceID field should be disabled.
Hello Ronny,
rgilbeb said: When adding a row to a grid how can I make it so that the wingrid refreshes and put the the added row on its place in the sorting order of the wingrid can this be done with a simple refresh of do I need to do something else.
To do this, you would need to handle the AfterRowUpdate event and perform the sorting required in the event handler.
rgilbeb said: When using a rowedittemplate is there a possibility to validate the data enter prior to editing the row.
Please explain what you mean by validating the data prior to editing the row.
You can handle the Validating event of the editors in the RowEditTemplate.