You just need to do a bit of refactoring, then you can use the same code to render different GridViews
protected override void Render(System.Web.UI.HtmlTextWriter writer)
{
this.RenderGridView(gdvauthors);
this.RenderGridView(otherGridView);
base.Render(writer);
}
private void RenderGridView(GridView gridView)
{
foreach (GridViewRow row in gridView.Rows)
{
if (row.RowType == DataControlRowType.DataRow)
{
row.Attributes["onmouseover"] = "this.style.cursor='hand';this.style.textDecoration='underline';";
row.Attributes["onmouseout"] = "this.style.textDecoration='none';";
row.Attributes["onclick"] = ClientScript.GetPostBackClientHyperlink(gdvauthors, "Select$" + row.DataItemIndex, true);
}
}
}