Forms Data Controls :: Chage Text Color In Gridview If A Number Is A (-) Negative

Dec 13, 2010

I have a gridview that displays the total hours and employee works. I also have another column in the gridview that shows the difference from the hours worked and 8.5. I want the column that shows the difference to display the number in red whenever the number is a negative.

The gridview looks like:

Time In
Time Out
Hours Worked
Difference
7:30:00 AM
3:58:00 PM
8.47
-0.03

I would like it to look like:

Time In
Time Out
Hours Worked
Difference
7:30:00 AM
3:58:00 PM
8.47
-0.03

View 20 Replies


Similar Messages:

Forms Data Controls :: Show Text Instead Of Number In Gridview?

Mar 30, 2010

I have a gridview which takes numbers from the table and shows them. There are 4 numbers (-1 / 0 / 1 / 2)

Since the numbers do not mean anything to the user, I would like to assign them words.

-1 = Bad
0 = OK
1 = Groovy
2 = Superduper

So, I would like the data taken from the table to be changed to the word and that populate the datagrid.

The code behind is in C#

View 4 Replies

DataSource Controls :: Error - Number Must Be Either Non-negative

Feb 23, 2010

I had a repeater that will be binded using dataset

[Code]....

and on page load I write this code

[Code]....

it worked very well on my machine , after applying it on the server it give the following error

Server Error in '/' Application.

Number must be either non-negative or -1. Parameter name: millisecondsTimeout Description: An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Number must be either non-negative or -1. Parameter name: millisecondsTimeoutSource Error:

[Code]....

Stack Trace:

[Code]....

View 3 Replies

Forms Data Controls :: GridView DateDiff Negative Value

Apr 8, 2010

I have a GridView that populates the days between the start and end date. What i want to ask is that is it possible to display a word "Overdue" (If possible "Overdue by 7 days") when the datediff is negative (eg: -7 days) The following are parts my codes for now:

