Tuesday, August 26, 2008

Data row bound event hadling for hyperlink url whit query string

Data row bound event handling for hyper link url whit query string

protected void gvCourseList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink lnkBtn = (HyperLink)e.Row.Controls[2].Controls[0];
if(lnkBtn != null)
{
lnkBtn.NavigateUrl = "AssignMedia.aspx?CourseId=" + gvCourseList.DataKeys[e.Row.RowIndex].Values["CourseId"].ToString();
}

}
}

No comments: