zoukankan      html  css  js  c++  java
  • telerik:RadGrid 表格中删除数据

    <telerik:RadGrid OnItemCommand="RadGrid1_ItemCommand" AutoGenerateColumns="False" ID="RadGrid1" runat="server" CellSpacing="0"
                                Height="490px" Culture="zh-CN" CssClass="gridTable" GridLines="Both" AllowPaging="True"
                                AllowSorting="true" PageSize="50" OnNeedDataSource="RadGrid1_NeedDataSource" HeaderStyle-HorizontalAlign="Center">
                                <ExportSettings HideStructureColumns="true" ExportOnlyData="true" IgnorePaging="true"
                                    OpenInNewWindow="true" />
                                <PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="True" />
                                <ClientSettings EnableRowHoverStyle="true" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                                    <Resizing AllowColumnResize="True" EnableRealTimeResize="True" />
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                                    <Selecting AllowRowSelect="True" />
                                </ClientSettings>
                                <MasterTableView Width="100%" ClientDataKeyNames="编号" DataKeyNames="编号"
                                    CommandItemDisplay="Top" EditMode="InPlace" >
                                    <Columns>
                                        <telerik:GridTemplateColumn HeaderText="序号" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <%#Container.ItemIndex + 1%>
                                            </ItemTemplate>
                                            <HeaderStyle Width="40" />
                                        </telerik:GridTemplateColumn>
                                        <telerik:GridTemplateColumn HeaderText="描述" >
                                            <ItemTemplate>
                                                <%# Eval("描述")%>
                                            </ItemTemplate>
                                            <HeaderStyle Width="150"></HeaderStyle>
                                            <EditItemTemplate>
                                                <telerik:RadTextBox ID="描述" Width="100%" runat="server" Text=' <%# Eval("描述")%>'></telerik:RadTextBox>
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>                           
                                        <telerik:GridTemplateColumn HeaderText="内容" ItemStyle-HorizontalAlign="Center">
                                            <ItemTemplate>
                                                <%# Eval("内容")%>
                                            </ItemTemplate>
                                            <HeaderStyle Width="50"></HeaderStyle>
                                            <EditItemTemplate>
                                                <telerik:RadTextBox ID="内容"  Width="100%" runat="server" Text=' <%# Eval("内容")%>' ></telerik:RadTextBox>
                                            </EditItemTemplate>
                                        </telerik:GridTemplateColumn>                                
                                        <telerik:GridEditCommandColumn HeaderStyle-Width="6%" UniqueName="Edit" EditText="编辑" HeaderText="编辑" ItemStyle-HorizontalAlign="Center">
                                        </telerik:GridEditCommandColumn>

    <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" ConfirmText="确认要删除吗?" UniqueName="DeleteColumn"
    ConfirmDialogType="Classic" HeaderText="删除" Text="删除" HeaderStyle-Width="5%"
    ItemStyle-HorizontalAlign="Center" ImageUrl="../Skins/Ibm/Content/icons/Delete.gif">
    </telerik:GridButtonColumn>

                                    </Columns>
                                </MasterTableView>
                            </telerik:RadGrid>
     protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
        {
            try
            {
                GridEditableItem item = e.Item as GridEditableItem;
                if (e.CommandName == "Delete")
                {
                    string 编号 = item.GetDataKeyValue("编号").ToString();
                     // 根据编号查询数据 
                    //得到这些数据之后  进行相应的方法处理 进行修改数据
            }
            }
            catch (Exception Exc)
            {
                throw;
            }
        }
  • 相关阅读:
    【组合数学】AGC036C
    【数位贪心】loj#530. 「LibreOJ β Round #5」最小倍数
    【概率dp】vijos 3747 随机图
    【线段树 经典技巧】10.7序列绝对值
    【杂题】10.7爬树
    【组合数学 思维题】10.6种树
    【换根dp】9.22小偷
    【高维前缀和】8.15B. 组合数
    【技巧 dp】1566: [NOI2009]管道取珠
    【经典dp 技巧】8.13序列
  • 原文地址:https://www.cnblogs.com/wrq6/p/9187780.html
Copyright © 2011-2022 走看看