版本FineUI v4.1.2
BUG描述,浏览器IE11,IE10,谷歌浏览器均会错误。
1.点击重新绑定数据,直接报JS错误
地址:http://www.fineui.com/demo/#/demo/grid/grid_pageitems.aspx
2.修改每页记录数,直接报JS错误
http://www.fineui.com/demo/#/dem ... items_pagesize.aspx
3.修改每页记录数,直接报JS错误
http://www.fineui.com/demo/#/dem ... esize_database.aspx
问题如何发现?,和我的疑问:
我在开发时在给PageLoad事件给GRID设置一个初始的PageSize大小,页面打开以后,我通过DropDownList修改这个PageSize的时候会出现错误(当选择的每页显示数量大于总记录数时会报错,小于则不会。),然后我就来官方看“在线示例”,结果也发现了错误,但是和我错误不一样。希望三石先生可以修复一下。
代码如下:
aspx
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AgentList.aspx.cs" Inherits="HBHSYS.UI.Agent.AgentList" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- </head>
- <body>
- <form id="form1" runat="server">
- <f:PageManager ID="PageManager1" AutoSizePanelID="Panel1" runat="server" />
- <f:Panel ID="Panel1" Layout="Fit" BoxConfigAlign="Stretch" BoxConfigPosition="Start" ShowBorder="true" ShowHeader="false" Title="待审核加盟商"
- runat="server">
- <Toolbars>
- <f:Toolbar ID="toolBar" runat="server">
- <Items>
- <f:TextBox ID="txtUserName" ShowLabel="true" Label="公司名称" MaxLength="50" LabelWidth="70px" CssClass="marginr" runat="server">
- </f:TextBox>
- <f:TextBox ID="txtContactName" ShowLabel="true" Label="联系人" MaxLength="50" LabelWidth="70px" CssClass="marginr" runat="server">
- </f:TextBox>
- <f:TextBox ID="txtPhone" ShowLabel="true" Label="公司电话" MaxLength="50" LabelWidth="70px" CssClass="marginr" runat="server">
- </f:TextBox>
- <f:Button ID="btnSearch" runat="server" Text="查询" Icon="Magnifier"></f:Button>
- <f:Button ID="Button1" runat="server" Text="查询" Icon="Magnifier"></f:Button>
- </Items>
- </f:Toolbar>
- </Toolbars>
- <Items>
- <f:Grid ID="Grid1" ShowBorder="false" ShowHeader="false" CssStyle="border-top:1px solid #157fcc;"
- AllowPaging="true" runat="server" EnableCheckBoxSelect="false" ForceFit="true"
- EnableTextSelection="true" PageSize="10"
- DataKeyNames="AgentID" IsDatabasePaging="true">
- <Columns>
- <f:BoundField DataField="AgentName" HeaderText="公司名称" />
- <f:BoundField DataField="BossName" HeaderText="法人姓名" />
- <f:BoundField DataField="BossContact" HeaderText="法人联系方式" />
- <f:BoundField DataField="CooperationType" HeaderText="合作类型" />
- <f:BoundField DataField="CautionMoney" HeaderText="保证金" DataFormatString="¥{0:F}" />
- <f:TemplateField HeaderText=" 操 作 " Width="60">
- <ItemTemplate>
- <f:HiddenField Text='<%#Eval("AgentID") %>' ID="hdfAgentID" runat="server"></f:HiddenField>
- <asp:LinkButton ID="lbkDoProcess" runat="server">处 理</asp:LinkButton>
- <asp:LinkButton ID="lbkDetail" runat="server">详 情</asp:LinkButton>
- </ItemTemplate>
- </f:TemplateField>
- </Columns>
- <PageItems>
- <f:ToolbarSeparator ID="ToolbarSeparator3" runat="server">
- </f:ToolbarSeparator>
- <f:ToolbarText ID="ToolbarText1" runat="server" Text="每页记录数:">
- </f:ToolbarText>
- <f:DropDownList ID="ddlGridPageSize" Width="80px" AutoPostBack="true" OnSelectedIndexChanged="ddlGridPageSize_SelectedIndexChanged"
- runat="server">
- <f:ListItem Text="10" Value="10" />
- <f:ListItem Text="20" Value="20" />
- <f:ListItem Text="50" Value="50" />
- <f:ListItem Text="100" Value="100" />
- </f:DropDownList>
- <f:ToolbarSeparator ID="ToolbarSeparator2" runat="server">
- </f:ToolbarSeparator>
- <f:Button Text="清空筛选条件&重新绑定数据" runat="server" ID="btnRebind" Icon="Reload">
- </f:Button>
- </PageItems>
- </f:Grid>
- </Items>
- </f:Panel>
- </form>
- </body>
- </html>
复制代码
aspx.cs
- using System;
- using System.Collections.Generic;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using FineUI;
- using HBHSYS.BLL;
- namespace HBHSYS.UI.Agent
- {
- public partial class AgentList : System.Web.UI.Page
- {
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!IsPostBack)
- {
- Grid1.EmptyText = String.Format("<img src="{0}" alt="No Data Found!"/>", ResolveUrl("~/images/no_data_found.jpg"));
- BindGrid();
- ddlGridPageSize.SelectedValue = Grid1.PageSize.ToString();
- }
- }
- void BindGrid()
- {
- int total = 0;
- string condition = " 1=1";
- if (!string.IsNullOrWhiteSpace(txtUserName.Text))
- {
- condition += " AND AgentName like '%" + txtUserName.Text + "%'";
- }
- if (!string.IsNullOrWhiteSpace(txtContactName.Text))
- {
- condition += " AND ContactName like '%" + txtContactName.Text + "%'";
- }
- if (!string.IsNullOrWhiteSpace(txtPhone.Text))
- {
- condition += " AND Phone like '%" + txtPhone.Text + "%'";
- }
- condition += " AND Status=0 ";
- DataTable table = CommDataBLL.GetListByPage("hbh_Agent", Grid1.PageSize, Grid1.PageIndex + 1, ref total, condition, "UpdateDate desc");
- Grid1.RecordCount = total;
- Grid1.DataSource = table;
- Grid1.DataBind();
- }
- protected void Grid1_PageIndexChange(object sender, FineUI.GridPageEventArgs e)
- {
- Grid1.PageIndex = e.NewPageIndex;
- BindGrid();
- }
- /// <summary>
- /// 处理重新绑定
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnRebind_Click(object sender, EventArgs e)
- {
- FineUI.PageContext.RegisterStartupScript("window.location.reload()");
- }
- protected void btnSearch1_Click(object sender, EventArgs e)
- {
- Grid1.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
- BindGrid();
- }
- /// <summary>
- /// 处理每页显示记录数
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void ddlGridPageSize_SelectedIndexChanged(object sender, EventArgs e)
- {
- Grid1.PageSize = Convert.ToInt32(ddlGridPageSize.SelectedValue);
- // 更改每页显示数目时,防止 PageIndex 越界
- if (Grid1.PageIndex > Grid1.PageCount - 1)
- {
- Grid1.PageIndex = Grid1.PageCount - 1;
- }
- BindGrid();
- }
- /// <summary>
- /// 刷新按钮事件
- /// </summary>
- /// <param name="sender"></param>
- /// <param name="e"></param>
- protected void btnRefresh_Click(object sender, EventArgs e)
- {
- FineUI.PageContext.RegisterStartupScript("window.location.reload()");
- }
- protected void btnSearch_Click(object sender, EventArgs e)
- {
- BindGrid();
- }
- protected void Grid1_RowCommand(object sender, FineUI.GridCommandEventArgs e)
- {
- var key = Grid1.DataKeys[e.RowIndex][0];
- if (e.CommandName == "DoProcess")
- {
- PageContext.Redirect("AgentDetail.aspx?AgentID=" + key.ToString());
- }
- if (e.CommandName == "Detail")
- {
- PageContext.Redirect("AgentDetail.aspx?AgentID=" + key.ToString());
- }
- }
- protected void Button1_Click(object sender, EventArgs e)
- {
- System.Web.UI.WebControls.LinkButton lkb = (System.Web.UI.WebControls.LinkButton)sender;
- var row = lkb.Parent as GridRowControl;
- var hdfAgentID = row.FindControl("hdfAgentID") as FineUI.HiddenField;
- if (lkb.ID == "lbkDoProcess")
- {
- //PageContext.Redirect("AgentApprove.aspx?AgentID=" + hdfAgentID.Text);
- //PageContext.RegisterStartupScript(String.Format("parent.__doPostBack('','{0}');", tabstrip_iframe_disabled.EVENTARGUMENT_CHECK_TABS_STATUS));
- //TabStrip1.GetAddTabReference("dynamic_tab_baidu1", "http://www.baidu.com/", "Baidu1", IconHelper.GetIconUrl(Icon.Application), true);
- PageContext.RegisterStartupScript("parent.AddTab('AgentApprove','Agent/AgentApprove.aspx','加盟商审核');");
- }
- if (lkb.ID == "lbkDetail")
- {
- //PageContext.Redirect("AgentDetail.aspx?AgentID=" + hdfAgentID.Text);
- PageContext.RegisterStartupScript("parent.AddTab('AgentDetail','Agent/AgentDetail.aspx','加盟商详情');");
- }
- }
- }
- }
复制代码
|