Can't load Custom variables on the new version

5 posts, 0 answers
  1. dlee
    dlee avatar
    6 posts
    Member since:
    May 2008

    Posted 05 May 2008 Link to this post

    I cant' load custom variable to inlineinsert after purchasing the new version of Rad Control

    Code as following

    </BDP:BasicDatePicker>

    <telerik:RadScheduler runat="server" ID="RadScheduler1"

    Width="100%" Skin="Office2007" EnableEmbeddedSkins="True"

    DayStartTime="04:00:00" DayEndTime="18:00:00"

    DataSubjectField="Subject"

    DataStartField="Start" DataEndField="End"

    DataSourceID="dbAppointment"

    DataKeyField="AppointmentID"

    Height="620px" CustomAttributeNames="InvoiceId,PatientId,PatientFullName,TreatmentTypeId,Description,AppointmentId" >

    <

    InlineInsertTemplate>

    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%" TextMode="MultiLine" Height="40px">

    </asp:TextBox> <br />

    Patient:

    <asp:DropDownList ID="ddPatient" runat="server"

    DataSourceID="SelPatientByCurrentUserId" DataTextField="PatientFullName"

    DataValueField="PatientId" SelectedValue='<%# Bind("PatientId") %>'>

    </asp:DropDownList>

    Treatment:

    <asp:DropDownList ID="ddTreatmentType" runat="server"

    DataSourceID="SelTreatmentTypeByUserUIForDoctor" DataTextField="Description"

    DataValueField="TreatmentTypeId" SelectedValue='<%# Bind("TreatmentTypeId") %>'>

    </asp:DropDownList>

    <hr />

    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">

    <asp:Image runat="server" ID="insertImage" ImageUrl="~/Images/OfficeUser/Okay.gif" AlternateText="Confirm" />

    </asp:LinkButton>

    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">

    <asp:Image runat="server" ID="Image2" ImageUrl="~/Images/OfficeUser/Cancel.gif" AlternateText="Cancel" />

    </asp:LinkButton>

    </InlineInsertTemplate>

    I am getting "ddPatient" has a selectedvalue which is invaild because it does not exist in the list of items

  2. dlee
    dlee avatar
    6 posts
    Member since:
    May 2008

    Posted 05 May 2008 Link to this post

    Just on the side note.. I was able to get my code working using the demo dll..
    But it all screwed up in the production version of dll
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 07 May 2008 Link to this post

    Hi dlee,

    Actually the error is caused by the DropDownList and RadioButtonList controls. If you set their SelectedValue property to a value which does not exist in their Items list you will receive the error.

    The error occurs only when an appointment is inserted, because only then there is no value which can be selected in the respective control, be it a DropDownList or a RadioButtonList. Fortunately, you can remove the SelectedValue attribute of the control and hook to the OnAppointmentCommand event of the RadScheduler. In the event handler you can check whether an appointment is being inserted, find the target control if so and set its default selection to let say the first Item in its list. The code in the event handler should look like this:

        protected void RadScheduler1_AppointmentCommand(object sender, Telerik.Web.UI.AppointmentCommandEventArgs e) 
        { 
            if (e.CommandName == "Insert"
            { 
                DropDownList dropDownList1 = e.Container.FindControl("dropDownList1"as DropDownList; 
     
                dropDownList1.SelectedIndex = 0; 
            } 
        } 

    And the definition of the DropDownList should be similar to the following:
                   <asp:DropDownList 
                        ID="DropDownList1" 
                        runat="server" 
                        DataTextField="UserName" 
                        DataValueField="ID" 
                        DataSourceID="SqlDataSource2"
                    </asp:DropDownList> 

    Finally, if you use RadComboBox instead of DropDownList the error will not appear and the above modifications will be unnecessary.


    Sincerely yours,
    Simon
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  5. Yuri Hinojosa
    Yuri Hinojosa avatar
    23 posts
    Member since:
    Apr 2006

    Posted 26 Nov 2008 Link to this post

    Hi Simon,

    I have the same problem with a dropDownList, I remove the { SelectedValue='<%# Bind("PatientId") %>' } line as you suggest, but now How I can retrieve the selected value of the dropDownList?  Can I get in the 'OnAppointmentInsert' scheduler event?

    I can retrive the value in the  'OnAppointmentCommand' event and works fine:


    protected void RadScheduler1_AppointmentCommand(object sender, Telerik.Web.UI.AppointmentCommandEventArgs e) 
            { 
                switch (e.CommandName) 
                { 
                    case "Insert"
                    case "Update"
                        DropDownList privacyLevel = e.Container.FindControl("ddlPrivacy"as DropDownList ; 
                        if (privacyLevel != null
                        { 
                            e.Container.Appointment.Attributes["Privacy"] = privacyLevel.SelectedValue; 
     
                        } 
                        break
                } 
            } 


    And as you can see I try to set the value in the appointment custom values to process later but after in the 'OnAppointmentInsert' event the Appointment has zero attributes :( (I declare my custom field in the scheduler tag in aspx 'CustomAttributeNames') , well my second try was to find the DropDownList in the 'OnAppointmentInsert' event but the SchedulerCancelEventArgs doesn't have a 'Container' member where search :(.



    Regards,
    Yuri

  6. Simon
    Admin
    Simon avatar
    2281 posts

    Posted 01 Dec 2008 Link to this post

    Hi Yuri Hinojosa,

    Could you please verify which version of RadScheduler you are using?

    Please upgrade to the latest available in case yours is outdated and let me know how it goes.

    Best wishes,
    Simon
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017