Is there a way to add extra control to header of a Grid column, but still keep the default column name? thanks

I am using Grid, and I add template field

<asp:TemplateField HeaderText="name" SortExpression="something">
if I want to have special header, I can use HeaderTemplate, but with HeaderTemplate added ,the headertext will not show, if there a way I can just add a control beside the headertext? since I don't want to handle the column sort.


2/14/2007 9:08:58 PM 72751 articles. 3 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 36

I am sure there is a better way to do this, but in the past I have used the following method although I left out the commandname and arguments

protected void GridView1_DataBound(object sender, EventArgs e)


string celltext = GridView1.HeaderRow.Cells[1].Text;

LinkButton myt = new LinkButton();

myt.ID =


myt.Text =

"Hello There";

myt.Text = celltext;


2/14/2007 9:42:18 PM

Similar Artilces:

how to get a control ID from a bind field name / bound field (column) name from a formview's control
I have a form view which is bound to a table, now from codebehind file I need to apply some formatting based on some of the field's bound control. For example, if Formview1 is bound to Employee table, and it's item template has a control with ID "Label1" which is bound to "EmployeeJoinDate" . Now, I have a different table which has a list of field name(EmployeeJoinDate is one of them), all of which should be applied some formatting based on some condition. Now I can take two approach for that, but I am stuck at both:  1. If I can somehow get the contro...

How to put column names at the top of my Grid control
I have a Grid control on my web form. It works great but I don't know how to get a column name to appear at the top of each column. For example my first column should be named Customer and My second column Status. If you notice, my Eval tags bind to column entries named "Name" and "Active"  <asp:GridView ID="DeveloperView" runat="server" AutoGenerateColumns="False" CellPadding="4"  ForeColor="Black" GridLines="None" OnRowCreated="PeopleView_RowCreated" Width="265px" Height=...

Add Custom Control to GridView Column Header
I am trying to add a custom control to the column header in a grid view. I am doing this on RowDataBound, but that might be incorrect. The ultimate goal is to have the Custom Control appear next tot the HeaderText and still allow the HeaderText to sort the columns. Here is my code:1 If e.Row.RowType = DataControlRowType.Header Then 2 Dim oCell As System.Web.UI.WebControls.TableCell 3 For Each oCell In e.Row.Cells 4 Dim oHelp As New admin_controls_HelpItem 5 oHelp.ID = "hlpItem" 6 oHelp.Help...

Is there a way to make Grid Columns resizable for a GridView control?
I am using a GirdView control in ASP.NET 2.0. (<asp:GridView)Does anyone know if there is a way to make the columns resizeable to that the application user can resize the columns. You see my screen space is crowded because of the number of columns in the grid.     Check out this blog post:Creating a GridView with Resizable Column Headers Darrell Norton, MVPDarrell Norton's BlogPlease mark this post as answered if it helped you!...

How do I add a default value to a DB column in a Template Control ?
Hi ; Can you set a bound DB field to a default value in the EditItem template control ? Thanks, GMann     Yes.  Like so:  <asp:TemplateField HeaderText="Question" SortExpression="Name"> <ItemTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Bind("Name") %>' /> </ItemTemplate> <EditItemTemplate> <asp:TextBox ID="txtGvName" runat="server" Text='<%# Bind("Name") %>' Max...

Add update panel as template column in Grid View control
Hi friends, I have a problem. I want to add update panel or some other functionality of Ajax in Grid view control to edit and save purpose. There should be 3-4 check box appears in update panel and one save button. On click of save button all values of checkboxes should be saved in database. If anybody have any idea about this please let me know asap. Hi,I have tested this scenario, but it works fine on my pc.   <form id="form1" runat="server"> <div>     <asp:ScriptManager ID="ScriptManager1"...

