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.
In my asp.net+vb web with access database in a gridview i used the following code
Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) If e.Row.RowType = DataControlRowType.DataRow Then If (e.Row.DataItem("TEN") > 24) Then e.Row.ForeColor = Drawing.Color.Red
The above code is working in my sqldatabase web but not working in access database web...
How to change the value of a "label control in cell of a gridview" from codebehind (no matter whatever data is there in database).I am fetching 4 columns from databse in "label control in cell of a gridview". I want to change the value of a particular column from code behind (no matter whatever data is there in database)
If ( value == '2')display 2 columns value in label control in cell of a gridview from databaseand display other 2 columns value in label control in cell of a gridview as "Not Applicable".
If ( value == '3')display 3 columns value in label control in cell of a gridview from databaseand display other 1 columns value in label control in cell of a gridview as "Not Applicable".
How To Hide A Column But Still Retrieve Its Values? How To Access A Label Control In Cell Of Gridview
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
In my asp.net+vb we+access DB. i have a field named DOB which is date of birth. i displays the data in grid view whose DOB+90 is less than ot equl to current date
and it works currect. but when i try to used vb code to change the row colour as per data it works for this one.
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("DOR") <= Now()) Then e.Row.ForeColor = Drawing.Color.Red End If
I have Jobschedule( different work centers) displaying in grid view on my webform When particular workcenter passes the current date then it should highlight with Red color ,(following sechedule i bolded the dated which are passed current date since i did not find how to make color here)
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 have four textbox fields for ItemName, ItemDescription, Length and Quantity.
One radiobuttonlist and its listitems are FixedLength and Random Length.
One button field called Submit and one gridview.
In the GridView I have 4 bound columns and 1 template column such as ItemName, ItemDescription, Length, Quantity and IsFixed_f(flag field). I have added one checkbox in the GridView's Template column for the IsFixed_f field.
After entering all textbox fields, I have to select either one listitem in the radiobuttonlist(FixedLength or RandomLength). After completing these things. If I enter the Submit button, all the values in the textbox to be displayed under the GridView's corresponding column name and checkbox to be checked if FixedLength listitem is selected otherwise the checkbox.checked should be false. How to do this?