I have an ASP.NET datagrid with several bound columns. I need to make the
header of some of these columns display a string that is generated from the
code behind (i.e. a dynamic header). How is this done?
I have tried with both a templatecolumn and boundcolumn. I thought it might
be something like: HeaderText='<%# DataBinder.Eval (Container,
"DataItem.myVar iable") %>' or HeaderText='<% Response.Write( myVariable); %>
But, neither worked, nor did several variations. I just want the headertext
to display myVariable which is declared as a string. Can anyone please
assist?
TIA,
John 4 3921
John,
In code-behind (not in .aspx file) you can set HeaderText property via
Columns property of the datagrid.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message
news:eI******** ******@TK2MSFTN GP15.phx.gbl... I have an ASP.NET datagrid with several bound columns. I need to make the header of some of these columns display a string that is generated from
the code behind (i.e. a dynamic header). How is this done?
I have tried with both a templatecolumn and boundcolumn. I thought it
might be something like: HeaderText='<%# DataBinder.Eval (Container, "DataItem.myVar iable") %>' or HeaderText='<% Response.Write( myVariable);
%> But, neither worked, nor did several variations. I just want the
headertext to display myVariable which is declared as a string. Can anyone please assist?
TIA, John
I tried that originally, and it sets the headertext during page load, but
after it is loaded the headertext keeps getting reset to the .aspx value.
Even if I remove the HeaderText item from the .aspx portion.
So, if it is done in the code-behind, how do you make sure it is the final
setting that the headertext is set to?
Sorry about my ignorance, but I am used to doing applications, not asp.
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:ey******** ******@TK2MSFTN GP09.phx.gbl... John,
In code-behind (not in .aspx file) you can set HeaderText property via Columns property of the datagrid.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message news:eI******** ******@TK2MSFTN GP15.phx.gbl... I have an ASP.NET datagrid with several bound columns. I need to make
the header of some of these columns display a string that is generated from the code behind (i.e. a dynamic header). How is this done?
I have tried with both a templatecolumn and boundcolumn. I thought it might be something like: HeaderText='<%# DataBinder.Eval (Container, "DataItem.myVar iable") %>' or HeaderText='<%
Response.Write( myVariable); %> But, neither worked, nor did several variations. I just want the headertext to display myVariable which is declared as a string. Can anyone please assist?
TIA, John
Try doing this in PreRender event.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message
news:Op******** ******@TK2MSFTN GP12.phx.gbl... I tried that originally, and it sets the headertext during page load, but after it is loaded the headertext keeps getting reset to the .aspx value. Even if I remove the HeaderText item from the .aspx portion.
So, if it is done in the code-behind, how do you make sure it is the final setting that the headertext is set to?
Sorry about my ignorance, but I am used to doing applications, not asp. "Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:ey******** ******@TK2MSFTN GP09.phx.gbl... John,
In code-behind (not in .aspx file) you can set HeaderText property via Columns property of the datagrid.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message news:eI******** ******@TK2MSFTN GP15.phx.gbl... I have an ASP.NET datagrid with several bound columns. I need to make the header of some of these columns display a string that is generated
from the code behind (i.e. a dynamic header). How is this done?
I have tried with both a templatecolumn and boundcolumn. I thought it might be something like: HeaderText='<%# DataBinder.Eval (Container, "DataItem.myVar iable") %>' or HeaderText='<% Response.Write( myVariable); %> But, neither worked, nor did several variations. I just want the headertext to display myVariable which is declared as a string. Can anyone
please assist?
TIA, John
Got it. Thanks! Setting the sessions to their local/member variables
within the init, also helped to keep me from loosing those assignments and
now everything renders properly :D
Thanks again,
John
"Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message
news:OV******** *******@TK2MSFT NGP15.phx.gbl.. . Try doing this in PreRender event.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message news:Op******** ******@TK2MSFTN GP12.phx.gbl... I tried that originally, and it sets the headertext during page load,
but after it is loaded the headertext keeps getting reset to the .aspx
value. Even if I remove the HeaderText item from the .aspx portion.
So, if it is done in the code-behind, how do you make sure it is the
final setting that the headertext is set to?
Sorry about my ignorance, but I am used to doing applications, not asp. "Eliyahu Goldin" <re************ *@monarchmed.co m> wrote in message news:ey******** ******@TK2MSFTN GP09.phx.gbl... John,
In code-behind (not in .aspx file) you can set HeaderText property via Columns property of the datagrid.
Eliyahu
"John E." <pl*********@ne wsgroup.thanks> wrote in message news:eI******** ******@TK2MSFTN GP15.phx.gbl... > I have an ASP.NET datagrid with several bound columns. I need to
make the > header of some of these columns display a string that is generated from the > code behind (i.e. a dynamic header). How is this done? > > I have tried with both a templatecolumn and boundcolumn. I thought
it might > be something like: HeaderText='<%# DataBinder.Eval (Container, > "DataItem.myVar iable") %>' or HeaderText='<% Response.Write( myVariable); %> > But, neither worked, nor did several variations. I just want the headertext > to display myVariable which is declared as a string. Can anyone please > assist? > > TIA, > John > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: sam |
last post by:
Hello Group,
I have a currency column and I display values according to
the dataformat string as below:
<asp:BoundColumn DataField="Revenue"
SortExpression="Revenue" HeaderText="Revenue"
DataFormatString="{0:c0}">
<HeaderStyle Width="10%"></HeaderStyle>
</asp:BoundColumn>
t works fine but I got to display 'None' when the column is zero. The
|
by: John |
last post by:
The ItemCommand event not getting fired when I add both a BoundColumn and a
ButtonColumn to a datagrid. When I add a ButtonColumn by itself, everything
works fine, but as soon as I add a BoundColumn, the ItemCommand event
doesn't seem to get called.
I've been struggling with this for too long now, I'm certain there's
something I'm not getting. Here's the relevant code. Thanks in advance!
// As is, this code does not correctly call...
|
by: cntams |
last post by:
Hi all,
I have a Web Form and using BoundColumn to bind data to the
datagrid.
I have 2 fields that needs to be formatted. The first one is a
DateTime field and the second one is the currency field.
The following is part of my code, the following shows a new
boundColumn is being created, and the DataFormatString is being
specified. Now, I need to format the currency in a multilanguage
manner. Can someone tell me how to do so in both...
|
by: niki |
last post by:
Hello.
I have a problem with custom columns inside the datagrid.
I've set up a datagrid that populates from a database; I can edit the
datagrid values and update the db, so that's ok.
(btw, it's not as easy as the book claims...)
Now I'd like to format some columns, say date values, and what's more,
I'd like to make some columns not visible and some read-only.
I thought BoundColumn could be the solution, but as I create columns
this...
|
by: tshad |
last post by:
Is there a way to call a function from a boundcolumn tag?
I have some icons that I set as visible or not depending on values set in my
table.
I have a Datagrid that I am binding to and after binding I then go through
the DataGrid item by item checking the values and setting the icons
accordingly. If I could set them via a function during binding would be
better.
| |
by: tshad |
last post by:
In a datagrid, is there a way to put a tooltip and use a field from the data
that is returned from the sql statement to fill it?
For example:
<asp:BoundColumn DataField="CompanyDesc"
HeaderText="Company:"
ReadOnly="true"
Visible="true"
ItemStyle-Width="135px"
|
by: Randall Parker |
last post by:
Using ASP.Net v1.1 with C#.
I have an asp:DataGrid where one column is specified as follows:
<asp:BoundColumn HeaderText="Serial" DataField="owner_serial_num"></asp:BoundColumn>
I might get a serial number of X01 or X02 for example. What I want to do is make that
serial number be a link to a different page like, say,
http://currentURLpath/DetailViewer.aspx&serial="X02"
|
by: hazz |
last post by:
The following code generates checkbox values from the database. Once the
user selects/deselects checkbox values, is there a way to obtain the ID and
Checkbox.Checked state from these BoundColumns so I can update the table
they came from? Thank you. -Greg
<asp:DataGrid id="ItemsGrid" runat="server"
OnItemDataBound="Item_Bound" AutoGenerateColumns="False"
AllowSorting="True">
<Columns>
<asp:BoundColumn HeaderText="ID"
|
by: jeffg |
last post by:
Hi,
I have a DataGrid in a ASP.NET application (.NET 1.1) where one of the
BoundColumns in the datagrid is displaying a Date and Time stamp. I would
like to display just a short date ("7/5/2005") instead of the full date and
time. I am having difficulty understanding the DataFormatString property on
the BoundColumn class. I see in the documentation how to change the format
for numbers, but don't see how to change the format for dates....
|
by: rn5a |
last post by:
A DataGrid has a BoundColumn which changes to a TextBox when the
DataGrid is in the editable mode. The rest of the columns in the
DataGrid are TemplateColumns. There's an EditCommandColumn as well.
All the columns including the BoundColumn but excluding the
EditCommandColumn can be sorted. The column sorted is also accompanied
by an image to indicate whether a column has been sorted ascendingly
or descendingly. The image gets rendered when...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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,...
|
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...
|
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...
|
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();...
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |