protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindgrvTopic();
}
} protected void grvTopic_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grvTopic.PageIndex = e.NewPageIndex;
BindgrvTopic();
}
protected void BindgrvTopic()
{
this.grvTopic.DataKeyNames = new string[] { "TOPICID" };
grvTopic.DataSource = profileservice.GetAll();
grvTopic.DataBind();
}
catch (Exception exc)
{
Logger.Write(exc.Message.ToString(), "TopicView");
}
}
protected void grvTopic_RowDataBound(object sender, GridViewRowEventArgs e)
{
int topicId = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.DataItemIndex > -1)
{
topicId = Convert.ToInt32(grvTopic.DataKeys[e.Row.DataItemIndex].Value); ImageButton btn1 = e.Row.Cells[0].FindControl("btn1") as ImageButton;
Label lbl = e.Row.Cells[0].FindControl("lbl") as Label;
Image img1 = e.Row.Cells[0].FindControl("img1") as Image;
Image img2 = e.Row.Cells[0].FindControl("img2") as Image;
if (topicService.GetByTopicId(topicId).TopicLevel.ToString() == ConstService.MAINTOPICLEVEL)
{
if (topicService.GetSubTopic(topicService.GetByTopicId(topicId).TopicName).Count > 0)
{
btn1.Visible = true;
}
else
{
img2.Visible = true;
}
}
else
{
e.Row.Visible = false;
img1.Visible = true;
}
}
}
}
分页之后,红色的那里就会报错,说argument out of range
求各位达人帮帮我~~
是这行,不好意思,发了两遍
是这行,不好意思,发了两遍