<asp:TemplateField HeaderText="Date Raised" SortExpression="DateRaised">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("DateRaised","{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Expected Close Date" SortExpression="DateClose">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("DateClose","{0:d}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="DaysTaken" HeaderText="Allocated Days" />
<asp:BoundField DataField="RemainingDays" HeaderText="Remaining Days" />
<asp:SqlDataSource ID="SqlDS_UnresolvedIssues" runat="server"
ConnectionString="<%&#36; ConnectionStrings:DatabaseConnectionString_PITLog %>"
SelectCommand="SELECT [IssueLog].[DateRaised], [IssueLog].[DateClose], DATEDIFF(dd,DateRaised,DateClose) AS DaysTaken, DATEDIFF(dd, GETDATE() ,DateClose) AS RemainingDays FROM [IssueLog]
INNER JOIN [ActDetails] ON [IssueLog].[ActID]=[ActDetails].[ActID] WHERE [ActDetails].[ProjID]=@ProjID AND [ActDetails].[DevPhase]=@DevPhase AND NOT [IssueLog].[IssueStatus]=@IssueStatus">
<SelectParameters>
<asp:ControlParameter ControlID="DD_PMProjID" Name="ProjID" />
<asp:ControlParameter ControlID="DD_DevPhase" Name="DevPhase" />
<asp:Parameter DefaultValue="COMP" Name="IssueStatus" />
</SelectParameters>
</asp:SqlDataSource>

By the way, I am using Web Developer 2008, VB.net.

View 11 Replies

Data Controls :: Change Header Text Color Of GridView When Exporting To PDF

May 7, 2015

How to change header text font colour when  exporting gridview data to pdf.

View 1 Replies

Data Controls :: Conditionally Change Font Color Of GridView Cell Text

May 7, 2015

I have a gridview that contains columns of electrical specification (value, resistance, etc.).  The rows are populated with archival data from previous versions of th same part (rev A, rev B, etc.).

The question is: is there any way for me to review each row and set the font color to red if the value is different from the cell below, or above?  This would highlight where changes were made to each individual revision of a part from the previous version.

View 1 Replies

Forms Data Controls :: Gridview Binding - Index 1 Is Either Negative Or Above Rows Count?

Jul 29, 2010

I have the following problem, i am using gridview to display some table info,, and during RowDataBound event i am binding another DataList control placed on gridview template column,,, the problem is that the DataBind() event of the gridview gives "Index 1 is either negative or above rows count." error.

I debugged alot,, when you disable the DataList binding it works,, but why the 2 not working together i dont know!!.

Below my Code in

Code Behind:

using System;

View 4 Replies

Forms Data Controls :: Index Was Out Of Range Must Be Non Negative And Less Than The Size Of The Collection In GridView?

Jan 26, 2011

I have gridview like this.

[Code]....

is index was out of range must be non negative and less than the size of the collection

View 7 Replies

Forms Data Controls :: Changing Grid To A Color Reflecting A Number?

Oct 13, 2010

How can i do this? I think thinking maybe something in the code behind that when it detects a 4,3 it would change it to a color. but im not sure.

View 10 Replies

Web Forms :: Range Validation To Allow Value Between Negative And Positive Number In TextBox

May 7, 2015

I want to put validation in a Textbox, that the numbers entered inside textbox should be between 1 to -1 only i.e., (-1, -0.1, -0.2, -0.3, -0.4, -0.5, -0.6, -0.7 ....... 1 )I tried below code but "RangeValidator" is not working as per requirement:

HTML:

<asp:RangeValidator ID="RangeValidator1" runat="server" MaximumValue="1" MinimumValue="-1" Text="value between 1 to -1" ErrorMessage="value between 1 to -1" ControlToValidate="TxtY" ValidationGroup="usrvalid"></asp:RangeValidator>
<asp:TextBox ID="TxtY" Text='<%#Eval("Y") %>' runat="server" Width="30%"></asp:TextBox>
<cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" TargetControlID="TxtY" FilterType="Custom" ValidChars="-01234567890." runat="server"></cc1:FilteredTextBoxExtender>

How to achieve it.

View 1 Replies

How To Sum Negative Int Number

Aug 18, 2010

I retrieve data from databse

col1 col2 col3
0 0 1,000
1 0 0
0 1 5
0 -1,200 0
0 0 0
0 0 0

and now I want to sum each for total

[code]....

I will get error when dr["col2"].ToString() = -1,200

col2 += Int32.Parse(dr["col2"].ToString().Replace(",",""),NumberStyles.AllowDecimalPoint);
does the problem is the negative sign?

how to sum for negative number?

View 9 Replies

Forms Data Controls :: Gridview Header Css / Set The text Color To White For The Header Only The Non Bound Columns Go White

Aug 13, 2010

i have a gridview bound to sql datasource with template fields binding the columns. I have set the Header Style to a css class. I have 3 columns not bound to data as Add, Edit and Delete. When I set the text color to white for the header only the non bound columns go white. The bound columns are BLUE like hyperlink. Any one know a way round this. (If I set the style in the gridview the all columns are white. Want to set in external css file).

[Code]....

View 1 Replies

Forms Data Controls :: Making Read Only Text A Different Color

Mar 30, 2011

How do I make A, B and D navy blue?

Region

Stuff

Stuff

tried this just for one of the cells but it's not working what am I missing?

[Code]....

View 1 Replies

Forms Data Controls :: Detailview Text Color Change Based On Variable?

Feb 15, 2010

I'm trying to change a row in detailsview based on a value in a coloum. Exactly the same as this example but in Detailsview: [URL]

View 3 Replies

Forms Data Controls :: Validation For Number Of Words In A Text Box

Mar 8, 2010

I am having some text boxes in my webform. I need to set numbers of words for each textbox. if i put more than defined no of words it should show msgs or popup msgs whatever it may be.

View 2 Replies

Forms Data Controls :: Put Bracket For Negative Numbers?

Aug 6, 2010

I have a gridview that calculate net balance by taking deposit - withdraw. So when the withdraw is more than the deposit, it will result in a negative value, how do I detect that and replace the minus sign with bracket?

[code]....

View 10 Replies

Forms Data Controls :: Enter The Number Of Rows In A Text Box To Display In A Table

Jun 30, 2010

using vs2005 I have a formview control I added from the data section and within the formview, I aded a table from the Standard section. How can I add a text box to the formview so I can enter a number like 7 to display seven rows with a text box. the data will be saved to the sql table when I click on the Insert link at the bottom of the page.

View 2 Replies

Forms Data Controls :: Tell Repeater To Wrap Text After Certain Number Of Characters For Particular Column?

Sep 2, 2010

I have a column in my repeater which allows as many as 255 characters and causes the page contents pushed away to the right if any of the record has all 255 characters in that column. How can I tell it to wrap the text after 50 characters?

View 4 Replies

Forms Data Controls :: Is Possible To Edit Page Number Text In Datagrid (which Clicked)

Oct 20, 2010

I am editing the page links text 1 2 3 4 5 ... as 1-10 11-20 21-30 31-40 ...succesfully. But here the problem is when am clicking 21-30 link it changes to 3. How to display the 3 as 21-30.

View 3 Replies

Data Controls :: Highlight Searched Text In Color In DataList Items

May 15, 2013

I have 1 Datalist and BTNsearch in my page below is SP

ALTER procedure [dbo].[AdminSearchP]
AS
BEGIN
SELECT * FROM House_p WHERE ID IN( SELECT DISTINCT houseP.ID FROM House_p houseP,SearchTerm WHERE [Description] LIKE '%' + SearchTerm.Name + '%')
END

this SP show in dataList  data that contain some words that I define in SerachTerm table

refer

Select-records-from-one-Table-and-Search-in-other-table-in-SQL-Server/

Now I want when I click on button and it show data in datalist it highlight the words in datalist that I define in SearchTerm Table i.e in serchTerm table i define below words

Paris-India-Itally-Germany

when I click on button it search in House_p table in Description Column and if in this column be above words show it in datalist

Like below

Name
Description
Sara
She is from India

Now I want when show data in datalist it bold or Highlight the words that I define in SearchTerm table Like below

Name
Description
Sara
She is from India
How I can do it? 

View 1 Replies

Forms Data Controls :: How To Set The Background Color Of Menu In To Two Seprate Different Color

Jan 18, 2011

I m using this code

Menu menu = new Menu();
menu.MenuItemClick += new MenuEventHandler(menu_MenuItemClick);
menu.BackColor = System.Drawing.Color.AliceBlue;

But i want that background color of menu should be seprate two Different color red and AliceBlue

View 3 Replies

Forms Data Controls :: Add Color To The Header Of A Gridview?

Jul 6, 2010

I have a gridview with the following header shown below

TYPE LOCATION

Big New York

Small BOSTON

Now, I would like to add a background colour for the headers TYPE, LOCATION. How do you do that? Kindly note, I am not trying to add a text color but instead a background color

View 2 Replies

Forms Data Controls :: How To Change Row Color In GridView

Feb 25, 2010

I am developing a scheduling system in which customers are alloted 15 minute timeslots (see example below). During rowdatabound event I know how to change the value of Cell(1) to NULL by using e.Row.Cells(1).Text = "" so Select option is not available for that timeslot. This works fine for someone who has taken only 1 timeslot.

Question is, when a Customer has for example 1:00 hour appointment (which is 4 x 15 minute time slots), how do I make the next 3 rows Cell(1) value NULL?

Is there anything like e.Row+1.Cells(1).Text = "" or some loop that I can run to take care of next few rows?

[code]....

View 4 Replies

Forms Data Controls :: How To Change GridView Row Color

Jun 1, 2010

I am pretty new to asp.net development. I have a a checkbox in template column in gridview how do i change the color of grid row when the check state changes.

View 5 Replies

Forms Data Controls :: GridView Row Color Change?

Dec 13, 2010

i have gridview & m appliying for dis gv paging sorting and row color change respective courses for dat i have written code but after 3 records he give this error

Specified argument was out of the range of valid values.

Parameter name: index my code is

[code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved