FineUI 官方论坛
标题:
如何更新ContentPanel里的内容(已经解决)
[打印本页]
作者:
石头
时间:
2013-3-30 03:53
标题:
如何更新ContentPanel里的内容(已经解决)
本帖最后由 石头 于 2013-4-1 13:51 编辑
自己做一个可以翻页的列表,里面包含了图片和文字,就是类似如此效果:
代码如下:
<x
ageManager 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>
<x
ropDownList 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" />
<x
abel ID="lblTips" runat="server" Text="转到" />
<x:TextBox ID="txt_CurrentPage" runat="server" Width="60px" Text="1" AutoPostBack="true"/>
<x
abel 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内容的更新,不知道哪位大师有没有解决的办法?谢谢!
作者:
嗨陽
时间:
2013-11-29 16:00
请问解决方法是什么? 我也遇到这个问题
作者:
sanshi
时间:
2013-11-29 17:58
能否分享经验
作者:
小
时间:
2018-11-22 11:11
求指教,怎么解决的
欢迎光临 FineUI 官方论坛 (https://fineui.com/bbs/)
Powered by Discuz! X3.4