Forms Data Controls :: Formatting Without Comma?
Mar 28, 2011I have a GridView with bound TextBoxes (using smallmoney columns) that are formatted as {0:n2}. Is there a way to exclude the comma when the amount is 1,000.00 or greater?
View 2 RepliesI have a GridView with bound TextBoxes (using smallmoney columns) that are formatted as {0:n2}. Is there a way to exclude the comma when the amount is 1,000.00 or greater?
View 2 RepliesI have a many to many table in my database called PeopleLanguage
PeopleId, pk and Languags pk each go to the own table People and Language
I know make a method call with my objectdatasource GetPeopleByLanguageId
This returns the languages that the selected person speaks and has a select
query also to lanaguageTable to get LanguageName.
I now print out the results in a datalist that is binding to LanguageName.
What i want to do is show the languages in a horizontal format with a comma after each one.
At the moment if there are 3 languages it shows each one on a seperate line / if I make it horizontal
layout I still dont get a comma. Perhaps I can use a repeater?
formatting a gridview where I have some numbers that show up with the minus sign on top of the number.Ideally I'd like to set the negative numbers to be red if you know how to do that.I'd also just like more control over the width of the columns.some of my formatting code is below. The If - Endif stuff fails with a null reference exception, but the forecolor and backcolor and align code works
[Code]....
I'm looking for a way to format a drop down list's selected value property such that if the Bind value is not found in the db then display "Empty".
I saw something a while back like <%# Format { Bind("Account_Type") ? Bind("Account_Type") : "ALL"} %>.
I have a problem with the layout of my datalist. Everything works except for the layout of the datalist. It's currently display 2 columns in a table layout. From the looks of it, when it switches over to the second column my format gets messed up and I mean there are random gaps in certain areas. Is there a way to fix this?
Here's my Datalist control:
[Code]....
I have the following VB code that is trying to change colors based on the values. The first condition works but the second does not.
[Code]....
I have the following code:
[Code]....
I need to add a check for a checkbox column in the grid. Something like:If CDate(e.Row.Cells(6).Text) < Date.Now and 'checkbox is checked' Then make another colorHow do I check for the value of the checkbox?
I'm trying to get numbers converted to the proper look I prefer. But, it doesn't seem to be working.
I'd like the number to read 1,092, but instead it's listing it as 1092.0000000
Below is my EVAL as well as the code behind for this.
For the eval, I had to add the Convert.ToString to handle DBNULL items.
[Code]....
I have a gridview on my aspx page. I know we can format gridview row in rowdatabound() of gridview. But my problem is bit different.
In my gridview, i have a column customer code, a single code can repeat more than once successively. I want for one customer code, row color should be blue and as soon as code changes colour should be yellow for that code. Similarly when code changes again color should be blue again.
In this way color of my gridview rows should be blue and yellow alternately based on my customer code.I have arranged customer code in order by using sql order by clause.
I have a listview control qith a datapager. I'm using a linkbutton for next and previous. I have a css class that makes the text Arial, and bold. It also sets the size to 10px. When I run the page, the link button is Arial and bold, but I can't change the size of the text. I've tried setting it to 10px, 8px, even 5px, 10pt, and xx-small. Nothing changes the font size. My customer wants the next and previous buttons to look a certain way. I'll have to manage paging manually if I can't get this figured out.
View 28 RepliesHUsing C# to develop a web application. Have a gridview to display data from the a sql table.The headers of the gridview is achieve using a table. Need to format the header cells to align with the columns of the gridview.Currently I'm using a trial an error method to set the width of the header to align with the gridview columns. Can I align the Table header to concide with the gird view column width progarmatically?
Here is my ASPX code
<div id="ProjectTableHeader" runat="server"
style="background-color: #993300; height: 40px; width: 300; margin: 0; padding: 0">
<table cellspacing="0" cellpadding="0" rules="all" border="1" id="tblHeader" style="font-family: Arial;font-size: 10pt; width:[code].....
In my database table i have a column with the data type: date - which accepts a value like 2010-01-08.
However - when i hook the value to a drop down list it looks like: 2010-01-08: 00:00:00
I have the following code on a web page and would like to have the amount formatted as a currency value:
<ItemTemplate>
<%#
(Convert.ToDouble(Eval("Quantity"))
* Convert.ToDouble(Eval("UnitPrice")))%>
</ItemTemplate>
I have tried a number of things but nothing seems to work.
I am using a column named "bk_End_Date" in my gridview.I want to change the row color based on a condition.i.e. if the date value is within one week of today's date (upcomming days only), it's color should be red.I tried following method in RowDataBound Event of C#
//if (DateTime.Parse(e.Row.Cells[5].Text) <= DateTime.Today.AddDays(7))
//{
// e.Row.BackColor.Equals(Color.FromName("Red"));
[code]...
I have been using gridview with my sql server data-
[Code]....
Now here my ann_vol is displayed upto 8 decimal places.But i want to format it like 24.00 upto 2 decimal placesHow can i achieve this
I've got a Gridview in which I have a column that shows percentages. I use the 0:P2 to format the percentage into readable format. However when the user 'edits' the particular row the percentage sign % still shows up in the textbox. When the user tries to save/update their change I throw an error on the % sign.
Is there a way to show the % only when the row isn't in an editable state?
[Code]....
I'm displaynig plain text in a Gridview and the format is not the one I'm looking for here's what's happening. The data in the database (SQL) is store as sample1
Sample 1:
Please do the following:
1. text here and more text
2. blah blah blah
3. more text, etc
However in the Grid view is displayed like this:
Sample 2:
Please do the following: 1. text here and more text 2. blah blah blah 3. more text, etc
How can I fotmatted it to llok like Sample 1 ??
Here's my code:
<Fields>
<asp:BoundField
DataField="Solutions"
HeaderText="Solutions"
ReadOnly="True" HtmlEncode="False"
ShowHeader="False"
SortExpression="Solutions">
<ItemStyle
BorderStyle="None"
VerticalAlign="Top"
Wrap="True"
/>
</asp:BoundField>
</Fields>
I'm trying display data from a sqldatasource but I need to customize fonts, sizes and layouts. What would be the best way to do this. There's not much data only 8 rows and 3 cloums.
It's for a display screen that will show workers how much product they have produced.
I was looking at binding the data to lables and laying out the lables in a table but that process looks intense and streching my knowledge.
I am facing certain problems with the data formatting in GridView when the data is bound dynamically to it.
I have a DateTime column and want to only show Date from it and not the time.
Another Decimal type column which accepts decimal upto 4 places, I want to show decimal upto the places defined in the particular value (don't know how to put it in the correct way, but here is an example of what I want).
i.e.
1.0000 should be displayed as 1 after the databound in the gridview.
Similarly,
2.3400 --> 2.34
1.0050 --> 1.005
1.1000 --> 1.1
I'm using the "Reponse.ContentType Method" for exporting from an ASP.NET page to excel using code similar to this:
[Code]....
That isn't my exact code since my code is in C# but otherwise basically the same. It works fine but when I open the file in Excel everything is formatted with the "General" data type. It doesn't matter if its a string, a number or a currency. I would like to be able to define how each column is formatted so that Excel displays the data properly with minimal if not any work from the user. I know the sw.ToString above is simply an html table that is in string form. Do I have to parse that string and add in something to format each cell or can I do something with the DataGrid object or something completely different? This seems like it would be a common problem or desire but I can't find much of anything on it anywhere.
I am looking for a method to format gridview bound data using javascript.
I know you can have custom formating in Eval using:
[Code]....
But I am looking for a way to perform this task on client side, rather than doing it on the server.
For example if I want to format a date field being bound in a custom way, something like emails date received in gmail. (Only show time if it is today's date [15:30] and only show day and month if it is this year date [14 Jan] and show the full date if it is not this year [10/10/2009].
So, how I use javascript to format a field (ie. custom date format or setting a control visibility)?
I have the following code that works fine:
[code]....
I am working with a chart control and on the Y axis i have numbers that fall between millions and billions.
The numbers on the axis themselves are not formatted and as such can be difficult to read. I wanted to know if there was a way for me to format the value that appears on the axis itself to be coma seperated?
here's what the Y axis looks like
600000000
300000000
100000000
numbers are just hard to read. How do i format them with coma's or even add a label saying (Millions) and then displaying only 100, 300, 600 etc
I have a Gridview with certain columns header in form of dates (coz the datasource is with column field from a date field in a cross tab query). What will be the code of databound event that convert col labels from like 6/1/2010 to Jun-10 in the header text.
View 1 Repliesspecially VB code behind pages.I am writing an app with a colleague and I am stuck on something.he app is a holiday booking calendar. I have a gridview that shows the total number of days booked for each month of the year. When you click the cell for say January another gridview is populated below showing each day of january.My problem is that I want to change the formatting of the cells in the second gridview depending upon if any of the cells have a 1 or a 0.
View 3 Replies