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

GridNumericColumnEditor

5 Answers 365 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aron
Top achievements
Rank 2
Aron asked on 26 Aug 2008, 10:37 AM
Hello,
I have a RadGrid that needs to have a editable text box for each row open and ready by default.
What is better for a RadGrid with 100 -300 Rows, using a RadNumericTextBox or a GridNumericColumnEditor?
See below:

<telerik:GridTemplateColumn DataField="Price" HeaderText="Price" 
            SortExpression="Price" UniqueName="TemplateColumnPrice">
            <ItemTemplate>
                <telerik:RadNumericTextBox ID="txtPrice" runat="server" EmptyMessage="type ..." ShowSpinButtons="True" Type="Currency" width="200px" InvalidStyleDuration="100" Value='<%# Convert.ToDecimal(DataBinder.Eval(Container.DataItem, "Price")) %>'>
                    <NumberFormat AllowRounding="True" KeepNotRoundedValue="False" />
                </telerik:RadNumericTextBox>
                <asp:RequiredFieldValidator ID="rqPrice" ControlToValidate="txtPrice" runat="server" ErrorMessage="<%$ Resources:Backend, Required %>"/>
            </ItemTemplate>
        </telerik:GridTemplateColumn>

Or using the: GridNumericColumnEditor

<telerik:GridTemplateColumn DataField="Price" HeaderText="Price"
SortExpression="Price" UniqueName="TemplateColumnPrice">
<ItemTemplate>
<telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server">
<NumericTextBox EmptyMessage="type ..." ShowSpinButtons="True" Type="Currency" width="200px" InvalidStyleDuration="100" Value='<%#Bind("Price") %>' ID="txtPrice">
<NumberFormat AllowRounding="True" KeepNotRoundedValue="False" />
</NumericTextBox>
</telerik:GridNumericColumnEditor>
</ItemTemplate>
</telerik:GridTemplateColumn>

5 Answers, 1 is accepted

Sort by
0
Yavor
Telerik team
answered on 27 Aug 2008, 12:36 PM
Hello aron,

Having a column editor will reduce the footprint of the page. However, please keep in mind that a column editor is used in a slightly different fashion, as demonstrated in the code snippet below:

.aspx
 <telerik:RadGrid AllowMultiRowEdit="true" 
         ID="RadGrid1" runat="server" DataSourceID="AccessDataSource1" GridLines="None" OnPreRender="RadGrid1_PreRender">  
            <MasterTableView AutoGenerateColumns="False" DataSourceID="AccessDataSource1">  
                <RowIndicatorColumn> 
                    <HeaderStyle Width="20px" /> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn> 
                    <HeaderStyle Width="20px" /> 
                </ExpandCollapseColumn> 
                <Columns> 
                  
                <telerik:GridEditCommandColumn> 
                </telerik:GridEditCommandColumn> 
                  
                    <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName" SortExpression="ShipName" 
                        UniqueName="ShipName">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="ShipAddress" HeaderText="ShipAddress" SortExpression="ShipAddress" 
                        UniqueName="ShipAddress">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" SortExpression="ShipCity" 
                        UniqueName="ShipCity">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" HeaderText="UnitPrice" 
                        SortExpression="UnitPrice" UniqueName="UnitPrice" ColumnEditorID="GridNumericColumnEditor1">  
                    </telerik:GridBoundColumn> 
                      
                     
                      
                </Columns> 
            </MasterTableView> 
            <FilterMenu EnableTheming="True">  
                <CollapseAnimation Duration="200" Type="OutQuint" /> 
            </FilterMenu> 
        </telerik:RadGrid><asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb" 
            SelectCommand="SELECT TOp 100 [ShipName], [ShipAddress], [ShipCity], [UnitPrice] FROM [Invoices]">  
        </asp:AccessDataSource> 
          
          
      <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server">  
<NumericTextBox runat="server" 
  ShowSpinButtons="True" Type="Currency" width="200px" InvalidStyleDuration="100" Value='<%#Eval("Price") %>' ID="txtPrice">  
<NumberFormat AllowRounding="True" KeepNotRoundedValue="False" /> 
</NumericTextBox> 
</telerik:GridNumericColumnEditor> 

I hope this gets you started properly.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Aron
Top achievements
Rank 2
answered on 09 Sep 2008, 08:26 AM
Thanks for the reply.

By default this the NumericColumnEditor appears on edit mode.

How can I get it to appear on the default mode, since my users will make the edits right from page load.
0
Yavor
Telerik team
answered on 09 Sep 2008, 08:38 AM
Hi aron,

In this case, you can put the control in edit mode by default.
I hope this helps.

Greetings,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Aron
Top achievements
Rank 2
answered on 09 Sep 2008, 08:47 AM
After doing this on page load, is it still faster and less foot print than using a
ItemTemplate with a RadNumericTextBox?
0
Accepted
Yavor
Telerik team
answered on 09 Sep 2008, 10:29 AM
Hi aron,

Since all the items will be rendered in edit mode, there would be little difference between the two scenarios.

Regards,
Yavor
the Telerik team

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