婷婷综合国产,91蜜桃婷婷狠狠久久综合9色 ,九九九九九精品,国产综合av

主頁(yè) > 知識(shí)庫(kù) > GridView自定義刪除操作的具體方法

GridView自定義刪除操作的具體方法

熱門(mén)標(biāo)簽:世紀(jì)佳緣地圖標(biāo)注怎么去掉 外呼系統(tǒng)費(fèi)用一年 巫師3為什么地圖標(biāo)注的財(cái)寶沒(méi)有 怎么給超市做地圖標(biāo)注入駐店 手機(jī)地圖標(biāo)注如何刪除 十堰正規(guī)電銷(xiāo)機(jī)器人系統(tǒng) 寧波自動(dòng)外呼系統(tǒng)代理 辦理400電話(huà)證件 外呼系統(tǒng)代理品牌

首先,我們前端的代碼如下:

復(fù)制代碼 代碼如下:

asp:GridView ID="gridViewDxjk" CssClass="gridview" runat="server" AllowPaging="True"
                  DataKeyNames="P_ID" AutoGenerateColumns="False" 
                      RowStyle-HorizontalAlign="Center" BorderWidth="1px" PageSize="17"
                      onrowdeleting="gridViewDxjk_RowDeleting"
                      OnRowDataBound="gridViewDxjk_RowDataBound"
                      onpageindexchanging="gridViewDxjk_PageIndexChanging" >
                        HeaderStyle CssClass="head" />
                        PagerStyle CssClass="pager" />
                        RowStyle CssClass="row" />
                        EditRowStyle CssClass="editrow" />
                        AlternatingRowStyle CssClass="altrow" />
                        EmptyDataRowStyle CssClass="empty" />
                        Columns>                           
                         asp:HyperLinkField HeaderText="編輯" ControlStyle-Width="50" DataNavigateUrlFields="P_ID" DataNavigateUrlFormatString="smsModify.aspx?id={0}" Text="編輯"  >
                                ControlStyle Width="50px">/ControlStyle>/asp:HyperLinkField>
                                asp:CommandField  ShowDeleteButton="true" DeleteText="刪除"   >
                                ControlStyle Width="50px">/ControlStyle>/asp:CommandField>
                                asp:BoundField DataField="P_ID" HeaderText="id" SortExpression="P_ID" ItemStyle-HorizontalAlign="Center"  Visible="False" >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_NAME" HeaderText="名稱(chēng)" SortExpression="P_NAME" />
                                asp:BoundField DataField="P_Type" HeaderText="通知方式" SortExpression="P_Type" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_Fzr" HeaderText="姓名" SortExpression="P_Fzr" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_tel" HeaderText="通知手機(jī)" SortExpression="P_tel" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_jg" HeaderText="通知間隔(小時(shí))" SortExpression="P_jg" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_on" HeaderText="是否開(kāi)啟" SortExpression="P_on" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_lasttime" HeaderText="最后發(fā)送時(shí)間" SortExpression="P_lasttime" ItemStyle-HorizontalAlign="Center"  >
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                                asp:BoundField DataField="P_memo" HeaderText="備注" SortExpression="P_memo" ItemStyle-HorizontalAlign="Center"  >                  
                                ItemStyle HorizontalAlign="Center">/ItemStyle>/asp:BoundField>
                        /Columns>
                        EmptyDataTemplate>
                        沒(méi)有數(shù)據(jù)!
                        /EmptyDataTemplate>
                         PagerTemplate>
                        table width="100%" class="gvPage" style="font-size:12px;">
                            tr>
                            td style="text-align: right">
                                第asp:Label ID="lblPageIndex" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'>/asp:Label>頁(yè)
                                /共asp:Label ID="lblPageCount" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageCount %>'>/asp:Label>頁(yè)nbsp;nbsp;
                              asp:LinkButton ID="LinkButtonFirstPage" runat="server" CommandArgument="First" CommandName="Page" Visible="%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">首頁(yè)/asp:LinkButton>
                              asp:LinkButton ID="LinkButtonPreviousPage" runat="server" CommandArgument="Prev" CommandName="Page"  Visible="%# ((GridView)Container.NamingContainer).PageIndex != 0 %>">上一頁(yè)/asp:LinkButton>
                              asp:LinkButton ID="LinkButtonNextPage" runat="server" CommandArgument="Next" CommandName="Page"  Visible="%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">下一頁(yè)/asp:LinkButton>
                              asp:LinkButton ID="LinkButtonLastPage" runat="server" CommandArgument="Last" CommandName="Page"  Visible="%# ((GridView)Container.NamingContainer).PageIndex != ((GridView)Container.NamingContainer).PageCount - 1 %>">尾頁(yè)/asp:LinkButton>
                              asp:TextBox ID="txtNewPageIndex" runat="server" Text='%# ((GridView)Container.Parent.Parent).PageIndex + 1 %>'  Width="20px" AutoPostBack="true" >/asp:TextBox>
                              asp:LinkButton ID="btnGoEx" runat="server" CommandArgument="GO" CommandName="Page" Text="GO" OnClick="btnGoEx_Click">/asp:LinkButton>
                            /td>
                            /tr>
                        /table>
                    /PagerTemplate>
                 /asp:GridView>

