FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 1344|回复: 1
打印 上一主题 下一主题

关于grid不能刷新的问题求助!

[复制链接]
跳转到指定楼层
楼主
发表于 2013-8-13 00:19:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
请先看代码
WebForm1.aspx:

  1. <P> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DepotWeb.WebForm1" %></P>
  2. <P><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "<A href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</A>"></P>
  3. <P><html xmlns="<A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>">
  4. <head runat="server">
  5.     <title></title>
  6. </head>
  7. <body>
  8.     <form id="form1" runat="server">
  9.     <ext:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Grid1" />
  10.     <ext:Grid ID="Grid1" runat="server" EnableCheckBoxSelect="true"
  11.         EnableRowNumber="true" AutoHeight="true"
  12.         Title="操作员管理" DataKeyNames="GroupID" Icon="Table">
  13.         <Toolbars>
  14.         <ext:Toolbar ID="Toolbar1" runat="server">
  15.             <items>
  16.             <ext:Button ID="btnDel" Text="删除选中项" runat="server" Icon="Delete" ConfirmText="确定要删除这些记录吗?"></ext:Button>
  17.             </items>
  18.         </ext:Toolbar>
  19.         </Toolbars>
  20.         <Columns>
  21.         <ext:BoundField DataField="GroupID" HeaderText="编号" Width="50px" />
  22.         <ext:BoundField DataField="GroupName" HeaderText="角色名称" Width="150px" />
  23.         <ext:BoundField DataField="GroupMs" HeaderText="描述" Width="180px" />
  24.         </Columns>
  25.     </ext:Grid>
  26.     </form>
  27. </body>
  28. </html>
  29. </P>
复制代码
WebForm1.aspx.cs
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.UI;
  6. using System.Web.UI.WebControls;
  7. using BLL;
  8. using Entity;

  9. namespace DepotWeb
  10. {
  11. public partial class WebForm1 : System.Web.UI.Page
  12. {
  13. private SystemGroupBLL _sgb = new SystemGroupBLL();
  14. private List<Entity.SystemGroup> _ls = null;
  15. protected void Page_Load(object sender, EventArgs e)
  16. {
  17. btnDel.OnClientClick = Grid1.GetNoSelectionAlertReference("至少选择一项!");
  18. btnDel.Click += new EventHandler(btnDel_Click);
  19. if (!Page.IsPostBack)
  20. {
  21. Bind();
  22. }
  23. }

  24. void btnDel_Click(object sender, EventArgs e)
  25. {
  26. foreach (int row in Grid1.SelectedRowIndexArray)
  27. {
  28. _sgb.Del(int.Parse(Grid1.DataKeys[row][0].ToString()));
  29. }
  30. Bind();
  31. }

  32. private void Bind()
  33. {
  34. _ls = _sgb.Query();
  35. Grid1.DataSource = _ls;
  36. Grid1.DataBind();
  37. }
  38. }
  39. }
复制代码
页面功能很简单,就是对一个grid里的数据进行删除,删除的功能能实现,并能提交到数据库,断点调试Bind()也能得到执行,返回的_ls的数目也是删除后的数目,也能执行Grid1.DataBind(),可页面就是不能刷新,请教各位大神怎么破啊?


沙发
 楼主| 发表于 2013-8-13 23:19:54 | 只看该作者
是没人知道还是不屑于回答这个问题呢?
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-9-29 22:15 , Processed in 0.045001 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表