Programmatically Change Datagrid Header Text

Hi,

Can anyone please tell how to programmatically change the header text of a datagrid ?
Thanks
Phillip
0
philliplg
2/6/2004 6:34:42 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

2 Replies
1017 Views

Similar Articles

[PageSpeed] 3

You have to change the header text in the ItemDatabound event.

if(e.Item.ItemType = ListItemType.Header)
{
//If you have placed a label in the header....
Label lbl = e.Item.Controls[1] as Label;
lbl.Text = "New header text";
}
0
Leslu
2/6/2004 10:15:55 AM
Also note that DataGridItem is derived from TableRow so you can do a lot of customizing.
Mike Schellenberger - MCAD
0
schellem
2/6/2004 12:54:30 PM
Reply:

Similar Artilces:

Changing the datagrid header text
Is this possible at all? I have an application that runs in different languages and I want to display the header in the current language (stored in the session). Thanks in advance Heki Yes, it is defenetely possible. You will have to use resource files to achieve that. Idea is - there will be one resource file to store the default string values and one resource file for each language you want to support. So, say i add two resource files to my project: MyForm.resx and MyForm.ru-RU.resx first being the default resource and second containing versions of the strings in Russian. ...

Changing Header Text on a Datagrid
I have headers that post back to sort - I am attempting to change the text with each sort so as to indicate that is the current sort column and the sort direction howevere when I  do something like this it wipes out the link - can anyone please advise how to  thanks in advanve If e.Item.ItemType = ListItemType.Header Then e.Item.Cells(i).Text = "whatever" End If I've never had to do anything like that before, but i think you have to find the link in the header and change the text value. Do a google search, i'm sure something will pop up.  DarmarkMark as Answer, if ...

Change datagrid header text
I have a datagrid and I need to programatically change each column's header text based on user's previous input. I put the code in OnItemDataBound event like this:  if (e.Item.ItemType == ListItemType.Header) {  for (int i = 0; i <= e.Item.Cells.Count - 1; i++)  { e.Item.Cells[i].Text = "something"; } } The header text did get changed, but it changed it into static text which is not clickable so sorting cannot be performed. How do I change the header text but still make sorting enabled?It's been bothering me for a while now ... thanks a lot! Penn i am surprised ...

Datagrid column header text change
How to change the datagrid (MyDatagrid) column hedare text via load event without using itemdatabound event. Datagrid name: MyDatagrid column 2 text = OrderNo Thank you very much for the helpful info.     You can't! The Page.Load event is too early in the Page life cyce. You must wait until the ItemDataBound event or after.Thanks, EdMicrosoft MVP - ASP/ASP.NET Can you please tell me, how to change the header text of datagrid in the itemdatabound.   Thanks.   void DataGrid1_itemDataBound(object sender, DataGridItemEventArgs e)    { &nb...

Change Header Text in the DataGrid on Selection.
Hi,  I have a problem in inserting a combo box in to a Data grid Header which has an Img when click it has to display the Combobox for selection of the new column name.I created a control which has a Span, Select box and an Img when clicks on the Img, it shows the select box for column selection and displays the column name in the span innertext.But i am unable to use the same control for different columns as i used Div for hiding and displaying the combo box. Can you please give me an idea on how to improve these sort of controls, which i can use mulitple times on the same webpag...

Changing Header Text of Datagrid Programatically
I have a datagrid. It is bound to an object data source.  I want to change the header text in one of the columns each time the data changes – which is basically at every postback.   By way of background, I created template fields using the Fields dialog box.  I have listed a portion of the code from the datagrid I am working on below.  I want to programmatically change  the headertext “services”.  I have tried using  findcontrol but I keep getting a null exception.  Any ideas would be appreciated. Thanks   <asp:TemplateField HeaderText=&...

