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

[Solved] Customise insert record

2 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DGraham
Top achievements
Rank 1
DGraham asked on 11 Jun 2009, 12:40 PM

Hi,

I have a radGrid with an 'Add Record' button, when the add record button is clicked the editItemTemplate displays text boxes for all the columns in the grid, however I don't want the user to be able to insert all fields (some are dynamically set in the code behind), how can I customise the editItemTemplate? I have looked at your example: Grid/Update/Insert/Delete in Hierarchy (http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/threelevel/defaultcs.aspx) but my radGrid is populate from the code behind, so how do I specify the 'InsertParapaters' for the editItemTemplate? Also is it possible to change the Insert/Cancel text to an image button?

Additionally, I have a 'detailTable' that also allows inserts, but I only want the user to select one value from a radComboBox (the rest of the data to be inserted is handled by the code behind) How do I populate this radComboBox from the code behind? When opening the detailTable is it possible to close the ‘Add New Record’ dialog box in the master table?

 

Your help regarding the above issues would be greatly appreciated.

 
Below is the radGrid Code:

        <telerik:RadGrid ID="RadGridServices" runat="server" Width="100%" AutoGenerateColumns="False" 
            AllowMultiRowSelection="False" AllowAutomaticInserts="True" AllowAutomaticDeletes="True" 
            AllowAutomaticUpdates="True" Height="480px" GridLines="None">  
            <PagerStyle Mode="NumericPages"></PagerStyle> 
            <MasterTableView DataKeyNames="serviceID" AllowMultiColumnSorting="True" CellSpacing="-1" 
                CommandItemDisplay="Top" Name="Services" NoDetailRecordsText="There are no services to display" 
                Width="100%">  
                <DetailTables> 
                    <telerik:GridTableView DataKeyNames="employeeID" AllowMultiColumnSorting="True" CellSpacing="-1" 
                        CommandItemDisplay="Top" Name="Contacts" NoDetailRecordsText="There are no contact detail for this service" 
                        Width="100%" runat="server">  
                        <Columns> 
                            <telerik:GridBoundColumn SortExpression="Sequence" HeaderText="Sequence" HeaderButtonType="TextButton" 
                                DataField="Sequence" UniqueName="Sequence">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="employeeID" HeaderText="employeeID" HeaderButtonType="TextButton" 
                                DataField="employeeID" Visible="False" UniqueName="employeeID">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="Method" HeaderText="Method" HeaderButtonType="TextButton" 
                                DataField="Method" UniqueName="Method">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton" 
                                DataField="Description" UniqueName="Description">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn SortExpression="Detail" HeaderText="Detail" HeaderButtonType="TextButton" 
                                DataField="Detail" UniqueName="Detail">  
                            </telerik:GridBoundColumn> 
                            <telerik:GridCheckBoxColumn SortExpression="Private" HeaderText="Private" HeaderButtonType="TextButton" 
                                DataField="Private" UniqueName="Private">  
                            </telerik:GridCheckBoxColumn> 
                            <telerik:GridCheckBoxColumn SortExpression="Active" HeaderText="Active" HeaderButtonType="TextButton" 
                                DataField="Active" UniqueName="Active">  
                            </telerik:GridCheckBoxColumn> 
                            <telerik:GridButtonColumn CommandName="Delete" Text="Delete" HeaderText="Delete" 
                                UniqueName="DeleteColumn" /> 
                            <telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
                                <EditItemTemplate> 
                                    <telerik:RadComboBox ID="RadComboBoxContact" runat="server" Visible="true">  
                                    </telerik:RadComboBox> 
                                </EditItemTemplate> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                        <CommandItemSettings AddNewRecordText="Add New Contact" /> 
                    </telerik:GridTableView> 
                </DetailTables> 
                <Columns> 
                    <telerik:GridBoundColumn SortExpression="Description" HeaderText="Description" HeaderButtonType="TextButton" 
                        DataField="Description" UniqueName="Description">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn SortExpression="Detail" HeaderText="Detail" HeaderButtonType="TextButton" 
                        DataField="Detail" UniqueName="Detail">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" /> 
                    <telerik:GridBoundColumn SortExpression="serviceID" HeaderText="serviceID" HeaderButtonType="TextButton" 
                        DataField="serviceID" Visible="False" UniqueName="serviceID">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridTemplateColumn UniqueName="TemplateColumn1">  
                    </telerik:GridTemplateColumn> 
                </Columns> 
                <ExpandCollapseColumn Visible="True">  
                </ExpandCollapseColumn> 
                <CommandItemSettings AddNewRecordText="Add New Service" /> 
            </MasterTableView> 
        </telerik:RadGrid> 

2 Answers, 1 is accepted

Sort by
0
DGraham
Top achievements
Rank 1
answered on 12 Jun 2009, 09:06 AM

Hi,

 

After doing a bit more searching I solved the above questions by reading ‘Insert/Update/Delete records -> Edit mode -> Custom edit forms in your documentation.

http://www.telerik.com/help/aspnet-ajax/grdcustomeditforms.html

0
DGraham
Top achievements
Rank 1
answered on 12 Jun 2009, 09:06 AM

Hi Telerik Team,

Is there a printable version of the documentation for your controls in a PDF format? I know they are available on your website and as a help file (.chm) but I would like a hard copy.

I look forward to your reply...

Tags
Grid
Asked by
DGraham
Top achievements
Rank 1
Answers by
DGraham
Top achievements
Rank 1
Share this question
or