Grid Control Columns
Hi: I want to set the columns dynamically for a query for two columns using SetDataColumns. For one column it is dw_1->SetDataColumns("Party_nm"); The mini help P++ provides indicates that for multiple columns this should work: dw_1->SetDataColumns("Party_nm";Party_tp"); but it does not. The compiler responds with a syntax error indicating a missing semicolon. Does anyone have experience with this and give me a sample of syntax that works? Thanks Jim Nicely BTW Take the above sample line out of the code and everything else works ok including the si...

How I can get the column header name when i clicked on the concerned column header
Hi All I had a problem in getting the columnheader name . I had tried with dw.getcolumnname but not successfull . I was in very big dilema where to write the code(i mean what 'event') . Suppose i had a fullname as my columnheader then i should able to get the fullname when i click on that column. thanks vasu Vasu: You will want to code this in the clicked event. You can look at GetBandatPointer() and GetObjectatPointer() functions in help. HTH, Austin "vasu" <> wrote in message ...

New ajax control request: rich grid with resizable columns and fixed header
I like 2.0. A giant step forward has been made by including the menu. The only thing I'm still missing is a grid. A grid with resizable columns and fixed headers. A grid like excel. Does anyone know if Microsoft is planning on including a control like this into the ajax control library?...

List View Control with data pager control in VS2008. Is it possible to make a column invisible and still maintain all paging and sorting?
 I am trying these new controls and want to know if I have a check box (not shown in the code snippet) that when selected means that the user doesn't want to see a column displayed - can this entire column, header and associated data column?  <asp:ListView ID="ListView1" runat="server" DataSourceID="ObjectDataSource1"  OnItemDataBound="ListView_ItemDataBound"  >        <LayoutTemplate>                  &...

this.Controls.Add does not add control to child collection (this.Controls.Count == 0)
Ok, as silly as it may sound, I have a situation where I am creating a CompositeControl in ASP.NET 2.0, C#. I have the following code in the CreateChildControls() method that build the control's child control collection: 1    for (int i = 0; i < _menus.Count; i++)2    this.Controls.Add(_menus[i]);3    4    foreach (FloatingMenu menu in _menus)5    {6    Label lbl = new Label();7    lbl.ID = string.Concat("GroupQ", menu.ID);8    lbl.CssClass = "menuIt...

How can I control the width of a column in the GridView control.
From searching I see mention of ways to do it before the controls are bound. Is there a simpler way? If not, could someone explain to me how I need to go about it?Here is the code: <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"        DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display."        OnSelectedIndexChanged="GridView1_SelectedIndexChanged">   &nbs...

Add .Net Control to Web Custom Control
 I want to add .NET Control (like: TextBox, Button...) to Web Custom Control.How i can do it? Alphavn That's called a composite control -- "Mark As Answer" if my reply helped you -- Hello Guys What gunteman said, that is one approach and in most cases the right one.But its also possible to add child controls to a Control thats inherit from WebControl itself. Be sure to implement INamingContainer to that inherited Control too, thats the important point of that approach.--Microsoft MVP - Visual Developer ASP / ASP.NET-

Showing my own column names instead of database column names in datagridview-windows app.
HiI already bind a DataGridView to a databse. My DataGridView is showing column names as it is in the table. I want to show user-friendly column names in the grid instead of column names in the database table. Please help me in this reagard. Thanx in advance Your statement indicates to me that your columns are dynamically added to the grid, that's why it's showing the database column names. You can show user-friendly column names by changing your query like so: SELECT fName as 'First Name' FROM Users.DarmarkMark as Answer, if this reply answers your post. Go to "E...

Web resources about - Is there a way to add extra control to header of a Grid column, but still keep the default column name? thanks -

Control - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

Otway fire still out of control but no threat to Falls Festival
Firefighters are battling to contain an out-of-control Great Otway National Park fire ahead of an expected hot and windy weather spike on Christmas ...

Review: Sugr Cube, the cute wooden portable AirPlay speaker with gesture controls
... rarer, pretty ones even rarer and the Sugr Cube goes one step further in its bid to stand out from the crowd: it offers gesture-based control. ...

Dell Issues Patch For Content Adaptive Brightness Control On The XPS 13
... issues, as all devices do. One that was very frustrating to deal with during the review was the aggressive Content Adaptive Brightness Control ...

This is how Amazon is taking control of delivery – and taking it away from UPS
As Amazon searches for ways to speed up delivery, the company this year made big strides toward cutting out the middle man and establishing a ...

Virginia AG Ends Concealed Reciprocity with 25 States for Lack of Gun Control
Virginia AG Ends Concealed Carry Reciprocity With 25 States For Lack Of Gun Control

Afghan officials: Key district besieged by Taliban still under state control
"Taliban rumors that they have captured the district are not true," says local official trapped for 3 days before government reinforcements arrived ...

Taliban forces take control of key district in Afghanistan's Helmand province
CNN Taliban forces take control of key district in Afghanistan's Helmand province CNN Kabul, Afghanistan (CNN) Taliban forces have taken almost ...

NBA Stars Come Out In Support Of Gun Control
NBA Stars Come Out In Support Of Gun Control

How Sepp Blatter Lost Control Of His Monster
If Sepp Blatter could take a step back and look at the bigger picture, forgetting for a moment that today’s eight-year ban from all soccer activities ...

Resources last updated: 12/25/2015 8:57:15 AM