Data Controls :: Change Background Color Of TextBox Inside GridView When Blank
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
Now I want to change the cell backcolour to red for those cells are blank ....
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 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:
I am trying to figure out a way to change the color of the text display in a label control or span inside a user control. The text needs to be displayed in a different colour based on the value returned.
<asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name").ToString()=="Flying Bats" ? "Display the text in green" : "Display the text in red" %> '/>
The text value would be one of the two. The font color needs to be ether red or green based on whats been returned.I cannot figure out how to do it.
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?
I have a repeater control on my page. Here's my code:
I would like to change a background color of the item's <div> when user checks the chechbox. I have an event handler for CheckedChange event but I don't know how can I get access to this div from the event handler.
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).
I am able to change the girdview caption in code like this:GridView1.Caption = "New grid title"But I can not find how to change the background color where this caption (in the entire girdviews heading).
I am pulling information from two different databases (structure is the same) and putting them into two datatables. The problem I am having is figuring how to merge the data togther in a single gridview and change cell background color for only the data in the second datatable.
I'm trying to make a page, with a textbox, and a linkbutton. In the textbox you can enter any hex colour code you want, then you can click the linkbutton and the pages background will change to that colour. But I don't want the page to postback. I was trying this with themes, and then dynamically editing the CSS file. But neither has worked.