• ext.net 增删改


    前台代码:

    <form id="form1" runat="server">
        <div>
            <ext:ScriptManager ID="ScriptManager1" runat="server">
            </ext:ScriptManager>
            <ext:Store ID="Store1" runat="server" Height="300px" OnRefreshData="Store1_RefreshData">
                <Reader>
                    <ext:JsonReader>
                        <Fields>
                            <ext:RecordField Name="NO">
                            </ext:RecordField>
                            <ext:RecordField Name="stdname" />
                            <ext:RecordField Name="stdsubject" />
                            <ext:RecordField Name="result" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
            </ext:Store>
            <ext:GridPanel ID="GridPanel1" runat="server" StoreID="Store1" StripeRows="true"
                Height="300px" Title="学生成绩表" TrackMouseOver="true">
                <ColumnModel ID="ColumnModel1" runat="server">
                    <Columns>
                        <ext:Column ColumnID="NO" Header="学号" Sortable="true" DataIndex="NO" Hidden="true">
                        </ext:Column>
                        <ext:Column ColumnID="Stdname" Header="姓名" Sortable="true" DataIndex="stdname" />
                        <ext:Column ColumnID="Stdsubject" Header="姓名" Sortable="true" DataIndex="stdsubject" />
                        <ext:Column ColumnID="Result" Header="成绩" Sortable="true" DataIndex="result" />
                        <ext:CommandColumn>
                            <Commands>
                                <ext:GridCommand Icon="NoteEdit" CommandName="Edit" Text="Edit">
                                    <ToolTip Text="Edit" />
                                </ext:GridCommand>
                                <ext:GridCommand Icon="Delete" CommandName="Delete" Text="Delete">
                                    <ToolTip Text="Delete" />
                                   
                                </ext:GridCommand>
                            </Commands>
                        </ext:CommandColumn>
                    </Columns>
                </ColumnModel>
                <Listeners>
                    <Command Handler="Coolite.AjaxMethods.GridPanel1_Command(command,record.data.NO);" />
                </Listeners>
                <LoadMask ShowMask="true" />
                <BottomBar>
                    <ext:PagingToolbar runat="server" PageSize="10" StoreID="Store1">
                    </ext:PagingToolbar>
                </BottomBar>
                <SelectionModel>
                    <ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server">
                        <CustomConfig>
                            <ext:ConfigItem Name="checkOnly" Value="true" Mode="Raw" />
                        </CustomConfig>
                    </ext:CheckboxSelectionModel>
                </SelectionModel>
            </ext:GridPanel>

     后台:


            [AjaxMethod]
            public void GridPanel1_Command(string command, string id)
            {
                if (command == "Edit")
                {

                 。。。。。。。。。。

                      }

      else if (command == "Delete")
                {

           。。。。。。。。

    }

    二:
    前台

    <DirectEvents>

                <Command OnEvent="Command">

                    <ExtraParams>

                        <extnet:Parameter Name="Id" Value="record.data.Id" Mode="Value" />

                        <extnet:Parameter Name="command" Value="command" Mode="Raw" />

                    </ExtraParams>

                   <Confirmation BeforeConfirm="if (command=='attach') return false;" ConfirmRequest="true" Message="Are you sure you want to delete" Title="Delete" />

                </Command>

            </DirectEvents>

    后台

    protected void Command(object sender, DirectEventArgs e)

        {

            var command = e.ExtraParams["command"].ToString();

            var Id = ConvertHelper.ToInt(e.ExtraParams["Id"].ToString());

            X.Msg.Alert("Command", e.ExtraParams["id"] + " : " + e.ExtraParams["command"]).Show();

        }

  • 相关阅读:
    7.6实战练习
    构造方法的主要应用
    6.0字符串String
    数组冒泡排序
    数组(二维数组)
    5.1数组(一维部分)
    4个方位的三角形和菱形
    4.3循环语句
    控制台输入输出
    4 java语句 4.2条件语句
  • 原文地址:https://www.cnblogs.com/Areas/p/2425844.html
Copyright © 2020-2023  润新知