I have a datatables gridview displaying the result of a list. Need inline editting.

I have a datatables gridview displaying the result of a list. Need inline editting.

mervruttmervrutt Posts: 1Questions: 1Answers: 0

it works find for the display, but I would like it to include inline editing. Any ideas how to do this? The code...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>
<%--<script type="text/css" src="/Scripts/DataTables-1.10.18/css/jquery.dataTables.css"></script>--%>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"/>
    <title></title>
<%--<script type="text/javascript" src="https://cdn.datatables.net/v/bs4-4.1.1/jq-3.3.1/dt-1.10.18/datatables.min.js"></script>--%>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.18/js/jquery.dataTables.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $("#GridView2").prepend($("<thead></thead>").append($(this).find("tr:first"))).dataTable();
        $("#GridView2").dataTable();
        $(".sorting").removeClass("sorting");
    });
</script>
</head>
      <div>  
        <asp:GridView runat="server" ID="GridView2"
            ItemType="CSI.Cx360.Provider.EntityFramework.Models.BehaviorListVM" DataKeyNames="UD_BTP_MonthlyDetailGridID" 
            AutoGenerateColumns="false"
            SelectMethod="behaviorList_GetData"
            CellSpacing="0">
            <Columns>
                <asp:DynamicField DataField="BehaviorDescription" />
                <asp:DynamicField DataField="ClientID" HeaderText="Client ID"/>
                <asp:DynamicField DataField="Day1Count" HeaderText="1&nbsp" />
                <asp:DynamicField DataField="Day2Count" HeaderText="2&nbsp" />      
                <asp:DynamicField DataField="Day3Count" HeaderText="3&nbsp" />
                <asp:DynamicField DataField="Day4Count" HeaderText="4&nbsp" />
                <asp:DynamicField DataField="Day5Count" HeaderText="5&nbsp" />
                <asp:DynamicField DataField="Day6Count" HeaderText="6&nbsp" />      
                <asp:DynamicField DataField="Day7Count" HeaderText="7&nbsp" />
                <asp:DynamicField DataField="Day8Count" HeaderText="8&nbsp" />
                <asp:DynamicField DataField="Day9Count" HeaderText="9&nbsp" />
                <asp:DynamicField DataField="Day10Count" HeaderText="10" />
                </Columns>
        </asp:GridView>
    </div>

The aspx.cs fille contains the code for the behaviorList_GetData and that works fine. Any help would be appreciated.

Answers

  • colincolin Posts: 15,240Questions: 1Answers: 2,599

    Hi @mervrutt ,

    Inline editing is part of Editor, an extension for DataTables. This example here demonstrates it. Hope that helps,

    Cheers,

    Colin

This discussion has been closed.