Tuesday, April 8, 2008

Add navigate url for the Datagrid using row data bound event (Template colum Used in hear)- Sanjeewa Sapumana

protected void gvCourseList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
LinkButton lnkAssign = (LinkButton)e.Row.Cells[2].Controls[1];
if (lnkAssign != null)
{
lnkAssign.PostBackUrl = "AssignCourse.aspx?PaperId=" + gvCourseList.DataKeys[e.Row.RowIndex].Values["PaperId"].ToString();
}

LinkButton lnkAssignUser = (LinkButton)e.Row.Cells[3].Controls[1];
if (lnkAssignUser != null)
{
lnkAssignUser.PostBackUrl = "AssignUsers.aspx?PaperId=" + gvCourseList.DataKeys[e.Row.RowIndex].Values["PaperId"].ToString();
}
}
}

1 comment:

Anonymous said...

Hello. This post is likeable, and your blog is very interesting, congratulations :-). I will add in my blogroll =). If possible gives a last there on my blog, it is about the Home Theater, I hope you enjoy. The address is http://home-theater-brasil.blogspot.com. A hug.