Web Forms :: Change The Cell Color In The Calendar ?
Jan 28, 2011
I'm having a lot of trouble and I'm sure it's something I'm simply over looking.I am trying to change the cell color in the calendar if there is an event loaded against that day. Below is the code I'm using that's throwing me an error.
I am using ASP .NET C# 2.0. I have a web form with a Calendar control. In the DayRender event I am checking the e.Day.Date to see if it equals a date from my database. I am also checking other decimal values for that same day and displaying them in the cell. The values are for hours scheduled and hours worked. If hours worked is less than hours scheduled then I want to change the cell's back color to Yellow. I can only get this working for the last date in the month.
I also had a problem changing the ForeColor of the cell. To workaround that I had to find out if a certain CSS file was being used (my application uses 2 different files). Here is my code for my DayRender event:
I have a grid view populated with some data included bit fields and I made an export to excel function For each row i need to check the cell with the bit value to change the cell color, but the cell is always empty, even if is the field is set to False or True. foreach (GridViewRow row in gv.Rows)
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?
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.
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.
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?
I am trying to change the color of the text in the title of a Calendar Extender Control from the AJAX Toolkit. I was having trouble getting the hover color to change, so I followed an example from this site:
I'm using asp.net 1.1 to download data of a datagrid to excel file. I've used mso-number-format to display dates in short format 05/05/10 and numeric numbers with two decimal points. I want to set make text bold of some specific columns based on some business logic so that after download it boldness doesn't loose. So far I've tried with Css styling didn't get any result. I don't want to use .Net excel library: [URL] to do it.
I am reading a datareader, populating a datatable and then when finished populating I bind to a gridview. Right now, I am placing a literal in the cell of the rows based upon date differences....sort of a textual gant chart. What I want to be able to do is change the background color of the cell I am putting these literals in. I am including the code below where I am populating the cells with the text. Does anyone know how to make the background color change? I know that in a normal gridview on datarowbind I can change it but I don't know how to do this on a cell by cell basis within the code I have below.