Display an underscore before the data in a column

A

Antonio

I have a datagrid which pulls from a stored procedure. For the purpose
of this display issue, we need to prepend a bound column with a
underscore "_" We don't want to change the stored procedure. can I do
this in the property builder for the datagrid?
 
G

Guest

this should take care of the underscore
<asp:BoundColumn DataField="fieldname"
DataFormatString="_{0}"></asp:BoundColumn>
 
T

tdavisjr

You need to handle the Item_Databound Event for the datagrid. You will
be passed an EventArgs parameter that has an Item property that you can
cast to a DatagridItem object. From the DatagridItem you can reach
into its Cells property and pre-pend the "_" before the item in the
cell. You can get into the cells by doing something like this:

DataGridItem item = e.Item

item.Cells[2] <--------- represents a cell in the 3rd Column


This should give you a start.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top