Forms Data Controls :: GridView - Change Background Every Three Rows
Dec 14, 2010
This should not be to hard but my head is not going for it today I have a gridview that changes the sales reps name every 3 rows. The data is group in 3 rows for each rep. estimates, job & invoices each have their own row I want to change the backgroup for each rep. I am using C# and I would guess it would be in the code behind file I got this far but can not remember a way to check the next row to make sure it is the same of changed from the previous row
protected void gvSaleReport_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string prevRep;
prevRep = e.Row.Cells[0].Text;
if (prevRep == e.Row.Cells[0].Text)
e.Row.BackColor = System.Drawing.Color.Blue;
else
e.Row.BackColor = System.Drawing.Color.White;
}
}
View 3 Replies
Similar Messages:
Dec 1, 2010
How can change some cells in gridview that have some condition?
For example:
IF name=="x" column[2].background="red"
(only column for this name)
EXPLAINE :
my GRidview show houses,and i want to when it is for sale the clolum (sell price) background will be another color,and also for rent.
ask 2: I should use the code in RoewCreated event or OnRowDataBound ?
View 2 Replies
May 7, 2015
How Coloring cells and rows in a Gridview using javascript with these examples of this page. url...
View 1 Replies
Apr 9, 2014
how to change backcolor of gridview In ModalPopupExtender
View 1 Replies
Aug 17, 2010
I am binding a gridview to a stored procedure. I want to change of some row color based on the data binding.
For example: if "Lesson" =0, change the row color to RED.
[Code]....
View 9 Replies
May 7, 2015
I want a RowDataBound if the previous date in filed check in not found be red color
Like the date 10/10/2014 not found so 10/11/214 be red and how can i edit the date to be dd/mm/yyyy
Name Checkin Checkout Branch
450 10/6/2014 9:13:38 AM 10/6/2014 6:01:50 PM branch0
450 10/7/2014 9:16:34 AM 10/7/2014 6:44:21 PM branch0
450 10/8/2014 9:11:53 AM branch0
450 10/8/2014 6:03:25 PM branch0
450 10/11/2014 9:17:33 AM 10/11/2014 6:29:16 PM branch0 (red color )
450 10/11/2014 4:50:42 PM branch0
450 10/12/2014 9:09:38 AM branch0
View 1 Replies
Sep 15, 2013
In my asp.net+vb web I am using the below code to highlight the row...
If e.Row.DataItem("Auth") Is System.DBNull.Value <> True AndAlso e.Row.DataItem("Auth") > e.Row.DataItem("Held")
Then e.Row.BackColor = Drawing.Color.LightCoral
I want now only to give colour to the cell in the field and not the entire row ....
View 1 Replies
May 7, 2015
In my asp.net+vb web I was using this code to change row colour of gridview
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataItem("bloodgp") Is System.DBNull.Value <> True AndAlso e.Row.DataItem("bloodgp") Then
e.Row.BackColor = Drawing.Color.LightGreen
End If
End If
End Sub
Now I want to change the cell backcolour to red for those cells are blank ....
View 1 Replies
Jan 24, 2014
I have a grid(15 rows,8 columns) in which each cell contains a template field checkbox. When i checked it the current cell's background should change.
Problem:- Unable to find out particular cell.
View 1 Replies
Feb 15, 2014
I have a grid with 5 rows and 5 columns, All containing templetefield(Combobox)I am trying to set the background color of my grid cell(contain combobox) depending upon which item is selected. (again, dependent on item selection, so background color is not permanent). How can i achieve this?
View 1 Replies
Sep 10, 2010
I have a GridView with an alternating Css style. The GridView has a column called tradeId. What I want to show is an alternating colour based on a change in the tradeId. Is this possible? It will make it easier on the eye to group trades together by colour. Here's the GridView code as it is right now:
[Code]....
View 2 Replies
Aug 11, 2012
i want to change the color of border rows and columns in the grid view in asp for printing purpose.
View 1 Replies
Jun 29, 2010
I have repeater and I am using foreach to go through each row, checking for specific value and assigned the label accordingly. However, when there is a value that is not expected, I would like to highlight the whole row on yellow color.
How can I set only for specific row in repeater with different background color?
View 3 Replies
Oct 20, 2012
I am having gridview and i have check box for each row. There are 2 buttons ,accept and reject outside the gridview. If I click accept button, all the checked rows fields value should change to accept and if i click reject button all the checked rows column value should change to reject. There are 3 columns only one column will change.
View 1 Replies
Sep 3, 2010
I have a grid view that displays some diary data that consists of a date, a diary entry and a diary entry type (eg holiday, info, meeting..)How can I change the background colour of a row depending on the diary entry type.So for example if the type is 'holiday' colour the row yellow, if its 'meeting' colour it red etc etc
View 10 Replies
Jun 20, 2012
i want to differentiate the row of gridview based on condition.
i have used template column in gridview .
eg
name rate
a 0 display the background of this row is red color
b 1000 display the background of this row is green color
c 500 display the background of this row is green color
View 1 Replies
May 7, 2015
i have one gridview.. i want use tooltip for single column only after using tooltip in code behind its working fine.. i am not using any jquery and javascript for tooltip.. my problem is how to set background for this tooltip in codebehind.
View 1 Replies
Aug 3, 2012
i have gridview in which i have a Image button with id (' ImageButton3 ') on click of which i want to hide that corresponding row , by first highlighting it by followed fadeIn effect ....
Here is code of gridview:
<asp:GridView ID="grid" runat="server" AutoGenerateColumns="False" CssClass="mGrid" ShowFooter="true"
AlternatingRowStyle-CssClass="altrow" DataKeyNames="productid" Width="100%" BorderWidth="0px"
AllowPaging="True" PagerStyle-HorizontalAlign="Center" PagerStyle-VerticalAlign="Middle">
<RowStyle Height="50px" />
[Code] ....
This is code for javascript:
<script type="text/javascript">
$(document).ready(function() {
$("[id*=ImageButton3]").live("click", function() {
$(this).closest("tr").hide();
return false;
});
});
</script>
But the code i am using only hide the row , i am not able to get the effects of fadeIn and highlighting ..
Also i want i know that am i using right code to hide gridview row ?
View 1 Replies
May 7, 2015
After item databound I've one or more button inside a datalist. How can I format the clicked button with different border style from the unclicked buttons?
View 1 Replies
May 7, 2015
I have datalist and I want to change the background color on hover effect ...
View 1 Replies
Jul 26, 2010
It seems that VS always displays more than 20 rows of ListView in its designer. If a page has quite a few of ListViews, it is a bit hassle to move around. Is there any way to reduce the number of displayed rows?
View 7 Replies
May 7, 2015
I came across a situation where a user selects no of rows from dropdown , depending upon the user input, automatically that no of editable rows should appear to input data...(maximum 8 rows only)
View 1 Replies
Feb 10, 2011
How can i change repeater control class depends on number of rows it contain?
View 2 Replies
Jul 9, 2010
how to give background image to gridview header
View 3 Replies
Jul 16, 2010
I have a GridView. In my RowDataBound event I add attributes for the mouse onclick event, which sets the row's background color to red when the row is clicked. This works. I have a button outside of the GridView. When I click this button, I want to read each row of the GridView, and if its background color is red I want to perform some processing on the row. I tried the following code and even when the row's background is red, I cannot get its background color (bgc is empty).
[Code]....
View 9 Replies