我在页面加载时使用相同的数据源在同一字段上有一个asp:grid
和一个。加载页面后,任何回发事件表都会刷新并显示空白表,但网格视图仍显示所有记录。asp:table
aspx page
谁能告诉我如何防止刷新asp:table
任何回发事件?
编辑-1
代码Grid
和Table
填写
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataSet ds = new DataSet();
ds = clsTransaction.Select(@"SELECT TOP 10000 A.reid AS [ID],
A.nm AS [Name],
B.nm AS [Server],
CASE WHEN D.nm IS NULL THEN A.nm ELSE D.nm END as [Parent],
CASE WHEN C.nm IS NULL THEN A.nm ELSE C.nm END as [Top Perent],
CASE WHEN A.isparent = 1 THEN 'Not a group reseller' ELSE 'Group reseller' END AS [Is Group]
FROM tblReseller AS A
LEFT OUTER JOIN tblwser B on (A.wsid = B.wsid)
LEFT OUTER JOIN tblReseller AS C ON (A.tparentid = C.acid AND A.wsid = C.wsid)
LEFT OUTER JOIN tblReseller AS D ON (A.parentid = D.acid AND A.wsid = D.wsid)", DataSendBSSWEB.ServerDbEnum.MainSqlServer, false);
#region Table fill
TableRow tr = new TableRow();
TableCell tc = new TableCell();
foreach (DataColumn dc in ds.Tables[0].Columns)
{
tc = new TableCell();
tc.Text = dc.ColumnName;
tr.Cells.Add(tc);
}
tblview.Rows.Add(tr);
foreach (DataRow dr in ds.Tables[0].Rows)
{
tr = new TableRow();
foreach (object obj in dr.ItemArray)
{
tc = new TableCell();
tc.Text = obj.ToString();
tr.Cells.Add(tc);
}
tblview.Rows.Add(tr);
}
#endregion
#region Grid Fill
grvView.DataSource = ds.Tables[0];
grvView.DataBind();
grvView.EnableViewState = true;
#endregion
}
}