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

Sorting based on Boolean Column

3 Answers 309 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 20 Jul 2007, 08:37 AM
Hi,

I added boolean column to the grid. Is it possible to sort it so the boolean with tick will be at the top position? I tried but failed.
Thanks so much

Second: I got 10 columns and ReadOnly=True for column 0-5. I figured out that I cannot sort from column 6-9, Am I wrong? If i make them readonly=false, I can sort from any column.

Third: my grid is not bound to dataset, I enable the tick in BOOL Column but if i sort it the tick is gone. What happen?

Thanks for all your help.

3 Answers, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 20 Jul 2007, 04:58 PM
Hi eriksurya,

Thanks for the feedback.

Currently we do not offer support of unbound columns in RadGridView. In Q2 release we will add events and  API to work in unbound mode. Sorry for the inconvenience.

Please change your business logic and use the IBindingList object. If you continue to have a problem, please send us a simple project.

Regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Erik
Top achievements
Rank 1
answered on 25 Jul 2007, 11:45 AM
So,
How to use booleancolumn in Grid and checked for desired value?
Thanks
0
Julian Benkov
Telerik team
answered on 25 Jul 2007, 04:08 PM
Hi eriksurya,

you can add a memory DataTable object with bool type columns or BindingList<T> object, where the T object has some bool property. I hope the following snippet will be helpful:

DataTable table = new DataTable(); 
 
table.Columns.Add("Column1"); 
table.Columns.Add("Column2"); 
table.Columns.Add("Column3",typeof(bool)); 
 
DataRow row = table.NewRow(); 
row["Column1"] = "1"; 
row["Column2"] = "2"; 
row["Column3"] = false; 
table.Rows.Add(row); 
 
row = table.NewRow(); 
row["Column1"] = "4"; 
row["Column2"] = "5"; 
row["Column3"] = true; 
table.Rows.Add(row); 
 
gridView.DataSource = table

public class Customer 
    private string name; 
    private string address; 
    private double sum; 
    private bool active = true
 
    public bool Active 
    { 
        get { return active; } 
        set { active = value; } 
    } 
 
 
    public string Name 
    { 
        get { return name; } 
        set { name = value; } 
    } 
    
 
    public string Address 
    { 
        get { return address; } 
        set { address = value; } 
    } 
     
    public double Sum 
    { 
        get { return sum; } 
        set { sum = value; } 
    } 
 
     
 
BindingList<Customer> customers = new BindingList<Customer>(); 
Customer cust = new Customer(); 
cust.Name = "Ivan Petrov"
cust.Address = "Kalinka 6"
cust.Sum = 5500
customers.Add(cust); 
 
gridView.DataSource = customers
 


Kind regards,
Julian Benkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
GridView
Asked by
Erik
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Erik
Top achievements
Rank 1
Share this question
or