How To Color In Gridview

Apr 12, 2010

I have gridview in asp.net (c#), and i have to column in gridview 1st column it's a number and 2nd column it's a color , and I use SQL server database and I used sqldatasource in asp.net. The question ? I wont the color in 2nd column depending the value from database ,since I saved in the database color name for example :

1 red
2 black
3 blue
4 green

I wont the color in gridview without color name?

View 4 Replies


Similar Messages:

C# - System.Drawing.Color - Set Color Property Of Car Object In Javascript And Maintain Through The Server?

Oct 19, 2010

I have a class (let's call it Car) that has a property of type System.Drawing.Color (Call it CarColor). I have a script service function that uses this Car class as a return value, which works just fine. I then have another script service function that takes a Car object as a parameter. I would like to change the color of the car in Javascript, but I am finding it difficult to do so without adding another parameter that takes in the color as a string and is then translated at the server. Are there any ideas on how to set the Color property of the Car object in Javascript and maintain it through to the server?

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

JQuery :: Simple Color Picker For Font Color Selection?

Oct 1, 2010

I want simple jquery color picker for font(text) color selection not specific to particular textbox but to all txt boxes on form and must for font color selection not for background color .Simple color picker should like layout color selection.i want color[URL]

View 3 Replies

Translate From HTML Color Code To Drawing.color?

Nov 1, 2010

using vb.net/asp.net 2005.

I am trying to set the border color of cells of my datagrid to an HTML color code: #c1c1c1

I have the following and would like to convert it so that it uses my color code and not the text of the color name, does anyone know the syntax? what I have is:

[Code]....

View 3 Replies

Setting Gridview Header Color?

Oct 13, 2010

i am working in asp.net and c# i have a grid view. i have 10 columns in that grid view. I have some problems with grid view header text color.some of the columns header have link (for sorting). the color of such header text is a light blue.after clicking the blue color change to another color.

some of columns header does not have link. the color of such header text is gray. i want to make the color of entire header text to single color like gray. after clicking the link it must be in same color.

View 2 Replies

Alternate Row Color In A GridView Using Pure CSS?

Mar 9, 2010

I want to alternate rowcolor in a GridView, using pure CSS, ie: I don't want to use asp.net themes; I'd rather not have to use jQuery, or define define AlternatingRowStyle-BackColor on each gridview (unless there's a reason I must). Here's my CSS (that isn't working):

.gridView {font-size:11px
}
.gridView tr:nth-child(even) {background-color: #FFF}
.gridView tr:nth-child(odd) {background-color: #FFCC00}
.gridView tr:nth-child(even) td {background-color: #FFF}
.gridView tr:nth-child(odd) td {background-color: #FFCC00}

(I included the .gridView {font-size:11px} just to confirm I am using the proper CssClass.) Is this not possible, or am I doing something wrong.

View 1 Replies

Change The Color Of Particular Cell In A Gridview?

Jul 21, 2010

Iam displaying the days of a month in a grid. If the first day of the month starts with Wednesday then I need to gray out the cells of Monday and Tuesday for the first week. Is it possible to change the color of particular cell in a gridview? Iam not using rowdatabound Is there any alternative apart from rowdatabound?

View 2 Replies

Change Color Of Certain Texts In A Gridview?

Feb 23, 2010

I have a gridview that displays data from a DB... Currently I can only change colors of all the texts in a cell, but what I need to do is to change the color of certain texts only. Is there a way to do this?

This is my function for changing color of texts in cells:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (_SearchKey != string.Empty)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
for (int ctr = 0; ctr < e.Row.Cells.Count; ctr++)
{
if (e.Row.Cells[ctr].Text.ToLower().Contains(_SearchKey.ToLower()))
{
e.Row.Cells[ctr].ForeColor = System.Drawing.Color.Red;
}
}
}
}
}

View 1 Replies

Changing Color Of GridView Selected Row

Oct 5, 2011

I have a gridView, with link button select

Code:
<asp:LinkButton ID="lbtnSelect" runat="server" CommandName="Select" ToolTip="Select Record Info"
SkinID="LinkButtonSkin">Select</asp:LinkButton

Now when user clicks select, a textbox is populated with description. I want to change the color of the selected row so that user knows which row is selected. How can it be done?

View 3 Replies

How To Change Color Of Gridview Row Which Are Edited

Jul 21, 2012

I am trying to change gridview color row permanently which are edited.. In My GV i have 4 columns like workid, name, dob, place.

When user Edits these items I m storing Edited workid with boolean value in separate table called editeditems..  i used below code to change color in row data bound.. but its changing color of all rows Gv

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
if (e.Row.RowType == DataControlRowType.DataRow) {
DataRowView row = (DataRowView)e.Row.DataItem;
if (Session["ordid"].ToString() != "") {
string ordid = Session["ordid"].ToString();

[Code] .....

View 1 Replies

Change Gridview Cell Color At Runtime?

Jan 27, 2011

Tried this:

Code:

Protected Sub gvCriticalMaterials_RowCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvCriticalMaterials.RowCreated
If e.Row.RowType = DataControlRowType.DataRow Then
If Trim(e.Row.Cells(7).Text) <> "" And Trim(e.Row.Cells(10).Text) <> "" Then
If Convert.ToDateTime(e.Row.Cells(7).Text) < Convert.ToDateTime(e.Row.Cells(10).Text) Then
e.Row.Cells(7).ForeColor = Drawing.Color.Red
End If
End If
End If
End Sub

But it never shows any value for text in the cells.

View 3 Replies

C# - Changing Gridview Row Background Color When Editing?

Oct 22, 2010

I'm having some trouble with editing a gridview row's background color when Editing it.

The thing is, I am using the RowDataBound event method to change e.Row.BackColor based on a criteria when displaying the report( 3 different colors depending on result ). For the rows that don't fall under that criteria, a GridView's property <EditRowStyle BackColor="#999999" /> is applied upon clicking the Edit button.

However, I can't seem to find a way to change the color of those that do fall under the criteria since RowDataBound seems to be called all the time, overriding any changes I make.

View 3 Replies

Change GridView Row Color Based On Condition In C#

Feb 19, 2011

I want to change a particular row color of gridview based on some condition, i am using ASP.NET with c#.

View 2 Replies

C# - Change Cell Color On Different Values - Gridview?

Dec 13, 2010

I need to distinguish two consecutive cells, each one in a row, if they have different values, when databindind the values to a gridview.

So, if in the row 1 i have the cell "ABC" and in the row 2 i have the cell "CBA" i need to color each cell with a different color.

View 4 Replies

Gridview - Change The Color Properties Vertically?

Mar 19, 2011

I have a dynamic gridview, about 35 rows by 11 columns. When the user hovers over a row, I highlight the row's background in green (with CSS:Hover).

I would like to change the column's background as well, but I don't think I can assign css to a entire column. How can I accomplish this?

View 1 Replies

Web Forms :: How To Have Border In GridView With Background Color

Jun 19, 2012

This is my grid view code

BorderColor="#919191" BorderStyle="Solid" BorderWidth="1px" GridLines="Both" HeaderStyle-BorderStyle="Solid" HeaderStyle-BorderColor="#919191" HeaderStyle-BorderWidth="1px" RowStyle-BorderColor="#919191" RowStyle-BorderStyle="Solid" RowStyle-BorderWidth="1px"

It is like this .....

View 1 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

Forms Data Controls :: Changing The Color Of Row In Gridview?

Nov 13, 2010

i have a web page and a gridview in it , i want if one of my fileds (in database) is null , the color of that row change.

View 8 Replies

Change Gridview Row Color Based On Templatefields Without Controls

Feb 25, 2011

My gridview does not use controls, because it is populated using expressions

<asp:TemplateField HeaderText="As Of Sales">
<ItemTemplate>
<%#Getsales(Decimal.Parse(Eval("asofsales").ToString())).ToString("C0")%>
</ItemTemplate>
<FooterTemplate>
<%#Getsales1().ToString("C0")%>
</FooterTemplate>
<FooterStyle Font-Bold="True" />
</asp:TemplateField>

I want to compare column index 1 and column index 8, and if 8 is bigger then 1 it should be a different font color.

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim x As String
x = e.Row.Cells(1).Text
Dim y As String
y = e.Row.Cells(8).Text
If Convert.ToInt32(x) <= Convert.ToInt32(y) Then
e.Row.ForeColor = System.Drawing.Color.Blue
End If
End If
End Sub

View 1 Replies

Gridview Column Color Doesn't Fill Entire Box

Jan 25, 2011

I have a gridview with certain boxes that are highlighted in green. These boxes should fill the entire box, but I can't seem to trash this 1px border around the edges. I'm using IE7, but FF does it too.

Rendered html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>
</title><link href="Style/StyleSheet.css" rel="stylesheet" type="text/css" /><link href="App_Themes/Contoso/Style.css" type="text/css" rel="stylesheet" /></head>
<body>

Update

Changed the Serial# template's itemstyle and it fixed the problem.

<ItemStyle Font-Size="Smaller" CssClass="NoMargin NoPadding" />

View 2 Replies

Change GridView Sort Link From Blue To Different Color

May 24, 2014

Tried this:

<HeaderStyle CssClass="headerstyle" />

And in the css:

.headerstyle a{
text-decoration:none;
color:#7dad4a;
display:block;
}

But nothing...

View 4 Replies







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