FineUI 官方论坛
标题:
关于grid不能刷新的问题求助!
[打印本页]
作者:
老李
时间:
2013-8-13 00:19
标题:
关于grid不能刷新的问题求助!
请先看代码
WebForm1.aspx:
<P> <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="DepotWeb.WebForm1" %></P>
<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>
<P><html xmlns="<A href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</A>">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<ext:PageManager ID="PageManager1" runat="server" AutoSizePanelID="Grid1" />
<ext:Grid ID="Grid1" runat="server" EnableCheckBoxSelect="true"
EnableRowNumber="true" AutoHeight="true"
Title="操作员管理" DataKeyNames="GroupID" Icon="Table">
<Toolbars>
<ext:Toolbar ID="Toolbar1" runat="server">
<items>
<ext:Button ID="btnDel" Text="删除选中项" runat="server" Icon="Delete" ConfirmText="确定要删除这些记录吗?"></ext:Button>
</items>
</ext:Toolbar>
</Toolbars>
<Columns>
<ext:BoundField DataField="GroupID" HeaderText="编号" Width="50px" />
<ext:BoundField DataField="GroupName" HeaderText="角色名称" Width="150px" />
<ext:BoundField DataField="GroupMs" HeaderText="描述" Width="180px" />
</Columns>
</ext:Grid>
</form>
</body>
</html>
</P>
复制代码
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Entity;
namespace DepotWeb
{
public partial class WebForm1 : System.Web.UI.Page
{
private SystemGroupBLL _sgb = new SystemGroupBLL();
private List<Entity.SystemGroup> _ls = null;
protected void Page_Load(object sender, EventArgs e)
{
btnDel.OnClientClick = Grid1.GetNoSelectionAlertReference("至少选择一项!");
btnDel.Click += new EventHandler(btnDel_Click);
if (!Page.IsPostBack)
{
Bind();
}
}
void btnDel_Click(object sender, EventArgs e)
{
foreach (int row in Grid1.SelectedRowIndexArray)
{
_sgb.Del(int.Parse(Grid1.DataKeys[row][0].ToString()));
}
Bind();
}
private void Bind()
{
_ls = _sgb.Query();
Grid1.DataSource = _ls;
Grid1.DataBind();
}
}
}
复制代码
页面功能很简单,就是对一个grid里的数据进行删除,删除的功能能实现,并能提交到数据库,断点调试Bind()也能得到执行,返回的_ls的数目也是删除后的数目,也能执行Grid1.DataBind(),可页面就是不能刷新,请教各位大神怎么破啊?
作者:
老李
时间:
2013-8-13 23:19
是没人知道还是不屑于回答这个问题呢?
欢迎光临 FineUI 官方论坛 (https://fineui.com/BBS/)
Powered by Discuz! X3.4