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

Adding custom control to grid

7 Answers 158 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Tooraj
Top achievements
Rank 1
Tooraj asked on 23 Oct 2010, 05:56 AM
Hi all,
I have a custom calendar which is derived from GridViewDateColumn. I don't know in whic method I must determine type of the Editor.
class MyCalendar:GridViewDateColumn 
{
public override CreateEditor()
{
  Create Editor as MyCalendar;
}
}
Please just write the code which works. I've seen the "Customizing Editors" part of GridView help but it's sample explains EditorRequired event while I  want to add a new column by clicking a button with the type MyCalendar.
Thank you.

7 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 23 Oct 2010, 09:14 PM
Hello Tooraj,

I have a question, i was looking at your problem FADateTimePicker, and was wondering, is it something different in that datetimepicker other than it having a different culture?


Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 24 Oct 2010, 06:45 AM
Hi Emanuel,
the calendar shows date for US. I set it to persian using CultureInfo to "fa-IR" before ApplicationRun().
Do you have the Farsi Library? I think that the problem is that if we want to add a column to RadGrid  it must return RadObject type while FADatePicker returns its own type, am I right?
I'm waiting for your answer and I'm ready to reply any question you need to answer.
Thank you Emanuel, My project completion highly depends on adding this component to my RadGrid.

0
Svett
Telerik team
answered on 28 Oct 2010, 07:59 AM
Hi Tooraj,

If you want to replace the default editor of the column, you need to override the GetDefaultEditorType method of GridViewDataColumn inheritor (in your case this is the GridViewDateTimeColumn):

public class GridViewCalendarColumn : GridViewDateTimeColumn
{
    public override Type GetDefaultEditorType()
    {
        // return the type of your editor here
        return base.GetDefaultEditorType();
    }
}

All the best,
Svett
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Emanuel Varga
Top achievements
Rank 1
answered on 28 Oct 2010, 08:12 AM
Hello Svett,

He want's to use another control for editing the grid, a custom control named FADateTimePicker, and I've provided a solution for this in this thread but he failed to say if that is what he wanted...

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 30 Oct 2010, 06:20 AM
Hi Emanuel,
I tried this code:
public class MyFADatePickerCol: GridViewDateTimeColumn
{
    public override Type GetDefaultEditorType()
    {
        // return the type of your editor here
                     FADatePicker f=new FADatePciker;
                        returtn f.GetType();
    }
public MyFADatePickerCol():base("Col1")
{
}
}
MyFADatePickerCol mycol=new MyFADatePickerCol();
radGridView1.Columns.Add(mycol);
But FADatePicker does not appear in the Grid.
Please help me.

0
Emanuel Varga
Top achievements
Rank 1
answered on 30 Oct 2010, 03:32 PM
Hello Tooraj,

Can we please have this conversation on a single thread? it's getting pretty hard to follow in 10 different threads....

Best Regards,
Emanuel Varga
0
Tooraj
Top achievements
Rank 1
answered on 31 Oct 2010, 06:45 AM
Sorry, of course but please put thread's link and I will go to that thread.
In addition I want to have a column of textbox type which shows an ellispsis that by clicking on it a fom appears.
Tags
GridView
Asked by
Tooraj
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
Tooraj
Top achievements
Rank 1
Svett
Telerik team
Share this question
or