.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Need to remove the border from gridview header

Posted By:      Posted Date: October 21, 2010    Points: 0   Category :ASP.Net

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;

            Label lblSeparator = new Label();
            lblSeparator.Text = this.HeaderLinkSeparator;

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

View Complete Post

More Related Resource Links

Create ToolTip for GridView Header

The following allows you to add a tooltip to the header links of your GridView, a feature that is lacking.

How to Fixed GridViews Header and Footer when scrolling in asp.net?

This article is to show you how to Fix GridView''s Header and Footer in a simple code with CSS and JavaScript

Custom Grid View Header - Grid view Row Created event vs Gridview row databound events ?


Hi Gurus ,

It happened to add an extra Gridveiw Header in row_databound event , It did worked fine on !Postback but disappered on Page.Postback . Quick google search guided me to move the event to Row_Created event and every thing is okay .

Can any expert post some pointers , differnces between grid row_created vs row_databount with some sample table data created dynamically  behaviour of both the events in !Postback and page.Postback .

Thanks a tonne in Advance and  any inputs will be valued and appreciated .

how to Gridview Header should be Stable in asp.net?

HI all, i have gridview with 100 columns,if scorll down records should be comes down but Header of Gridview should be Static, how can i do that.Please help me.Best Regards,Thiru

Sql Server 2005 ( remove header information from query output file "Job 'bustd_Daily_Query_Output_1

Dear All,I have scheduled job for querying output & asve it into particuler folder....but in the top of file i getting the message like "Job 'bustd_Daily_Query_Output_13July09' : Step 1, 'Query1' : Began Executing 2009-07-13 16:32:06"I want to remove this & want output in txt file format without above header....RegardsRavendra Cindia

Footer and Header in Empty GridView

How to make GridView to show Header and Footer when it hasn't got any rows?

Remove Empty Listview Header

Can any one help me to remove the empty header generated at the end of a listview . i am using it to display a gridview of rows.

Programmatically remove IIS HTTP header settings

 Our IIS server (v7) has the following settings in [Custom HTTP Headers] for our whole site: Pragma: no-cacheCache-Control: private, no-cache, no-store, max-age=0, must-revalidate, post-check=0, pre-check=0X-Powered-By: ASP.NET Out of the whole site, there are some pages that require the "no cache" setting to be removed for them to work properly. This was done manually by our IIS Administrator until recently.  Now we were told that we need to do it programmatically on our end. The following were the code snippets (VB.NET) we have used with no luck in success. Advice is appreciated, Thanks! Method-1Response.Headers.Remove("Pragma")Response.Headers.Remove("Cache-Control")Response.Headers.Add("Cache-Control", "private")Response.CacheControl = System.Web.HttpCacheability.public Method-2Response.ClearHeaders()Response.Headers.Clear()Response.CacheControl = "Public"Response.Cache.SetCacheability(HttpCacheability.Public)Response.Cache.SetAllowResponseInBrowserHistory(True)

getting the AutoComplete inside a gridView Header?

 Hi all Could anyone please point me in the right direction to getting the following 'autoComplete Extender' into the Header of the gridView below please  <asp:GridView ID="gvAllData" runat="server" AutoGenerateColumns="False" DataKeyNames="IDNo" DataSourceID="dsAllData" allowPaging="True" allowSorting="True" GridLines="None" CellPadding="4" ForeColor="#333333"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:TextBox runat="server" ID="myTextBox" Width="100" autocomplete="off" /> <cc1:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="myTextBox" ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="2"

How to get Checkbox value created at runtime above gridview header


I have creted a checkbox for each column of grid at the top of the header in row created event. I need to check wheather checkbox is checked after button click event.

//Build custom header.

                GridView oGridView = (GridView)sender;
                GridViewRow oGridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert);
                TableCell oTableCell = new TableCell();

                //Add Staff_ID
                CheckBox chkStaffID = new CheckBox();
                chkStaffID.ID = "chkStaff_ID";
                chkStaffID.Text = "Hide";
                chkStaffID.CheckedChanged += new System.EventHandler(chkStaffID_CheckedChanged);

Gridview Fixed Header Issue


   position:relative ;
   z-index: 10;
2.Assign Datagrid Header's cssClass to Freezing
<HeaderStyle ... CssClass= "Freezing" ...></HeaderStyle>


This is working fine in Internet Explorer but not working in firefox. can anybody please help me to say why its not working in firefox

gridview header formatting



Using C# to develop a web application. Have a gridview to display data from the a sql table.

The headers of the gridview is achieve using a table. Need to format the header cells to align with the columns of the gridview.

Currently I'm using a trial an error method to set the width of the header to align with the gridview columns. Can I align the Table header to concide with the gird view column width progarmatically?

Here is my ASPX code

<div id="ProjectTableHeader" runat="server"
        style="background-color: #993300; height: 40px; width: 300; margin: 0; padding: 0">
        <table cellspacing="0" cellpadding="0" rules="all" border="1" id="tblHeader" style="font-family: Arial;font-size: 10pt; width: 300; color: white; border-collapse: collapse; height: 100%;">
                <td style="width: 64px; text-align: center">
                    Project Owner

Merging gridview header after binding in winforms



Note : I am talking about Winform grid only

I want to bind a grid, structure should look like below after binding with the datatable,


    26_sept            l         27_sept          l            28_sept       l           29_sept

col1 col2 col3 col4 l   col1 col2 col3 col4  l   col1 col2 col3 col4 l  col1 col2 col3 col4

                           l                               l                              l


Here, I have datatable dt 16 columns as below but no parent header

col1 col2 col3 col4 l   col1 col2 col3 col4  l   col1 col2 col3 col4 l  col1 col2

best way to remove (or hide) a gridview column in a custom page


can someone tell what the best way to remove (or hide) a gridview column is within a custom page?

I dont want to show the link column that is automatically generated as a result of the relationship between the table in question and a parent table.



How to Use Same Header Name for Multiple Column in GridView ?



Hi All ,

         This is my  Needed view ,


                           Report1                 |                          Report2                         | - Main Header


SEL1    |  SEL2    | SEL3   |     SEL4   |       SEL1    |  SEL2    | SEL3   |     SEL4   |   - Sub Header



But afte

Gridview Header Columns


I want to change the text in headers in gridviews based on information in a database.  I want to databind to a gridview heading 

remove Column header from List View Webpart


hi, i am having sharepoint 2010 Enterprise RTM trial on Windows server 2008 SP2. I wanted to know how a column header of a list in List View Webpart can be hide ?

i have tried the following article:


but i don't see any source editor in content Editor Weppart and also the Hidden button is disabled....

Is it necessary to do this task from code ?

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend