Monday, April 23, 2012

How to Add Hyperlink in Girdview Hader Row in Asp.Net


protected void GrdScheduler_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int m = 1; m < e.Row.Cells.Count; m++)
{
HyperLink hlControl = new HyperLink();
hlControl.ForeColor = System.Drawing.Color.White;
hlControl.Text = e.Row.Cells[m].Text.Split('|')[0];
hlControl.NavigateUrl = "~/ToolTip/FrmCountDetails.aspx?Name=" + e.Row.Cells[m].Text.Split('|')[0] + "&Id=" + e.Row.Cells[m].Text.Split('|')[1] + "&Date=" + RDPFromDate.Text + "";
hlControl.Attributes.Add("OnClick", "var w=window.open(this.href, 'ViewCount', 'height=350, width=600,top=40,left=100,toolbar=no,menubar=no,location=no,resizable=no,scrollbars=yes,status=no');w.focus(); return false;");
hlControl.ToolTip = "Click Here to view Details of " + e.Row.Cells[m].Text.Split('|')[0];
e.Row.Cells[m].Controls.Add(hlControl);
}
}
}
}

1 comment:

  1. Thanks for sharing your info. I really appreciate your efforts and I will be waiting for your further write ups thanks once again.
    Video squeeze page

    ReplyDelete