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

Find and bind dropdownlist in inlineinserttemplate

5 Answers 70 Views
Scheduler
This is a migrated thread and some comments may be shown as answers.
David Sitton
Top achievements
Rank 1
David Sitton asked on 15 Mar 2012, 10:12 AM
Hi,
I'm having trouble finding and binding my ddl control server side - mainly falling at the first hurdle - I can't find the control!

Here's the inlineinserttemplate:

        <InlineInsertTemplate>
            <div id="InlineInsertTemplate" class="rsCustomAppointmentContainer technical">
                <div>
                </div>
                <span class="rsCustomAppointmentContainerInner">
                    <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Subject") %>' Width="90%"
                        TextMode="MultiLine" Height="20px"></asp:TextBox>
                    <asp:LinkButton ID="InsertButton" runat="server" CommandName="Insert">
                        Insert
                    </asp:LinkButton>
                    <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel">
                        Cancel
                    </asp:LinkButton>

                    <span class="inline-label">Type</span>
                    <asp:DropDownList ID="ddlActivityType" runat="server" DataValueField="activity_type_uniq" DataTextField="activity_type_name">
                    </asp:DropDownList>

                    <asp:LinkButton ID="InsertMoreButton" runat="server" CommandName="More" CssClass="rsAdvancedEditLink">Advanced</asp:LinkButton>
                </span>
            </div>
        </InlineInsertTemplate>

Can anyone help me with where to look and what event to look in?

Cheers!

5 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Mar 2012, 11:10 AM
Hello,

You can access and bind the DropDownList from the FormCreated event. See the sample code below.
C#:
protected void radscheduler1_FormCreated(object sender, SchedulerFormCreatedEventArgs e)
  {
    RadScheduler scheduler = (RadScheduler)sender;
    if (e.Container.Mode == SchedulerFormMode.Insert )
      {
        DropDownList DropDownList1 = (DropDownList)e.Container.FindControl("ddlActivityType");
        DropDownList1.DataSourceID = "SqlDataSource1";
      }
  }
Hope this helps.

Thanks,
Princy.
0
David Sitton
Top achievements
Rank 1
answered on 15 Mar 2012, 11:10 AM
Ok, I've found the DDL in {FormCreated} - now I need to pick up the value during {AppointmentInsert}
Anyone done this already? Or should it be mapped to a custom attribute (and if so how?)
Any help much appreciated :-)
0
David Sitton
Top achievements
Rank 1
answered on 15 Mar 2012, 11:13 AM
Thanks Princy, much appreciated! Stumbled across it myself but the extra condition will help it from falling over!
0
David Sitton
Top achievements
Rank 1
answered on 15 Mar 2012, 11:52 AM
No worries, I've found the DDL in the {AppointmentCommand} event - if there is a way to auto bind that DDL to a custom attribute would be good to hear though. Cheers!
0
Plamen
Telerik team
answered on 16 Mar 2012, 01:45 PM
Hi David,

You can use the same functionality as in the Using Templates demo and set Custom Attributes as it is done in the code behind of this demo.

Hope this will be helpful. 

Greetings,
Plamen Zdravkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Scheduler
Asked by
David Sitton
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
David Sitton
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or