In Place Edit Mode On RowDbclick ,when user changes Row data we Update Record.

2 posts, 0 answers
  1. Sairam
    Sairam avatar
    56 posts
    Member since:
    May 2013

    Posted 16 May 2013 Link to this post

    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
        <style type="text/css">
            .rgHoveredRow
            {
                background-color: #7EB6FF !important;
                background-image: none !important;
                color: White;
            }
        </style>
        <telerik:RadCodeBlock ID="radCode1" runat="server">
        <script type="text/javascript">
            function RowDblClick(sender, eventArgs) {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }

            function RowClick(sender, eventArgs) {
                if (editedRow && hasChanges) {
                    hasChanges = false;
                    if (confirm("Update changes?")) {

                        $find("<%= RadGrid1.ClientID %>").get_masterTableView().updateItem(editedRow);
                    }
                }
            }


             

            function TrackChanges(e) {
                hasChanges = true;
            }
            </script>
            </telerik:RadCodeBlock>

    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
            </telerik:RadScriptManager>
            <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>
            <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
            </telerik:RadAjaxLoadingPanel>
            <telerik:RadGrid ID="RadGrid1" runat="server" OnNeedDataSource="RadGrid1_NeedDataSource" >
                <MasterTableView DataKeyNames="idGcTable" AutoGenerateColumns="false" EditMode="InPlace">
                    <ColumnGroups>
                        <telerik:GridColumnGroup HeaderText="c3" Name="c3" HeaderStyle-HorizontalAlign="Center">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridColumnGroup>
                        <telerik:GridColumnGroup HeaderText="c4" Name="c4" HeaderStyle-HorizontalAlign="Center">
                            <HeaderStyle HorizontalAlign="Center"></HeaderStyle>
                        </telerik:GridColumnGroup>
                    </ColumnGroups>
                    <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"
                        Created="True">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridTemplateColumn UniqueName="c1" HeaderText="c1">
                            <ItemTemplate>
                                <%#Eval("c1")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc1" runat="server"   Text='<%#Eval("c1")%>'></telerik:RadTextBox>
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c2" HeaderText="c2">
                            <ItemTemplate>
                                <%#Eval("c2")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                               <telerik:RadTextBox ID="editc2" runat="server"   Text='<%#Eval("c2" )%>'></telerik:RadTextBox>
                                
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c31" HeaderText="c31" ColumnGroupName="c3">
                            <ItemTemplate>
                                <%#Eval("c31")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc31" runat="server"   Text=' <%#Eval(" c31") %>'></telerik:RadTextBox>
                               
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c32" HeaderText="c32" ColumnGroupName="c3">
                            <ItemTemplate>
                                <%#Eval("c32")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc32" runat="server"   Text=' <%#Eval("c32")%>'></telerik:RadTextBox>
                               
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c41" HeaderText="c41" ColumnGroupName="c4">
                            <ItemTemplate>
                                <%#Eval("c41")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc41" runat="server"   Text='<%#Eval("c41")%>'></telerik:RadTextBox>
                                
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c42" HeaderText="c42" ColumnGroupName="c4">
                            <ItemTemplate>
                                <%#Eval("c42")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc42" runat="server"   Text=' <%#Eval("c42 ")%>'></telerik:RadTextBox>
                               
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                        <telerik:GridTemplateColumn UniqueName="c5" HeaderText="c5">
                            <ItemTemplate>
                                <%#Eval("c5")%>
                            </ItemTemplate>
                            <EditItemTemplate>
                            <telerik:RadTextBox ID="editc5" runat="server"   Text='<%#Eval("c5")%>'></telerik:RadTextBox>
                                
                            </EditItemTemplate>
                        </telerik:GridTemplateColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column" ButtonType="LinkButton" UpdateText="Your Update columnb" CancelText="Cancel" >
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                </MasterTableView>
                <ClientSettings EnableRowHoverStyle="true" >
                <ClientEvents OnRowDblClick="RowDblClick" OnRowClick="RowClick"  />
                </ClientSettings>
                <PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid>
        </div>
        </form>
    </body>
    </html>

    In the above code when user user double click on Row ...I  am display data In Edit mode.but no update or cancel button are there in my grid .

    1.when user change the data  of row and  user  went out of the row ,I want to display the Rad alert based on yes ,I want to update the changes ... and also  click on some other row based on previous changes  ....he is not in same row i am to display the rad alert ,asking for the updation.

    this is my requirement any one please help me.

  2. Kostadin
    Admin
    Kostadin avatar
    1708 posts

    Posted 21 May 2013 Link to this post

    Hello Sairam,

    I would suggest you to review the following live example which demonstrates the same as yours scenario. I noticed that you are actually using some of the JavaScript code but you have to use all of it. For instance the function TrackChanges will never been called in your code, so the code in your RowClick function will never been executed because the hasChanges will always be false.

    Kind regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top