Building a RadDatePicker custom column editor for RadGrid

9 posts, 0 answers
  1. Hristo Deshev
    Hristo Deshev avatar
    16 posts
    Member since:
    May 2004

    Posted 11 May 2006 Link to this post


    Requirements

    RadGrid for ASP .NET version


    RadCalendar for ASP .NET version

    3.2 and later


    1.6 and later

    RadControls for ASP .NET AJAX version

    2008.1.415 and later

    .NET version

    1.x (RadGrid and RadCalendar for ASP .NET)


    2.0 and later (RadControls for ASP .NET AJAX)

    Visual Studio version

    2003 (RadGrid and RadCalendar for ASP .NET)


    2005 and later(RadControls for ASP .NET AJAX)

    Programming language

    VB, C#

    Browser support

    all supported by RadGrid and RadCalendar for ASP .NET


    all browsers supported by RadControls for ASP .NET AJAX

     
    The RadGrid control supports building your own custom column editors.  These are ideal if you want to customize your users' editing experience.

    A custom column editor has to inherit from one of the base editor classes, our example will inherit from GridTextColumnEditor.  The two most important methods that have to be overriden are AddControlsToContainer and LoadControlsFromContainer.  The former has to create the editor's controls and add them to the container's controls collection.  The latter extracts information from the container's controls:

    Protected Overrides Sub AddControlsToContainer()
        picker = New RadDatePicker
        picker.ID = "editPicker"
        ContainerControl.Controls.Add(picker)
    End Sub

    Protected Overrides Sub LoadControlsFromContainer()
        picker = ContainerControl.Controls(0)
    End Sub


    The tricky part is to remember to set an ID to all controls that you create.  This is generally a good ASP.NET programming practice and can save you a lot of hunting for postback events not being fired and viewstate not being loaded.
     

  2. Richard Fan
    Richard Fan avatar
    1 posts
    Member since:
    Jul 2006

    Posted 19 Sep 2006 Link to this post

    It works! I met another issue: the date will automatically set as 1/1/1980 if user leave the datepicker blank. How can I make the date = null in this case?
  3. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 20 Sep 2006 Link to this post

    Hi Richard,

    We have attached the sample application we sent you in the support ticket you opened on the same topic.

    I hope it will serve as a future reference for other telerik clients too.


    Best wishes,
    Manuel

    the telerik team
  4. Ningo
    Ningo avatar
    12 posts
    Member since:
    Jan 2007

    Posted 06 Dec 2007 Link to this post

    Hi!

    is there a Demo-Project for c# also?

    Thank you!
  5. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 07 Dec 2007 Link to this post

    Hi Ningo,

    We have attached a C# project that achieves the same functioanlity (also attached is a calendar hotfix build that fixes some apperance issues with datepickers within grid edit item templates).

    Hope this helps.


    Kind regards,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  6. Ningo
    Ningo avatar
    12 posts
    Member since:
    Jan 2007

    Posted 07 Dec 2007 Link to this post

    Thank you!

    Just for your Information:

    If i try to run the Demo Code i get the errormessage

    System.InvalidOperationException: This control is compiled for ASP.NET 1.x. Please use the ASP.NET 2.0 native version: RadGrid.Net2.dll



    Ningo
  7. Giuseppe
    Admin
    Giuseppe avatar
    2363 posts

    Posted 07 Dec 2007 Link to this post

    Hi Ningo,

    The attached project is a C# project for .Net 1.x as the original project was for that framework version and you have not indicated a preferred .Net version. However, there is nothing specific to .Net1.x here so you should be able to easily convert the project to a .Net2.0 website.

    Let us know if you have any problems.


    All the best,
    Manuel
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  8. Matthew
    Matthew avatar
    1 posts
    Member since:
    Jul 2008

    Posted 10 Jul 2008 Link to this post

    Hi, I am using RadUpload version 2.3.2 in VS 2003.  My site works fine when I set the .NET CLR version in IIS to 1.1.  It breaks, however, with the following error message, when I set the CLR version to 2.0.

    "This control is complied for ASP.NET 1.x. Please use the ASP.NET 2.0 native version"

    I need to use 2.0 framework, and I saw that someone else had run into the same problem.  What is the solution to this problem?

    Thank you in advance.

    Stack trace:

    [InvalidOperationException: This control is complied for ASP.NET 1.x. Please use the ASP.NET 2.0 native version: RadUpload.Net2.dll]
       Telerik.RadUploadUtils.RadControl.OnInit(EventArgs e) +101
       Telerik.WebControls.RadUpload.OnInit(EventArgs e) +10
       System.Web.UI.Control.InitRecursive(Control namingContainer) +321
       System.Web.UI.Control.InitRecursive(Control namingContainer) +198
       System.Web.UI.Control.InitRecursive(Control namingContainer) +198
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +834
  9. Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 11 Jul 2008 Link to this post

    Hi Matthew,

    You can use RadUpload.Net2.dll for .NET 2.0.

    Greetings,
    Vlad
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
Back to Top