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

RadGrid FormTemplate

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Michael VS
Top achievements
Rank 1
Michael VS asked on 09 Sep 2008, 04:41 AM
Hi there,

I have a RadGrid which I have created a custom EditFormSettings.  The item I am making available for edit has child records which I display inside the edit FormTemplate as a Listbox.  This listbox displays the current children for the item being edited as well as a listbox of options which the user can select one item which I want to add to the first listbox of current children.

What I am trying to do is use a server-side button inside the template to get the selected item from one listbox and add it to the other listbox of the items children.

So once the user clicks the button how do I get access to the listbox on postback?

Here is an example of my EditForm Template code.

                        <EditFormSettings EditFormType="Template">  
                            <FormTemplate> 
                                <table width='100%'>  
                                    <colgroup><col width='10' /><col width='420' /><col width='200' /><col width=* /></colgroup>  
                                    <tr> 
                                        <td></td>  
                                        <td> 
                                            <table width='100%' border='0'>  
                                                <colgroup><col width='30' /><col width='200' /></colgroup>  
                                                <tr> 
                                                    <td>Name</td> 
                                                    <td> 
                                                        <radI:RadTextBox ID="rtbAECName" runat="server" Text='<%# Bind( "AECName") %>' Width='190px'>  
                                                        </radI:RadTextBox></td>  
                                                </tr> 
                                                <tr> 
                                                    <td>Email</td> 
                                                    <td> 
                                                        <radI:RadTextBox ID="rtbEmail" runat="server" Text='<%# Bind( "Email") %>' Width='190px'>  
                                                        </radI:RadTextBox></td>  
                                                </tr> 
                                                <tr align=right>  
                                                    <td colspan="2">  
                                                        </td> 
                                                </tr> 
                                            </table> 
                                        </td> 
                                        <td> 
                                            <table><tr><td><asp:ListBox ID="lbAllCountries" runat="server" DataSourceID="odsCountries" 
                                                DataTextField="Country" DataValueField="ID" Rows="12" Width="220px"></asp:ListBox></td><td> 
                                                    <asp:Button ID="btnAdd" runat="server" Text="-->" OnClick="btnAdd_Click" /><br /> 
                                                    <asp:Button ID="btnRemove" runat="server" Text="<--" /></td><td> 
                                        <asp:ListBox ID="lbAssignedCountries" runat="server" Rows="12" Width="220px"></asp:ListBox></td></tr></table>   
                                                </td> 
                                    <td></td></tr> 
                                    <tr> 
                                        <td> 
                                        </td> 
                                        <td align="center" colspan="2">  
                                                        <asp:Button ID="btnUpdate" runat="server" Text="Update" CommandName="Update" /><asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" /></td>  
                                        <td> 
                                        </td> 
                                    </tr> 
                                </table> 
                            </FormTemplate> 
                            <EditColumn UniqueName="EditCommandColumn1">  
                            </EditColumn> 
                        </EditFormSettings> 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 11 Sep 2008, 11:21 AM
Hello Michael,

Attached to this message, is a small application, which handles a functionality close to the one that you mentioned.
I hope this gets you started properly.

Sincerely yours,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Michael VS
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or