FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

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

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

搜索
查看: 6746|回复: 3

如何更新ContentPanel里的内容(已经解决)

[复制链接]
发表于 2013-3-30 03:53:17 | 显示全部楼层 |阅读模式
本帖最后由 石头 于 2013-4-1 13:51 编辑

自己做一个可以翻页的列表,里面包含了图片和文字,就是类似如此效果:

代码如下:
<xageManager ID="ageManager1" runat="server" EnableAjax="true" AutoSizePanelID="sf_Main"/>
<x:SimpleForm ID="sf_Main" runat="server" ShowBorder="false" BodyPadding="20px"
                LabelWidth="10px" EnableBackgroundColor="true" ShowHeader="false" AutoScroll="true">
                <Toolbars>
                <x:Toolbar ID="Toolbar1" runat="server">
                <Items>
               
                 <x:TextBox ID="txt_NameOrIdNumber" runat="server" EmptyText="请输入学生姓名或身份证号" />
                  <x:SimpleForm ID="SimpleForm1" runat="server" ShowBorder="false" BodyPadding="0px,10px"
                EnableBackgroundColor="true" ShowHeader="false" LabelWidth="30px">
                <Items>
                 <xropDownList ID="ddl_FullClassName" runat="server" Label="班级" OnSelectedIndexChanged="ddl_FullClassName_SelectedIndexChanged" AutoPostBack="true"/>
                </Items>
                 </x:SimpleForm>
                 <x:Button ID="btn_Import" Icon="DiskUpload" runat="server" Text="导入" />
                  <x:ToolbarFill ID="tbf_t" runat="server"></x:ToolbarFill>
                  <x:Button ID="btn_First" Icon="ResultsetFirst" runat="server" ToolTip="第一页"/>
                  <x:Button ID="btn_Previous" Icon="ResultsetPrevious" runat="server" ToolTip="上一页"/>
                  <x:ToolbarSeparator ID="tbs_t_1" runat="server" />
                  <xabel ID="lblTips" runat="server" Text="转到" />
                  <x:TextBox ID="txt_CurrentPage" runat="server" Width="60px" Text="1" AutoPostBack="true"/>
                  <xabel ID="lbl_TotalPage" runat="server" Text="共1页"/>
                  <x:ToolbarSeparator ID="tbs_t_2" runat="server" />
                  <x:Button ID="btn_Next" runat="server" Icon="ResultsetNext" ToolTip="下一页"/>
                  <x:Button ID="btn_Last" runat="server" Icon="ResultsetLast"  ToolTip="最后一页"/>
                </Items>
                </x:Toolbar>
                </Toolbars>
                <Items>        
         <x:ContentPanel ID="frm_Main" EnableBackgroundColor="true" ShowBorder="true" ShowHeader="false" runat="server" BodyPadding="0px" AutoScroll="true">
         
          <table id="tb_Main" runat="server" cellspacing="0" cellpadding="0" style="text-align:center;"></table>
         </x:ContentPanel>
      
         </Items>
         </x:SimpleForm>

  private void Init_PhotoList(int currentPage)
         {
                                 
            this.Operation.PageSize = 45;
            this.Operation.PageIndex = currentPage;
            IList<StudentD> studentList = this.Operation.GetIList;
            double pageCount = Math.Ceiling((double)studentList.Count /45);
            this.lbl_TotalPage.SetValue(string.Format("共{0}页", pageCount));
            double rowCount = Math.Ceiling((double)studentList.Count / 9);
            for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
            {
                HtmlTableRow row = new HtmlTableRow();
                for (int columnIndex = 0; columnIndex < 9; columnIndex++)
                {
                    int index = rowIndex*9+columnIndex;
                    if (index >= studentList.Count)
                    {
                        break;
                    }
                    HtmlTable table = new HtmlTable();
                    table.Align = "Center";
                    HtmlTableRow row_Photo = new HtmlTableRow();
                    HtmlTableRow row_Name = new HtmlTableRow();
                    string fullClassName = studentList[index].FullClassName.Trim();
                    string className = studentList[index].ClassName.Trim();
                    FineUI.Label lblIDNumber = new FineUI.Label();
                    lblIDNumber.Text = studentList[index].IDNumber.Trim();
                    FineUI.LinkButton lbName = new FineUI.LinkButton();
                    lbName.Text = studentList[index].StudentName.Trim();
                    FineUI.Image imgIDphoto = new FineUI.Image();
                    string fileName = "~/Photo/HeadPhoto/Thumbnail/" + className + "_" + lbName.Text + lblIDNumber.GetValue() + ".jpg";
                    if (File.Exists(Server.MapPath(fileName)))
                    {
                        imgIDphoto.ImageUrl = fileName;
                    }
                    else
                    {
                        imgIDphoto.ImageUrl = "~/Images/HeadPhoto.png";
                    }
                    
                  
                    HtmlTableCell cell_Photo = new HtmlTableCell();
                    cell_Photo.Width = "150";
                    cell_Photo.Controls.Add(imgIDphoto);
                    row_Photo.Cells.Add(cell_Photo);
                    HtmlTableCell cell_Name = new HtmlTableCell();
                    cell_Name.Controls.Add(lbName);
                    cell_Name.Width = "150";
                    row_Name.Cells.Add(cell_Name);
                    table.Rows.Add(row_Photo);
                    table.Rows.Add(row_Name);
                    HtmlTableCell cell = new HtmlTableCell();
                    cell.Controls.Add(table);
                    row.Cells.Add(cell);
                }
                tb_Main.Rows.Add(row);
               
            }
        }
//根据班级名称筛选
protected void ddl_FullClassName_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (!this.ddl_FullClassName.GetValue().Equals(DString.RECORD_ALL))
            {
                this.Operation.AddEq(DColumn.FullClassNameD, this.ddl_FullClassName.GetValue());
            }
            this.pageCount = this.Operation.GetIList.Count;
            this.lbl_TotalPage.SetValue(string.Format("共{0}页", this.pageCount));
            this.txt_CurrentPage.SetValue("1");
            this.tb_Main.Rows.Clear();
            Init_PhotoList(0);

        }
可是发现无法更新 tb_Main里的内容,要显示的内容数据时正确的,就是不能显示在界面上,界面上的内容仍然是旧的,刚才看了几个相关的帖子,也没有找到解决办法,sanshi大哥说看官方例子,可是那个例子是讲Label内容的更新,而我这个是整个Table内容的更新,不知道哪位大师有没有解决的办法?谢谢!

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
发表于 2013-11-29 16:00:42 | 显示全部楼层
请问解决方法是什么? 我也遇到这个问题
发表于 2013-11-29 17:58:43 | 显示全部楼层
能否分享经验
发表于 2018-11-22 11:11:41 | 显示全部楼层
求指教,怎么解决的
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

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

GMT+8, 2024-3-29 16:36 , Processed in 0.047804 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

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