How to change the Header Text of a datagrid column dynamically?
Hi ,  Can any one guide me on how to change the header text of a datagrid column dunamically in code behind? i am using the follwing code in datagrid item databound, but its not working  if (e.Item.ItemType == ListItemType.Header) {  if (Session["RoleID"].ToString() == "6" | Session["RoleID"].ToString() == "13") { e.Item.Cells[5].Text = "Select Record"; }Pradeep My personal way of doing it is to define a custom header. Then I can grab an instance of a lable or literal control in this instance in the ItemdataBound ev...

How to programmatically add user control to the middle of text inside Literal text control ? Pls help...
Greetings fellow programmers,I greatly appreciate all the help I can get. Here is the problem.I have a function that pulls content from the database and put the content into a literal control. Somewhere in that content, I need to insert a user control (bla.ascx). Ideally, I want to use string.replace to find the location where I want to insert the user control. But I can't... there is no such option on the literal control methods and properties.Do I have to overwrite render method? I'd normally use loadcontrol and add it to the placeholder control, but in this case, I can't dynamically ...

Weekdays changing dynamically in Datagrid Column Header Texts
Dear All,I hav a prob.I hav a table t_custinfo containing customer ID,name and personal details.Now I hav a datagrid where in I hav to retrieve custID and custname in two columns.In other columns I need to display weekdays say Mon to Sun with dates..The weekdays hav to change dynamically.In the grid user enters the amount collected from the customers for ex:CustID Custname Mon-2/2/06 Tue-3/2/06 Wed-4/2/06....till Sun-..1      bharath   100          2000      1000   2  ...

Changing column header text of a gridview inside user control
Hi,I have an ascx file with a gridview, and I need to change the header text of the gridview's column in the code-behind. Something like that:foreach (DataControlField col in GridView1.Columns){ col.HeaderText = GetString(col.HeaderText);}However, no matter where I place that code, the header texts return to their original value, and that's what's being displayed.What could be the reason for that? And how can it be solved?  ...Anyone? I'm having the feeling that I'm missing something quite basic here, any help would be very appreciated. Amit00: col.HeaderT...

Changing the text of an input (text) control
Hi everyone, please answer the following: I have a html input control as follows  <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords %>" name="newSearch_keywords""/>    When the page loads I need to look at the text of this input field and remove any * chars that are in the text. Thanks for your help <input id="newSearch_keywords" type="text" class="text" value="<%=JobsSearchBusinessObject.CurrentKeywords.Re...

changing text in static text control
Hello PB 11 build 8123 I have a window with a dwcontrol. When I am updating the dw control I want one of the column names (static text controls) to change based on a value I select in another column. So far I have the code in the itemchanged to capture the value of my selection in the field I first select. How do I take this value, (it can only be Y or N) and program one of the column headings (static text) to display a certain text? I can't seem to get it to work with setitem or settext. Those two funcs don't really work with column headings as far as I can see. A...

GridView
 My users will click on a calender control date, this will load a gridview listing classes for the day. I want the header text to display the date, but it wont display the date after the 1st click. It does display it after the second click. I am doing this in the rowDatabound event. I know that its probably not showing because the control isnt rendered completely at that time. How can I get it to show the first time? THanks in advance Private Sub gvSchedule_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSchedule.RowDataBound ...

text controls, when they change update the total control
I have 4 text field server controls formatted in currency like $1.00 like this one called Mastercard: <td width="130" style="WIDTH: 130px">Mastercard </td> <td width="21" style="WIDTH: 21px"><INPUT onkeypress="return(currencyFormatCents(this,',','.','$',event))" id="Mastercard" type="text" name="Mastercard" runat="server" style="WIDTH: 116px; HEIGHT: 22px" size="14"></td> When This control, or any of the other 4 I want to update a lab...

Web resources about - Programmatically Change Datagrid Header Text - asp.net.presentation-controls

[...] How to Programmatically Administer Off-Facebook Pages with the Open Graph API - Inside Facebook ...
With the Open Graph protocol that Facebook announced at last week’s f8 conference, any URL can now be treated just like a Facebook Page. After ...

Well, This Is Different Time Inc. Now Selling Print Ads Programmatically
Machines are now selling some print ads at Time Inc. The nation's largest magazine publisher owner of People, Time, Sports Illustrated and InStyle ...

Now Marketers Can Buy Sponsored Content Programmatically
Publishers' branded content is going programmatic. Today, Sharethrough and AppNexus are rolling out real-time bidding for Sharethrough's news ...

Wesabe makes Financial Data available programmatically
Wesabe has just done what I've been trying to convince banks to do for years. They're making financial data available via a simple POX (Plain ...

IPG Begins Buying Local Broadcast Programmatically: Can Target, Retarget Viewers In Near Real-Time
In what likely is the most significant development yet to bring programmatic media-buying to local broadcast television, Interpublic's Mediabrands ...

Google Launches Cloud SQL API To Allow Developers To Manage Their Databases Programmatically
... to use Google’s admin interface. Today, however, Google is launching the Cloud SQL API . This new REST API will allow developers to programmatically ...

Are Programmatically Purchased Native Ads Native Enough?
It seems everyone and their mothers are pushing native ad units and tools to support them. Facebook, Twitter, Yahoo and most recently AOL all ...

Most Major U.S. Publishers Now Sell Ads Programmatically
Most major online publishers in the U.S. now sell at least some of their ad space using automated "programmatic" technology, according to new ...

TV Ads Could Soon Be Sold Programmatically, Magna’s Todd Gordon
The key efficiency new-wave digital media sales holds over TV is clear – super-targeting through addressable, automated and programmatic buying ...

How To Use Facebook's New Power Editor For Ads
Here's a guide to the power editor in Facebook's ad manager.

Resources last updated: 11/30/2015 12:59:22 PM