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

AdvancedInsertTemplate and ListBox

1 Answer 67 Views
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
thomas asked on 14 Sep 2010, 09:34 PM
I have a scheduler component and I want a custom insert view. Is it possible to get controls from the AdvancedInsertTemplate? I tried using FindControl on the scheduler component but with no luck. So is the recormended way to get all selected values from a ListBox places in the AdvancedInsertTemplate? I guess that custom attributtes dosent support multiple values? Same if I used a gridview how do I get the values from that?

protected void RadScheduler1_AppointmentInsert(object sender, Telerik.Web.UI.SchedulerCancelEventArgs e)
            string test = e.Appointment.Attributes["Test"];            
            ???? here to get values from listbox???

    <telerik:RadScheduler ID="RadScheduler1" runat="server" Height="583px"
        Width="889px" onappointmentcreated="RadScheduler1_AppointmentCreated"
        onappointmentinsert="RadScheduler1_AppointmentInsert" CustomAttributeNames="Test,Test2">        
        <AdvancedInsertTemplate > 
            <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Subject") %>'></asp:TextBox>
            <asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple" SelectedValue='<%# Bind("Test") %>'><asp:ListItem>dsdsd</asp:ListItem><asp:ListItem>sdsdsd</asp:ListItem></asp:ListBox>
            <asp:LinkButton runat="server" ID="UpdateButton" CssClass="rsAdvEditSave" CommandName="Insert">Insert</asp:LinkButton>


1 Answer, 1 is accepted

Sort by
Telerik team
answered on 16 Sep 2010, 04:11 PM
Hello thomas,

You can get the listbox client-side object from the AdvancedInsertTemplate via this:

var listbox = $find("RadScheduler1_Form_ListBox1");

Please note that the "RadScheduler1" is the ID of the RadScheduler and "ListBox1" is the ID of the ListBox. However this is not appropriate because ASP.NET ListBox has no client-side API.

I suggest you to subscribe to the OnFormCreated server-side event and find the ListBox via e.Container.FindControl as the datePicker is found in this help article.

Veronica Milcheva
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
Asked by
Top achievements
Rank 1
Answers by
Telerik team
Share this question