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. Image for the cookie policy date

An unbound column & GridFilterBar?

Hi, I'm having problems with the filter bar when I want to add an unbound column, like a check box in the front. I block the filter on this column with GridFilterBarCreatingColumnHeader and an e.Cancel then I get an error from SetCellInfo of GridModel.cs: "Specified argument was out of the range of valid values." line ~4582 Basically I'm combining the GDBGwithdropgrids and filterbargrid examples. It works fine if every colmn is bound, but when there's an unbound column it gets pretty tricky. It has something to do with styleinfo's... anyway has anyone done this before to show an example? TIA! Colin

2 Replies

JF Jim Frapper November 20, 2003 02:31 AM UTC

Hey Colin, I had this same feature.... Basically making it look like a bit like the listview control eh?! Here is what I did: Since the filterbar doesn't play well with Dataviews at the moment. I got my datatable, filtered it, sorted it, with a dataview. Then added those records to a datatable such as. this.filteredAppointments.Columns.Add("Checked",Type.GetType("System.Boolean") ); this.filteredAppointments.Columns.Add("AppointmentTime",Type.GetType("System.String") ); this.filteredAppointments.Columns.Add("AppointmentDate", Type.GetType("System.String")); this.filteredAppointments.Columns.Add("StartTime",Type.GetType("System.String") ); this.filteredAppointments.Columns.Add("Guest", Type.GetType("System.String")); this.filteredAppointments.Columns.Add("Student", Type.GetType("System.String")); this.filteredAppointments.Columns.Add("StudentID", Type.GetType("System.Int32")); this.filteredAppointments.Columns.Add("AppointmentID", Type.GetType("System.Int32")); Notice the first column is the only one not in my original dataview. In order to have it function more like a listview I also made the checkbox column the only column that can be entered and changed. Like so... this.grdAppointments.Binder.InternalColumns[0].StyleInfo.ReadOnly = false; this.grdAppointments.Binder.InternalColumns[0].StyleInfo.CellType = "CheckBox"; All other columns: this.grdAppointments.Binder.InternalColumns[1].StyleInfo.CellType = "Static";


CL Colin Lamarre November 20, 2003 10:57 AM UTC

Hi Jim, ok I guess I can go that route. Thanks, Colin

Loader.
Up arrow icon