后端的話(huà),由于需要彈出刪除前的確認(rèn)框,所以,我們需要在RowDataBound里面做點(diǎn)什么?同時(shí),要想真正的刪除,還需要觸發(fā)RowDeleting事件,具體代碼如下:

復(fù)制代碼 代碼如下:

//報(bào)警刪除
        protected void gridViewDxjk_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            string key = gridViewDxjk.DataKeys[e.RowIndex].Value.ToString();
            bool flag = bll.Delete(Int32.Parse(key));
            if (flag)
                NXT_WLService.App_Code.JScript.Alert("刪除成功!", this);
            else
                NXT_WLService.App_Code.JScript.Alert("刪除失??!", this);
        }

       
        protected void gridViewDxjk_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                LinkButton btn = (LinkButton)e.Row.Cells[1].Controls[0];
                if (btn.Text.Equals("刪除"))//刪除鈕才加提示訊息 
                    btn.OnClientClick = "if (confirm('你確認(rèn)要?jiǎng)h除?')) javascript:__doPostBack('gridViewDxjk','Delete$" + e.Row.RowIndex.ToString() + "'); else return false;";
            }
        }

您可能感興趣的文章:
  • GridView分頁(yè)的實(shí)現(xiàn)以及自定義分頁(yè)樣式功能實(shí)例
  • GridView自定義分頁(yè)的四種存儲(chǔ)過(guò)程
  • C#自定義DataGridViewColumn顯示TreeView
  • yii2.0之GridView自定義按鈕和鏈接用法
  • 自定義GridView并且實(shí)現(xiàn)拖拽(附源碼)
  • asp.net gridview自定義value值的代碼
  • asp.net gridview分頁(yè):第一頁(yè) 下一頁(yè) 1 2 3 4 上一頁(yè) 最末頁(yè)
  • asp.net中的GridView分頁(yè)問(wèn)題
  • Android入門(mén)之ActivityGroup+GridView實(shí)現(xiàn)Tab分頁(yè)標(biāo)簽的方法
  • asp.net Gridview分頁(yè)保存選項(xiàng)
  • 基于GridView和ActivityGroup實(shí)現(xiàn)的TAB分頁(yè)(附源碼)
  • GridView自定義分頁(yè)實(shí)例詳解(附demo源碼下載)

標(biāo)簽:泰州 牡丹江 天門(mén) 景德鎮(zhèn) 山西 通遼 嘉興

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《GridView自定義刪除操作的具體方法》,本文關(guān)鍵詞  GridView,自定義,刪除,操作,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問(wèn)題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無(wú)關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《GridView自定義刪除操作的具體方法》相關(guān)的同類(lèi)信息!
  • 本頁(yè)收集關(guān)于GridView自定義刪除操作的具體方法的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章
    主站蜘蛛池模板: 惠州市| 于田县| 吴忠市| 那坡县| 安陆市| 石棉县| 竹溪县| 聂拉木县| 平谷区| 高雄市| 嘉荫县| 邹平县| 珲春市| 洛宁县| 察雅县| 和硕县| 齐河县| 桓台县| 手游| 江西省| 平利县| 海兴县| 普兰县| 东乌珠穆沁旗| 常山县| 崇文区| 明水县| 霞浦县| 三明市| 灌南县| 永平县| 沙湾县| 吕梁市| 永顺县| 综艺| 武功县| 元江| 普陀区| 德安县| 长丰县| 枝江市|