473,785 Members | 2,425 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Programmaticall y set headertext of a boundfield column

Hi,

I am trying to find out if there is a way to set the headertext of the
boundfield column belonging to a detailsview control (ASP.NET 2.0), from
code.

<asp:BoundFie ld HtmlEncode="fal se" DataFormatStrin g="{0:###0.00 }"
DataField="wage _cash" HeaderText='<%# Format_Header(" wage1") %>'
SortExpression= "wage_cash" />

The above example doesn't work:
"Databindin g expressions are only supported on objects that have a
DataBinding event."

I would like to set the headertext within the DetailsView_Pre Render sub,
so that the header displays the current financial year.

I'd prefer not to convert the above to a TemplateField column, because
of the formatting used - DataFormatStrin g="{0:###0.00 }"

Any help (with vb.net examples) would be especially appreciated!

Thanks,

John.

*** Sent via Developersdex http://www.developersdex.com ***
Aug 20 '06 #1
0 1517

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
18891
by: fuchs.markus | last post by:
Hello, on my page, I have a DetailsViewControl connected to a SqlDataSource. Now when I dynamically set the FilterExpression and FilterParameters - for example in a OnClick-EventHandler of a button - the DetailsView shows the filtered Data, but Deleting and Updating doesn't work anymore. The DetailsView changes to EditMode, but after clicking on the UpdateButton it shows the old data. Am I missing something or is it just not possible or...
0
1416
by: sloan | last post by:
When defining a GridView column...and the header for that column <asp:BoundField DataField="Price" HeaderText="The Price" SortExpression="Price" /> is there a way to force a <br/> in the Header Text value? <asp:BoundField DataField="Price" HeaderText="This phrase had four words" SortExpression="Price" />
1
7314
by: Mark Stafford | last post by:
I am attempting to use a DetailsView control to view some data where the fields returned by the database are determined at runtime. I create the TemplateFields on the fly using a class that implements ITemplate and repopulate the Template properters of TemplateField in OnInit. And I am DataBinding by getting a DataTable from my db provider class in Page_Load event. When I databind programmatically in the Page_Load, the data displays in...
2
6735
by: Wayne Deleer | last post by:
Hi All, I'm currently working on a project, and I've come to a part where I want to add data to a GridView. BUT, I want to do it programmatically, with alot of control over everything. In my particular project I've passed a DataSet to a page via a Session object. The Session object passes without incident, and I can use the default settings to retrieve the information without problem and plug all the information into the GridView.
0
2261
by: cook.jonathan.m | last post by:
I want to programmatically add a dropdown to each row in a certain column returned to the gridview by my query. I want to do this entirely in behind-code. My gridview tag in the page will have the following code and no more. <asp:GridView ID="gv" runat="server" AutoGenerateColumns="false"> </asp:GridView> Now, I have generated boundfields to add regular data without a
1
4479
by: michel | last post by:
Hi, I want to add programmatically a boundfield to a gridview: <asp:GridView ID="GridView1" runat="server"> <Columns> </Columns> ..... </asp:GridView>
4
12580
by: Tomasz | last post by:
Hello Developers, Here is interesting problem I just came across: how do I wire a GridView control programmatically? Here is my sample code using Object Data Source: protected void Page_Load(object sender, EventArgs e) { ObjectDataSource ods = new ObjectDataSource("MyTestTableAdapter",
5
23635
by: NKaufman | last post by:
<asp:GridView ID="Basic" runat="server" DataKeyNames="QuestionID,isHeading" AutoGenerateColumns="false" AllowPaging="true" PageSize="100"> <Columns> <asp:BoundField Visible="false" DataField="QuestionID" HeaderText="QuestionID"></asp:BoundField> <asp:BoundField DataField="QuestionDesc" HeaderText="Question" ItemStyle-HorizontalAlign="Left"></ asp:BoundField>
0
1233
by: =?Utf-8?B?UGF1bA==?= | last post by:
I am trying to embed HTML in a gridview's HeaderText field. Something like this: <asp:BoundField DataField="rfq_4567_count" HeaderText="RFQs<br>(4-5-6-7)" SortExpression="rfq_4567_count" HtmlEncode="true"> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" /> </asp:BoundField>
0
9646
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10096
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6742
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.