rpatronee
asked on
Help formating the text in a LinkButton
In Code Behind, I must concatenate two different texts in a linkButton that resides in a GridView (<ItemTemplate>)
The trick is that the I need a newspaper-column effect. For example
First column can have up to 6 chars
Second column is a number that can have up to 5 digits
ABC 234
Z 1
ABCDEF 54321
DR 3434
My problem is that 2, 3, 4 or 5 spaces are represented as only ONE space in the GridView in runtime. Thus, the results display as
ABC 234
Z 1
ABCDEF 54321
DR 3434
I wanted to display these values in two different columns and let the browser align these column automaticaly, but per my architect demands, we need to concatenate them as one column.
Thanks for your help.
The trick is that the I need a newspaper-column effect. For example
First column can have up to 6 chars
Second column is a number that can have up to 5 digits
ABC 234
Z 1
ABCDEF 54321
DR 3434
My problem is that 2, 3, 4 or 5 spaces are represented as only ONE space in the GridView in runtime. Thus, the results display as
ABC 234
Z 1
ABCDEF 54321
DR 3434
I wanted to display these values in two different columns and let the browser align these column automaticaly, but per my architect demands, we need to concatenate them as one column.
Thanks for your help.
ASKER
Informania,
I think the basic problem boils down to the spaces not been treated as monospace. I could have:
ABC 383 (three spaces in between)
A 12 (five spaces in between)
But, it displays as:
ABC 383
A 12
In other words, the spaces are not being used to align the two values contained in the same column.
I tried to use font-family: Times New Roman, Monospace; in my style sheet, but the spaces are still not treated as monospace.
Thanks !
I think the basic problem boils down to the spaces not been treated as monospace. I could have:
ABC 383 (three spaces in between)
A 12 (five spaces in between)
But, it displays as:
ABC 383
A 12
In other words, the spaces are not being used to align the two values contained in the same column.
I tried to use font-family: Times New Roman, Monospace; in my style sheet, but the spaces are still not treated as monospace.
Thanks !
Is it possible to substitue tabs "\t" to alighn the text ie x specaes = 1 tab
How are u fetching the two columns
ABC and 123
Are they separate columns?
ABC and 123
Are they separate columns?
ASKER
Informaniac,
These are two different columns from the database. I need to combined them onto one column in the griedview, making sure I pad enough spaces in between these two values, so that the browser aligns them.
The problem is that the browser does not align the two "artificial" columns correctly. I believe there is a way to tell the browser to display each character, including spaces, using the same width for all.
I have tried using the following CSS, but it still does not work.
font-size: 10px;
font-family: Courier, Monospace ;
Any ideas?
These are two different columns from the database. I need to combined them onto one column in the griedview, making sure I pad enough spaces in between these two values, so that the browser aligns them.
The problem is that the browser does not align the two "artificial" columns correctly. I believe there is a way to tell the browser to display each character, including spaces, using the same width for all.
I have tried using the following CSS, but it still does not work.
font-size: 10px;
font-family: Courier, Monospace ;
Any ideas?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yup ! I just made sure I was using a monospace font, such as New Courier.
Thanks!
Thanks!
LinkButton lnk = (LinkButton) e.Row.FindControl("lnk1");
lnk.Text = e.row.cells[0].Text.Trim()