我可以在GridView,ASP.NET中绘制另一页的行
我无法解决一件事,我想根据一列绘制GridView的一些行。我对此没有任何问题,但是当我更改页面时,我无法绘画。
这就是我进行分页的方式
GridView2.PageIndex = e.NewPageIndex;
loadgrid();
paintpagin(e.NewPageIndex);
,因此我尝试将其绘制为
GridView2.PageIndex = NewPageIndex;
foreach (GridViewRow Rowe in GridView2.Rows)
{
CheckBox Rc = (CheckBox)Rowe.FindControl("rdaprobar");
RadioButton Ri = (RadioButton)Rowe.FindControl("rdpendiente");
RadioButton Rd = (RadioButton)Rowe.FindControl("rdCandelar");
if (Rc.Checked == true)
{
GridView2.Rows[Rowe.DataItemIndex].BackColor = ColorTranslator.FromHtml("#bcf5be");
}
}
I can't solve one thing, I want to paint some rows of the GridView depending on a column. I have no problems with this, but when I change the page, I can't get it to paint.
This is how I do the pagination
GridView2.PageIndex = e.NewPageIndex;
loadgrid();
paintpagin(e.NewPageIndex);
So I try to paint it
GridView2.PageIndex = newPageIndex;
foreach (GridViewRow Rowe in GridView2.Rows)
{
CheckBox Rc = (CheckBox)Rowe.FindControl("rdaprobar");
RadioButton Ri = (RadioButton)Rowe.FindControl("rdpendiente");
RadioButton Rd = (RadioButton)Rowe.FindControl("rdCandelar");
if (Rc.Checked == true)
{
GridView2.Rows[Rowe.DataItemIndex].BackColor = ColorTranslator.FromHtml("#bcf5be");
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
甚至用于高光,格式化等?
使用网格行数据绑定事件。
因此,首先,我们的标记:
加载的代码:
我们的Pager Code(并注意您在Pager之前的网格负载 - CHEC您的代码!!!)。
好的,我们现在有了这个:
现在,如果每家酒店都活跃,我都会突出显示每家酒店。请注意,非常小心,我在GV中没有该列“活动”,但它是数据源的一部分。因此,对于奖励积分,我演示了如何获取/获取/使用您在GV中不呈现或具有的列,但实际上是数据源的一部分。
因此,我们要突出显示的代码:
因此,我们现在拥有:
所以不要尝试每个GV的行 - 使用上面的行数据绑定以突出显示和格式。
The even to use for highlights, formatting, etc.?
use the Grid row data bound event.
So, first up, our markup:
Code to load:
Our pager code (and NOTE YOU HAVE the load of the grid before the pager - chec your code!!!).
Ok, we now have this:
Now, I highlight each hotel if it is active. NOTE very careful, I don't have that column "active" in the GV, but it was/is part of the data source. So, for bonus points, I demonstrate how to get/grab/use columns that you don't render or have in the GV, but in fact is part of the data source.
So, our code to highlight, we have this:
So, we now have this:
So do NOT try and loop each row of the GV - use the row data bound to highlight and format as per above.