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

Unable to combine two functionalities of RadGrid

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bogdan
Top achievements
Rank 1
Bogdan asked on 10 Jan 2011, 03:16 PM
We are working with the following two scenarios:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/templateformupdate/defaultcs.aspx
http://demos.telerik.com/aspnet-ajax/toolbar/examples/applicationscenarios/gridcommanditem/defaultcs.aspx

These are RadToolBar as Command Item, and Form Template Edit Form.  These do work for us when we try to use them separately, but they will not work together.  We went down to original live example source code, and tried to combine the two without any of our own code, just original Telerik demo code, and it still does not work.  For some reason when we try to edit grid item from RadToolBar, it will not open webusercontrol.

It is very easy to replicate, try modifying the following file in RadControlsExamples:

C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q3 2010\Live Demos\Grid\Examples\DataEditing\UserControlEditForm\DefaultCS.aspx

As follows:
<telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowPaging="True" CssClass="RadGrid"
     AllowSorting="True" AutoGenerateColumns="False" ShowStatusBar="true" OnPreRender="RadGrid1_PreRender"
     OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
     OnInsertCommand="RadGrid1_InsertCommand" OnDeleteCommand="RadGrid1_DeleteCommand">
     <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="EmployeeID">
     <CommandItemTemplate>
             <telerik:RadToolBar ID="RadToolBar1" OnButtonClick="RadToolBar1_ButtonClick" runat="server" OnClientButtonClicking="onToolBarClientButtonClicking">
                 <Items>
                     <telerik:RadToolBarButton Text="Edit selected" CommandName="EditSelected" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Edit.gif" Visible='<%# RadGrid1.EditIndexes.Count == 0 %>'></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Update" CommandName="UpdateEdited" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Update.gif" Visible='<%# RadGrid1.EditIndexes.Count > 0 %>'></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Cancel editing" CommandName="CancelAll" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Cancel.gif" Visible='<%# RadGrid1.EditIndexes.Count > 0 || RadGrid1.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Add new" CommandName="InitInsert" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/AddRecord.gif" Visible='<%# !RadGrid1.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Add this Customer" CommandName="PerformInsert" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Insert.gif" Visible='<%# RadGrid1.MasterTableView.IsItemInserted %>'></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Delete selected customers" CommandName="DeleteSelected" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Delete.gif"></telerik:RadToolBarButton>
                     <telerik:RadToolBarButton Text="Refresh customer list" CommandName="RebindGrid" ImageUrl="~/ToolBar/Examples/ApplicationScenarios/GridCommandItem/Images/Refresh.gif"></telerik:RadToolBarButton>
                 </Items>
             </telerik:RadToolBar>
         </CommandItemTemplate>
         <Columns>
             <telerik:GridEditCommandColumn UniqueName="EditCommandColumn">
             </telerik:GridEditCommandColumn>
             <telerik:GridBoundColumn UniqueName="TitleOfCourtesy" HeaderText="TOC" DataField="TitleOfCourtesy">
                 <HeaderStyle Width="60px"></HeaderStyle>
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn UniqueName="FirstName" HeaderText="FirstName" DataField="FirstName">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn UniqueName="LastName" HeaderText="LastName" DataField="LastName">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn UniqueName="HireDate" HeaderText="Hire Date" DataField="HireDate" DataFormatString="{0:d}">
             </telerik:GridBoundColumn>
             <telerik:GridBoundColumn UniqueName="Title" HeaderText="Title" DataField="Title">
             </telerik:GridBoundColumn>
             <telerik:GridButtonColumn UniqueName="DeleteColumn" Text="Delete" CommandName="Delete" />
         </Columns>
         <EditFormSettings UserControlName="EmployeeDetailsCS.ascx" EditFormType="WebUserControl">
             <EditColumn UniqueName="EditCommandColumn1">
             </EditColumn>
         </EditFormSettings>
     </MasterTableView>
     <ClientSettings>
         <Selecting AllowRowSelect="True" EnableDragToSelectRows="False" />
         <ClientEvents OnRowDblClick="RowDblClick" />
     </ClientSettings>
 </telerik:RadGrid>

Please advise, thank you.


1 Answer, 1 is accepted

Sort by
0
Bogdan
Top achievements
Rank 1
answered on 10 Jan 2011, 05:03 PM
Problem resolved by replacing RadToolBar with CommandItem template with identical look and feel.
Tags
Grid
Asked by
Bogdan
Top achievements
Rank 1
Answers by
Bogdan
Top achievements
Rank 1
Share this question
or