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

NestedViewTemplate GridNumericColumnEditor Not Working

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kevin Mauriello
Top achievements
Rank 1
Kevin Mauriello asked on 18 Jun 2010, 08:15 PM
I have created a grid with a nested view template (similar to the demo http://demos.telerik.com/aspnet-ajax/grid/examples/hierarchy/nestedviewtemplate/defaultcs.aspx).

I have a grid in the first tab, I need the data in the grid to be fully modifyable, insert/edit and delete.  I have the grid formated, and I have a GridNumericColumnEditor to handle the formatted numeric input.  However, when I select edit or add new record the GridNumericColumnEditor formatted does not show up.

The data will look something like this:
DatePlayed: Just a normal calendar date.
WeekNo: 1, 2, 3.....25
Hole1 - Hole18: Will have values from 0 to 11.

Is this because the grid is in a nested view template ?

Please take a look at the code and let me know what I missed.

<%@ Page Language="c#" CodeFile="Default.aspx.cs" Inherits="Default" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
    <style type="text/css">  
    .viewWrap  
    {  
        padding:15px;  
        background:#2291b5 0 0 url(Img/bluegradient.gif) repeat-x;  
    }  
      
    .contactWrap  
    {  
        padding:10px 15px 15px 15px;  
        background:#fff;  
        color:#333;  
    }  
      
    .contactWrap td  
    {  
        padding:0 20px 0 0;  
    }  
      
    .contactWrap td td  
    {  
        padding:3px 20px 3px 0;  
    }  
      
    .contactWrap img  
    {  
        border:1px solid #05679d;  
    }  
      
    </style> 
</head> 
 
<body class="BODY">  
    <form runat="server" id="mainForm" method="post">  
        <telerik:RadScriptManager runat="server" ID="ScriptManager1"/>  
        <telerik:RadFormDecorator ID="RadFormDecorator1" DecoratedControls="All" runat="server" /> 
        <telerik:RadSkinManager runat="server" ID="RadSkinManager1" PersistenceMode="Session"/>  
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1"/>  
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
 
        <telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" PageSize="5"   
            AutoGenerateColumns="False"   
            AllowSorting="True"   
            AllowMultiRowSelection="False" 
            AllowPaging="True"   
            GridLines="None"   
            ShowFooter="true" 
            ShowStatusBar="true" 
            OnItemCreated="RadGrid1_ItemCreated" 
            OnItemCommand="RadGrid1_ItemCommand">  
            <PagerStyle Mode="NumericPages"></PagerStyle> 
            <MasterTableView DataSourceID="SqlDataSource1" DataKeyNames="MemberID" AllowMultiColumnSorting="false">  
                <NestedViewTemplate> 
                    <asp:Panel runat="server" ID="InnerContainer" CssClass="viewWrap" Visible="false">  
                        <telerik:RadTabStrip runat="server" ID="TabStip1" MultiPageID="Multipage1" SelectedIndex="0">  
                            <Tabs> 
                                <telerik:RadTab runat="server" Text="Contact Information" PageViewID="contactView"/>  
                                <telerik:RadTab runat="server" Text="Season Scores" PageViewID="scoreView"/>  
                                <telerik:RadTab runat="server" Text="Practice Rounds" PageViewID="practiceView"/>  
                            </Tabs> 
                        </telerik:RadTabStrip> 
                        <telerik:RadMultiPage runat="server" ID="Multipage1" SelectedIndex="0" RenderSelectedPageOnly="false">  
                            <telerik:RadPageView runat="server" ID="scoreView">  
                                <asp:Label ID="Label1" Text='<%# Eval("MemberID") %>' Visible="false" runat="server" /> 
                                <telerik:RadGrid runat="server" ID="scoresGrid" DataSourceID="SqlDataSource2" 
                                    ShowFooter="true"   
                                    ShowStatusBar="true" 
                                    AllowSorting="true" 
                                    AutoGenerateColumns="false" 
                                    OnInsertCommand="insertScores" 
                                    OnUpdateCommand="updateScores" 
                                    OnDeleteCommand="deleteScores">  
                                    <MasterTableView ShowHeader="true" AutoGenerateColumns="False" AllowPaging="true" 
                                        DataKeyNames="MemberID, LeagueID, WeekNo" PageSize="7" EditMode="InPlace" CommandItemDisplay="top">  
                                        <Columns> 
                                            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">  
                                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> 
                                                <HeaderStyle Width="25px"></HeaderStyle> 
                                            </telerik:GridEditCommandColumn> 
                                            <telerik:GridButtonColumn ConfirmText="Delete These Scores?" ConfirmDialogType="RadWindow" 
                                                ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete" 
                                                UniqueName="DeleteColumn">  
                                                <HeaderStyle Width="25px" /> 
                                                <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /> 
                                            </telerik:GridButtonColumn> 
                                            <telerik:GridDateTimeColumn SortExpression="DatePlayed" HeaderText="Played On" HeaderButtonType="TextButton" 
                                                DataField="DatePlayed" UniqueName="DatePlayed" DataFormatString="{0:d}"/>  
                                            <telerik:GridNumericColumn SortExpression="WeekNo" HeaderText="Week" HeaderButtonType="TextButton" DataField="WeekNo" UniqueName="WeekNo" DataFormatString="{0:##}" HeaderStyle-Width="50px" HeaderStyle-HorizontalAlign="center" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole1" HeaderText="1" HeaderButtonType="TextButton" DataField="Hole1" UniqueName="Hole1" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole2" HeaderText="2" HeaderButtonType="TextButton" DataField="Hole2" UniqueName="Hole2" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole3" HeaderText="3" HeaderButtonType="TextButton" DataField="Hole3" UniqueName="Hole3" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole4" HeaderText="4" HeaderButtonType="TextButton" DataField="Hole4" UniqueName="Hole4" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole5" HeaderText="5" HeaderButtonType="TextButton" DataField="Hole5" UniqueName="Hole5" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole6" HeaderText="6" HeaderButtonType="TextButton" DataField="Hole6" UniqueName="Hole6" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole7" HeaderText="7" HeaderButtonType="TextButton" DataField="Hole7" UniqueName="Hole7" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole8" HeaderText="8" HeaderButtonType="TextButton" DataField="Hole8" UniqueName="Hole8" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole9" HeaderText="9" HeaderButtonType="TextButton" DataField="Hole9" UniqueName="Hole9" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole10" HeaderText="10" HeaderButtonType="TextButton" DataField="Hole10" UniqueName="Hole10" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole11" HeaderText="11" HeaderButtonType="TextButton" DataField="Hole11" UniqueName="Hole11" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole12" HeaderText="12" HeaderButtonType="TextButton" DataField="Hole12" UniqueName="Hole12" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole13" HeaderText="13" HeaderButtonType="TextButton" DataField="Hole13" UniqueName="Hole13" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole14" HeaderText="14" HeaderButtonType="TextButton" DataField="Hole14" UniqueName="Hole14" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole15" HeaderText="15" HeaderButtonType="TextButton" DataField="Hole15" UniqueName="Hole15" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole16" HeaderText="16" HeaderButtonType="TextButton" DataField="Hole16" UniqueName="Hole16" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole17" HeaderText="17" HeaderButtonType="TextButton" DataField="Hole17" UniqueName="Hole17" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                            <telerik:GridNumericColumn SortExpression="Hole18" HeaderText="18" HeaderButtonType="TextButton" DataField="Hole18" UniqueName="Hole18" DataFormatString="{0:##}" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="right" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="right" ColumnEditorID="holeData"/>  
                                        </Columns> 
                                    </MasterTableView> 
                                </telerik:RadGrid> 
 
                                <asp:SqlDataSource ID="SqlDataSource2" ConnectionString="<%$ ConnectionStrings:GolfLeague %>" 
                                    SelectCommand="SELECT * FROM Scores Where MemberID = @MemberID ORDER BY WeekNo" runat="server">  
                                    <SelectParameters> 
                                        <asp:ControlParameter ControlID="Label1" PropertyName="Text" Type="String" Name="MemberID" /> 
                                    </SelectParameters> 
                                </asp:SqlDataSource> 
                            </telerik:RadPageView> 
                        </telerik:RadMultiPage> 
                    </asp:Panel> 
                </NestedViewTemplate> 
                <Columns> 
                    <telerik:GridBoundColumn SortExpression="FMLName" HeaderText="Player Name" HeaderButtonType="TextButton" 
                        DataField="FMLName" UniqueName="FMLName">  
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn SortExpression="EmailAddress" HeaderText="Email Address" HeaderButtonType="TextButton" 
                        DataField="EmailAddress" UniqueName="EmailAddress">  
                    </telerik:GridBoundColumn> 
                </Columns> 
            </MasterTableView> 
        </telerik:RadGrid> 
 
        <telerik:GridNumericColumnEditor ID="holeData" runat="server" NumericTextBox-Width="25px">  
            <NumericTextBox ID="txtScores" DataType="System.Int32" 
                MaxLength="2" MaxValue="100" MinValue="0" ShowSpinButtons="True" 
                Width="25px" runat="server"   
                EnabledStyle-HorizontalAlign="center" 
                FocusedStyle-HorizontalAlign="right" 
                HoveredStyle-HorizontalAlign="center" 
                NumberFormat-DecimalDigits="0"/>  
        </telerik:GridNumericColumnEditor> 
 
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:GolfLeague %>" runat="server" 
            SelectCommand="SELECT *, LastName + ', ' + FirstName + ISNULL(RTRIM(' ' + Initial),'') + ISNULL(RTRIM(' ' + Suffix),'') FMLName FROM Members">  
        </asp:SqlDataSource> 
    </form> 
</body> 
</html> 
 

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 24 Jun 2010, 10:14 AM
Hi Kevin,

Go through the following link which elaborates on how to use custom editors in RadGrid  and let me know if it helps to achieve your goal:
Using custom editors in RadGrid

Kind regards,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kevin Mauriello
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or