views:

4

answers:

0

I have created a custom gridview that show "Select All | Clear All" hyper links in header to select the checkboxes in the gridview. That means that I have added these two hyperlink controls to the gridview header and am not showing the actual column headers.

private void CreateMyHeader()   
{   
    GridViewRow row = new GridViewRow(0, -1, DataControlRowType.Header, DataControlRowState.Normal);   
    TableCell th = new TableHeaderCell();   

    th.HorizontalAlign = HorizontalAlign.Left;   
    th.ColumnSpan = this.Columns.Count+1;   
    th.Font.Bold = false;   
    th.BorderStyle = BorderStyle.None; //Not working   

    HyperLink hlCtl1 = new HyperLink();   
    hlCtl1.ID = "{0}_HeaderLink1";   
    hlCtl1.NavigateUrl = "javascript: SelectAll(true)";   
    hlCtl1.Text = this.HeaderSelectAllLinkText;   
    th.Controls.Add(hlCtl1);   

    Label lblSeparator = new Label();   
    lblSeparator.Text = this.HeaderLinkSeparator;   
    th.Controls.Add(lblSeparator);   

    HyperLink hlCtl2 = new HyperLink();   
    hlCtl2.ID = "{0}_HeaderLink2";   
    hlCtl2.NavigateUrl = "javascript: SelectAll(false)";   
    hlCtl2.Text = this.HeaderClearAllLinkText;   
    th.Controls.Add(hlCtl2);   
    row.Cells.Add(th);   

    this.InnerTable.Rows.AddAt(0, row);   
}

Now, I want to remove the border that is displayed on the header row. How can I remove it? I tried th.BorderStyle = BorderStyle.None; but it didn't work. I need gridlines in the data rows but the header row should not have any border. Please help me!!!