RAD Combo and RAD Calendar Issue(Object Required)

4 posts, 0 answers
  1. Yuvika
    Yuvika avatar
    36 posts
    Member since:
    Mar 2009

    Posted 30 Dec 2009 Link to this post

     

    Hi, 
     
    I am using the RadComboBox And On ClientSideSelected Index Change I am enabling/disabling the rad Calender.
    It works well if I dont enter any value in radDate Time picker on selected index Change of radCombo. But the problem arises of "Object Required" when the RAD DateTime Picker is filled with the value, and then we fire the RADCombo selected index change.

    This is all What my code is:

    <
    telerik:RadComboBox Width="220px" ID="rcmbFileDate" runat="server" Skin="WebBlue"

     

     

    OnClientSelectedIndexChanged="FileModifyDateLeftBar">

     

     

    <Items>

     

     

    <telerik:RadComboBoxItem runat="server" Text="All files, regardless of date" Value="0" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File last modified before __" Value="1" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File last modified after __" Value="2" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File last modified between __ and __"

     

     

    Value="3" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File created before __" Value="4" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File created after __" Value="5" />

     

     

    <telerik:RadComboBoxItem runat="server" Text="File created between __ and __" Value="6" />

     

     

    </Items>

     

     

    </telerik:RadComboBox>

     

     


    <
    telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpFromDate" runat="server"

     

     

     

     

     

    DateInput-DateFormat="MM/dd/yyyy">

     

     

     

     

     

    </telerik:RadDatePicker>

     

     

     

     

     

    &nbsp;and&nbsp;<telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpTodate"

     

     

     

     

     

    runat="server">

     

     

     

     

     

    </telerik:RadDatePicker>

     

     


    Javascript Code Being Executed:

    function FileModifyDateLeftBar(sender, eventArgs) {

     

     

    var item = eventArgs.get_item();

     

    $find(rdpFromDate).clear();

    $find(rdpTodate).clear();

     

    switch (item.get_value()) {

     

     

    case "0":

     

    {

    $find(rdpFromDate).set_enabled(

    false);

     

    $find(rdpTodate).set_enabled(

    false);

     

     

    break;

     

    }

     

    case "1":

     

    {

    $find(rdpFromDate).set_enabled(

    false);

     

    $find(rdpTodate).set_enabled(

    true);

     

     

    break;

     

    }

     

    case "4":

     

    $find(rdpFromDate).set_enabled(

    false);

     

    $find(rdpTodate).set_enabled(

    true);

     

     

    break;

     

     

    case "2":

     

    {

    $find(rdpFromDate).set_enabled(

    true);

     

    $find(rdpTodate).set_enabled(

    false);

     

     

    break;

     

    }

     

    case "5":

     

    {

    $find(rdpFromDate).set_enabled(

    true);

     

    $find(rdpTodate).set_enabled(

    false);

     

     

    break;

     

    }

     

    case "3":

     

    {

    $find(rdpFromDate).set_enabled(

    true);

     

    $find(rdpTodate).set_enabled(

    true);

     

    }

     

    case "6":

     

    {

    $find(rdpFromDate).set_enabled(

    true);

     

    $find(rdpTodate).set_enabled(

    true);

     

     

    break;

     

    }

    }

    }


    Please review the code below. And let me know what is causing the issue.

    Thanks and Regards,
    Yuvika

     

  2. Dimo
    Admin
    Dimo avatar
    8452 posts

    Posted 30 Dec 2009 Link to this post

    Hello Yuvika,

    Apart from the fact that the Javascript code is missing one break statement, I don't see anything else wrong. The following test page works as expected on my side. Let me know if I am missing something.

    By the way, I recommend you to use the "Format Code Block" tool in the editor when pasting code. Like this:

    <%@ Page Language="C#" %>
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     
    <head id="Head1" runat="server">
    <meta http-equiv="content-type" content="text/html;charset=utf-8" />
    <title>RadControls</title>
    </head>
    <body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" />
     
    <telerik:RadComboBox Width="220px" ID="rcmbFileDate" runat="server" Skin="WebBlue"
        OnClientSelectedIndexChanged="FileModifyDateLeftBar">
        <Items>
            <telerik:RadComboBoxItem runat="server" Text="All files, regardless of date" Value="0" />
            <telerik:RadComboBoxItem runat="server" Text="File last modified before __" Value="1" />
            <telerik:RadComboBoxItem runat="server" Text="File last modified after __" Value="2" />
            <telerik:RadComboBoxItem runat="server" Text="File last modified between __ and __" Value="3" />
            <telerik:RadComboBoxItem runat="server" Text="File created before __" Value="4" />
            <telerik:RadComboBoxItem runat="server" Text="File created after __" Value="5" />
            <telerik:RadComboBoxItem runat="server" Text="File created between __ and __" Value="6" />
        </Items>
    </telerik:RadComboBox>
    <telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpFromDate" runat="server" />
     and 
    <telerik:RadDatePicker Enabled="false" Width="90px" ID="rdpTodate" runat="server" />
     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
     
    Sys.Application.add_load(initVars);
     
    var rdpFromDate;
    var rdpTodate;
     
    function initVars()
    {
        rdpFromDate = "<%= rdpFromDate.ClientID %>";
        rdpTodate = "<%= rdpTodate.ClientID %>";
    }
     
    function FileModifyDateLeftBar(sender, eventArgs)
    {
        var item = eventArgs.get_item();
        $find(rdpFromDate).clear();
        $find(rdpTodate).clear();
        switch (item.get_value())
        {
            case "0":
            {
                $find(rdpFromDate).set_enabled(false);
                $find(rdpTodate).set_enabled(false);
                break;
            }
            case "1":
            {
                $find(rdpFromDate).set_enabled(false);
                $find(rdpTodate).set_enabled(true);
                break;
            }
            case "4":
                $find(rdpFromDate).set_enabled(false);
                $find(rdpTodate).set_enabled(true);
                break;
            case "2":
            {
                $find(rdpFromDate).set_enabled(true);
                $find(rdpTodate).set_enabled(false);
                break;
            }
            case "5":
            {
                $find(rdpFromDate).set_enabled(true);
                $find(rdpTodate).set_enabled(false);
                break;
            }
            case "3":
            {
                $find(rdpFromDate).set_enabled(true);
                $find(rdpTodate).set_enabled(true);
                break;
            }
            case "6":
            {
                $find(rdpFromDate).set_enabled(true);
                $find(rdpTodate).set_enabled(true);
                break;
            }
        }
    }
     
    </script>
    </telerik:RadCodeBlock>
     
    </form>
    </body>
    </html>


    Regards,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Yuvika
    Yuvika avatar
    36 posts
    Member since:
    Mar 2009

    Posted 30 Dec 2009 Link to this post

    Hi Dimo,

    It was just the copy paste problem, that I missed out the break statement, otherwise the code is as what you have written.
    One more thing I would like to bring to your notice is that, my control is in usercontrol and is in update panel. Can this be the root of the problem?
    And it works until I add any text in the rad Calender's textboxes, till then it works as what, the code is expected to do.
    Please see the line of code in telerik where code breaks.
    Reply.

    Thanks,
    Yuvika
  4. Dimo
    Admin
    Dimo avatar
    8452 posts

    Posted 30 Dec 2009 Link to this post

    Hi Yuvika,

    Please prepare a simple runnable demo, which reproduces the problem and send it to us for further investigation.

    Sincerely yours,
    Dimo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top