Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > Default Values from datasource in Insert Item Template

Not answered Default Values from datasource in Insert Item Template

Feed from this thread
  • Dave avatar

    Posted on Nov 18, 2011 (permalink)

    I have a RadListView that I use to insert data into a SQL table.  Below is a snippet of the Insert Item template 
    I have a text box with the ID ScheduleTextBox that is bound to an insert parameter Schedule
     I need to be able to populate the text in this text box from another datasource.
    How can I do this?????



    Thanks for any help!

    Dave


    <InsertItemTemplate>
         <tr class="rlvIEdit">
             <td colspan="7">
                 <table cellspacing="0" class="rlvEditTable">
                     <tr>
                         <td>
                             <asp:Label ID="Officer_NameLabel2" runat="server"
                                 AssociatedControlID="rcbOfficer" Text="Officer_Name"></asp:Label>
                         </td>
                         <td>
                              <telerik:RadComboBox ID="rcbOfficer" runat="server"
                                     DataSourceID="dsOfficer" DataKeyField="Rosterid" DataTextField="officer_name"
                                     DataValueField="officer_name" AllowCustomText="True"  Text='<%# Bind("Officer_Name") %>'>
                             </telerik:RadComboBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             <asp:Label ID="ScheduleLabel2" runat="server"
                                 AssociatedControlID="ScheduleTextBox" Text="Schedule"></asp:Label>
                         </td>
                         <td>
                             <asp:TextBox ID="ScheduleTextBox" runat="server" CssClass="rlvInput"
                                 Text='<%# Bind("Schedule") %>' />
                         </td>
                     </tr>
                     <tr>
                         <td>
                             <asp:Label ID="UnitLabel2" runat="server" AssociatedControlID="rcbIUnit"
                                 Text="Unit"></asp:Label>
                         </td>
                         <td>
                             <telerik:RadComboBox ID="rcbIUnit" runat="server"
                                     DataSourceID="dsUnit" DataKeyField="Unitid" DataTextField="unit"
                                     DataValueField="unit" AllowCustomText="True"  Text='<%# Bind("unit") %>'>
                             </telerik:RadComboBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             <asp:Label ID="VehicleLabel2" runat="server"
                                 AssociatedControlID="rcbIVehicle" Text="Vehicle"></asp:Label>
                         </td>
                         <td>
                             <telerik:RadComboBox ID="rcbIVehicle" runat="server"
                                     DataSourceID="dsVehicle" DataKeyField="vehicleid" DataTextField="vehiclenumber"
                                     DataValueField="vehiclenumber" AllowCustomText="True"  Text='<%# Bind("vehicle") %>'>
                             </telerik:RadComboBox>
                         </td>
                     </tr>
                     <tr>
                         <td>
                             <asp:Label ID="HoursLabel2" runat="server" AssociatedControlID="HoursTextBox"
                                 Text="Hours"></asp:Label>
                         </td>
                         <td>
                             <asp:TextBox ID="HoursTextBox" runat="server" CssClass="rlvInput"
                              Text='<%# Bind("Hours") %>'/>
                         </td>
                     </tr>
                     <tr>
                         <td colspan="2">
                             <asp:Button ID="PerformInsertButton" runat="server" CommandName="PerformInsert"
                                 CssClass="rlvBAdd" Text=" " ToolTip="Insert" />
                             <asp:Button ID="CancelButton" runat="server" CausesValidation="False"
                                 CommandName="Cancel" CssClass="rlvBCancel" Text=" " ToolTip="Cancel" />
                         </td>
                     </tr>
                 </table>
             </td>
         </tr>
     </InsertItemTemplate>

    Reply

  • Tsvetina Tsvetina admin's avatar

    Posted on Nov 22, 2011 (permalink)

    Hi Dave,

    You could directly access the textbox inside the Edit or Insert template when the listview enters edit mode, get the value from somewhere else and set it as Text. You can see how controls inside RadListView are accessed in the different templates and modes here:
    Accessing Controls in RadListView


    Greetings,
    Tsvetina
    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

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > ListView > Default Values from datasource in Insert Item Template
Related resources for "Default Values from datasource in Insert Item Template"

ASP.NET ListView Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]