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

Problem with inline editing

3 Answers 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Soozequeue
Top achievements
Rank 1
Soozequeue asked on 03 May 2011, 06:47 PM

I hope someone can help

We have a problem with inline editing on a radgrid.  Code below.  Whenever we click on the Add Row icon, it looks like a postback is happening but no row gets added to the grid.  We're missing something, just can't tell what it is.

Help!

<%@ Page Language="C#" AutoEventWireup="True" CodeBehind="TimesheetEditor.aspx.cs"<br>    Inherits="Tempus.Employees.TimesheetEditor" %><br><br><br>    <br><%@ Register Src="~/UserControls/ucTopMenu.ascx" TagName="ucTopMenu" TagPrefix="uc1" %><br><%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %><br><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br><html xmlns="http://www.w3.org/1999/xhtml"><br><head id="Head1" runat="server"><br>    <title></title><br><br><br><br><br>    <link rel="Stylesheet" type="text/css" href="../Styles/main.css" /><br>    <script language="javascript" type="text/javascript" src="../Scripts/jquery-1.4.1.js"></script><br></head><br><body><br>    <form id="form1" runat="server"><br>    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"><br>        <Scripts><br>            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /><br>            <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /><br>        </Scripts><br>    </telerik:RadScriptManager><br>    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" Skin="Windows7"><br>    </telerik:RadSkinManager><br>    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"><br>        <script type="text/javascript"><br>            function RowDblClick(sender, eventArgs) {<br>                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());<br>            }<br>        </script><br>    </telerik:RadCodeBlock><br>    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"><br>        <AjaxSettings><br>            <telerik:AjaxSetting AjaxControlID="rgridTimesheetProgramEntries"><br>                <UpdatedControls><br>                    <telerik:AjaxUpdatedControl ControlID="rgridTimesheetProgramEntries" LoadingPanelID="RadAjaxLoadingPanel1" /><br>                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" /><br>                </UpdatedControls><br>            </telerik:AjaxSetting><br>        </AjaxSettings><br>    </telerik:RadAjaxManager><br>    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /><br>    <div id="outsideContainer" class="outsideContainer"><br>        <div style="background: #FFFFFF"><br>            <table width="1000px"><br>                <tr><br>                    <td width="25%"><br>                        <img src="../images/timepiece.jpg" width="150px" /><br>                    </td><br>                    <td width="50%" align="center"><br>                        <h1><br>                            Tempus - Time Sheet System</h1><br>                        <br /><br>                        <h2><br>                            Welcome,<br>                            <asp:Literal ID="litUserName" runat="server"></asp:Literal></h2><br>                    </td><br>                    <td width="25%" align="right"><br>                        <img src="../images/TridentLogoFullColor.jpg" width="200px" /><br>                    </td><br>                </tr><br>            </table><br>        </div><br>        <div id="content" class="contentContainer" style="border: 1px,solid,Grey;"><br>            <table border="0" width="1000px" cellspacing="10px" cellpadding="10px"><br>                <tr><br>                    <td valign="top"><br>                        <uc1:ucTopMenu ID="ucLeftMenu1" runat="server"></uc1:ucTopMenu><br>                    </td><br>                </tr><br>                <tr><br>                    <td valign="top"><br>                        <fieldset id="fsetTimesheetDetails" runat="server"><br>                            <legend title="Edit Timesheet"></legend><br>                            <table width="975px" border="0" class="smallBodyText"><br>                                <tr><br>                                    <td width="60%" align="left" class="smallBodyText"><br>                                        <asp:Label ID="lblUserName" runat="server"></asp:Label><br /><br>                                        <b>Timesheet Status:&nbsp;</b><asp:Label ID="lblTimeSheetStatus" runat="server"></asp:Label><br /><br>                                        <b>Timesheet Period:&nbsp;</b><asp:Label ID="lblTimeSheetPeriod" runat="server"></asp:Label><br /><br>                                        <b>Due Date:&nbsp;</b><asp:Label ID="lblTimesheetDueDate" runat="server"></asp:Label><br>                                    </td><br>                                    <td width="40%" align="right"><br>                                        <b>Total Hours:&nbsp;</b><asp:Label ID="lblTotalHours" runat="server"></asp:Label><br /><br>                                        <b>Billable Hours:&nbsp;</b><asp:Label ID="lblBillableHours" runat="server"></asp:Label><br>                                    </td><br>                                </tr><br>                            </table><br>                            <br /><br>                            <br /><br>                            <asp:Label ID="lbl1" runat="server" Text="Program Tasks"></asp:Label><br>                            <telerik:RadGrid ID="rgridTimesheetProgramEntries" GridLines="None" runat="server" <br>                                OnItemUpdated="rgridTimesheetProgramEntries_ItemUpdated" AllowAutomaticDeletes="True"<br>                                AllowAutomaticInserts="True" PageSize="10" AllowAutomaticUpdates="True" AllowPaging="True"<br>                                Width="975px" ShowFooter="true" AutoGenerateColumns="False" DataSourceID="dsTimesheetDetails"><br>                                <PagerStyle Mode="NextPrevAndNumeric" /><br>                                <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="Sequence" EditMode="InPlace" <br>                                    AllowAutomaticInserts="true" AllowAutomaticUpdates="true" AllowAutomaticDeletes="true"<br>                                    DataSourceID="dsTimesheetDetails" HorizontalAlign="NotSet" AutoGenerateColumns="False"><br>                                    <Columns><br>                                        <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn"><br>                                            <ItemStyle CssClass="MyImageButton" /><br>                                        </telerik:GridEditCommandColumn><br>                                        <telerik:GridDropDownColumn DataField="AssignmentID" DataSourceID="dsEmployeeAssignments"<br>                                            HeaderText="Program/Task" ListTextField="AssignmentTask" ListValueField="AssignmentID"<br>                                            UniqueName="AssignmentID"><br>                                        </telerik:GridDropDownColumn><br>                                        <telerik:GridDropDownColumn DataField="BillingType" DataSourceID="dsBillingTypeLookup"<br>                                            HeaderText="Billing" ListTextField="BillingTypeDesc" ListValueField="BillingType"<br>                                            UniqueName="BillingType" HeaderStyle-Width="90px"><br>                                        </telerik:GridDropDownColumn><br>                                        <telerik:GridNumericColumn DataField="Day1Hours" HeaderText="Day 1 Hours" SortExpression="Day1Hours"<br>                                            UniqueName="Day1Hours" ColumnEditorID="GridNumericColumnEditor1" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day2Hours" HeaderText="Day 2 Hours" SortExpression="Day2Hours"<br>                                            UniqueName="Day2Hours" ColumnEditorID="GridNumericColumnEditor2" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day3Hours" HeaderText="Day 3 Hours" SortExpression="Day3Hours"<br>                                            UniqueName="Day3Hours" ColumnEditorID="GridNumericColumnEditor3" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day4Hours" HeaderText="Day 4 Hours" SortExpression="Day4Hours"<br>                                            UniqueName="Day4Hours" ColumnEditorID="GridNumericColumnEditor4" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day5Hours" HeaderText="Day 5 Hours" SortExpression="Day5Hours"<br>                                            UniqueName="Day5Hours" ColumnEditorID="GridNumericColumnEditor5" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day6Hours" HeaderText="Day 6 Hours" SortExpression="Day6Hours"<br>                                            UniqueName="Day6Hours" ColumnEditorID="GridNumericColumnEditor6" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridNumericColumn DataField="Day7Hours" HeaderText="Day 7 Hours" SortExpression="Day7Hours"<br>                                            UniqueName="Day7Hours" ColumnEditorID="GridNumericColumnEditor7" Aggregate="Sum"<br>                                            FooterText=" "><br>                                        </telerik:GridNumericColumn><br>                                        <telerik:GridCalculatedColumn HeaderText="Total Task<br>Hours" UniqueName="TotalTaskHours"<br>                                            DataType="System.Double" DataFields="Day1Hours, Day2Hours, Day3Hours, Day4Hours, Day5Hours, Day6Hours, Day7Hours"<br>                                            Expression="{0}+{1}+{2}+{3}+{4}+{5}+{6}" FooterText="Total : " Aggregate="Sum" /><br>                                        <telerik:GridButtonColumn ConfirmText="Delete this timesheet entry?" ConfirmDialogType="RadWindow"<br>                                            ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" Text="Delete"<br>                                            UniqueName="DeleteColumn"><br>                                            <ItemStyle HorizontalAlign="Center" CssClass="MyImageButton" /><br>                                        </telerik:GridButtonColumn><br>                                    </Columns><br>                                </MasterTableView><br>                                <ClientSettings><br>                                    <ClientEvents OnRowDblClick="RowDblClick" /><br>                                </ClientSettings><br>                            </telerik:RadGrid><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor1" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor2" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor3" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor4" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor5" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor6" runat="server" NumericTextBox-Width="40px" /><br>                            <telerik:GridNumericColumnEditor ID="GridNumericColumnEditor7" runat="server" NumericTextBox-Width="40px" /><br>                            <br /><br>                            <br /><br>                            <br>                            <telerik:RadButton ID="rbtnSubmit" Text="Submit" OnClick="rbtnSubmit_Click" runat="server"><br>                            </telerik:RadButton><br>                            <br /><br>                            <br /><br>                            <asp:Label ID="lblMessage" runat="server" ForeColor="Red" Visible="true" BorderColor="Aquamarine"></asp:Label><br>                            <telerik:RadWindowManager ID="RadWindowManager1" runat="server"><br>                            </telerik:RadWindowManager><br>                            <asp:SqlDataSource ID="dsTimesheetDetails" runat="server" ConnectionString="<%$ ConnectionStrings:TempusConn %>"<br>                                SelectCommand="dbo.TempusTimeSheetDetails_Select" SelectCommandType="StoredProcedure"<br>                                UpdateCommand="dbo.TempusTimeSheetDetails_Update" UpdateCommandType="StoredProcedure"<br>                                InsertCommand="dbo.TempusTimeSheetDetails_Insert" InsertCommandType="StoredProcedure"<br>                                DeleteCommand="dbo.TempusTimeSheetDetails_Delete" DeleteCommandType="StoredProcedure"><br>                                <SelectParameters><br>                                    <asp:SessionParameter Name="TimeSheetID" Type="Int32" /><br>                                </SelectParameters><br>                                <UpdateParameters><br>                                    <asp:SessionParameter Name="TimeSheetID" Type="Int32" /><br>                                    <asp:Parameter Name="Sequence" Type="Int32" /><br>                                    <asp:Parameter Name="BillingType" Type="String" /><br>                                    <asp:Parameter Name="AssignmentID" Type="Int32" /><br>                                    <asp:Parameter Name="OverrideTaskDescription" Type="String" /><br>                                    <asp:Parameter Name="Day1Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day2Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day3Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day4Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day5Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day6Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day7Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="TotalTaskHours" Type="Decimal" /><br>                                </UpdateParameters><br>                                <InsertParameters><br>                                    <asp:SessionParameter Name="TimeSheetID" Type="Int32" /><br>                                    <asp:Parameter Name="Sequence" Type="Int32" Direction="Output" /><br>                                    <asp:Parameter Name="BillingType" Type="String" /><br>                                    <asp:Parameter Name="AssignmentID" Type="Int32" /><br>                                    <asp:Parameter Name="OverrideTaskDescription" Type="String" /><br>                                    <asp:Parameter Name="Day1Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day2Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day3Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day4Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day5Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day6Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="Day7Hours" Type="Decimal" /><br>                                    <asp:Parameter Name="TotalTaskHours" Type="Decimal" /><br>                                </InsertParameters><br>                                <DeleteParameters><br>                                    <asp:SessionParameter Name="TimeSheetID" Type="Int32" /><br>                                    <asp:Parameter Name="Sequence" Type="Int32" /><br>                                </DeleteParameters><br>                            </asp:SqlDataSource><br><br><br>                            <asp:SqlDataSource ID="dsBillingTypeLookup" runat="server" ConnectionString="<%$ ConnectionStrings:TempusConn %>"<br>                                SelectCommand="dbo.TempusBillingTypes_Select"></asp:SqlDataSource><br>                            <asp:SqlDataSource ID="dsEmployeeAssignments" runat="server" ConnectionString="<%$ ConnectionStrings:TempusConn %>"<br>                                SelectCommand="dbo.Tempus_SelectEmployeeAssignments" SelectCommandType="StoredProcedure"><br>                                <SelectParameters><br>                                    <asp:SessionParameter Name="TempusUserID" Type="Int32" /><br>                                </SelectParameters><br>                            </asp:SqlDataSource><br><br><br><br><br>                        </fieldset><br>                    </td><br>                </tr><br>            </table><br>        </div><br>        <br /><br>        <div class="footer"><br>           <br>        </div><br>    </div><br>    </form><br></body><br></html>


3 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 06 May 2011, 10:53 AM
Hello S,

Try handling the ItemInserted event of the grid and see if any error is caught there.
For catching errors in this event, you can take a look at this demo.

All the best,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Soozequeue
Top achievements
Rank 1
answered on 06 May 2011, 04:08 PM
Iana - thank you, however, the event is not firing.

If I click on Add item or Edit item, the cursor "circles" and nothing happens.  I can see the javascript command in the bottom of the browser in Chrome, but the event is never fired.  I have breakpoints in the event handler and we never get there.
0
Iana Tsolova
Telerik team
answered on 09 May 2011, 02:33 PM
Hi S,

The ItemInserted event is fired when you have automatic operations enabled for RadGrid and after you click the Insert button to insert new record. If you want to handle the "Add New Record" and "Edit" buttons click, try attaching a handler for the ItemCommand server-side event:
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if(e.CommandName == "InitInsert")
    {
        //Add New Record button clicked
    }
    if(e.CommandName == "Edit")
    {
        //Edit button clicked for item e.Item
    }
}


Best wishes,
Iana
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Soozequeue
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Soozequeue
Top achievements
Rank 1
Share this question
or