change grid cells back color (Cells Blinks)

Dear devs

my case is im building a website similar to stocks websites, i used ajax for refreshing issues and gridview for disiplaying data. now the data will change frequently and i want to color the changed data (coloring the cells of changed data). but the problem is i dont know which cell is changed and which one staied remain.

thanks for helping


Jaffar N. Khalid
0
jaffar
11/7/2007 9:35:26 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
570 Views

Similar Articles

[PageSpeed] 49

Hi:

  From your description my understanding is that you're using UpdatePanel and a Timer. Is it right? If my understanding is correct you can get the original data before GridView is bound again. Store it in a global object, filling a DataTable, for example. Then in PreRender you can color the cells by comparing the data in the DataTable and that of GridView.

Regards


Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Allen
11/9/2007 2:10:28 AM

hello Allen

thanks for your replay and sorry for replaying late, yes im using update panel with timer. i thought about what u r talking about but 1st im using datasource 2nd how i would compare cell by cell? i think i should use rowDatabound or rowCreated and check each cell with my data table? is that how will go on?

and doesnt that cost the server a huge process?

thanks


Jaffar N. Khalid
0
jaffar
11/11/2007 11:22:22 AM

Hi:

 

jaffar:
i thought about what u r talking about but 1st im using datasource 2nd how i would compare cell by cell? i think i should use rowDatabound or rowCreated and check each cell with my data table? is that how will go on?

 

  I think you should do this in PreRender event handler. Just loop through the GridView and compare the cells of the pre-saved DataTable one by one. The process hit would be huge if the DataTable is too large since it'll occupy a lot of server side memory and time to compare every cell.

  Another approach, which is more efficient is, create a custom control to display the data. It can derive from asp.net Label control and you can simply overrride the Text property:

 class A : Label
    {
        public override string Text
        {
            get
            {
                return base.Text;
            }
            set
            {

//Here you can check the parent and if it's TableCell you can change the background color. Some logic here
                base.Text = value;
            }
        }
    }

  In this way whenever the Text is set it's parent's (if is TableCell) background color will be changed.

Regards


Sincerely,
Allen Chen
Microsoft Online Community Support

Please remember to mark the replies as answers if they help and unmark them if they provide no help.
0
Allen
11/12/2007 1:46:54 AM
Reply:

Similar Artilces:

Changing data grid cell colors based on information contained within the cells #2
I posted the following question the other day and aspdotnetv2 kindly responded with some code. However this seemed to require the use of the repeater control to accomplish my goal. It worked as it should. But if I do this I loose the functionally of the "data grid" that I wanted. Does anyone know a way to accomplish this using the data grid instead of the repeater?? I have a data grid with information in several columns that show the status of certain aspects of a given project. Red for an area in trouble in trouble, yellow for those having problems that could become serious ...

Change cell color in a cell when hyperlink is clicked
I have a table across the bottom of my form, when a user clicks a hyperlink in one of the cells, I want the bgcolor of the cell to change. You can use the onClick event of the cell to change its bgcolor property. For example:<td bgcolor="black" onclick"bgcolor='white';">This is a test!</td>This uses event propogation to capture the click event which is passed down from the link. Steven BeyRecursion: see Recursion Don't know what I'm doing wrong, I used your example and it it doesn't want to cooperate. The bgcolor automatically deafults to the oncli...

Changing back color of cell
Hi, I have a tree which generate data from a rdf-template. Now I want to change the color only of the cell which contains negative ( - ) value. How can it possible? Regards, Sandesh Sandesh Karalkar wrote: >I have a tree which generate data from a rdf-template. >Now I want to change the color only of the cell which contains negative ( - ) value. > >How can it possible? > Basically you need the RDF data source to tell the tree what colour you want the cell to be. First, your template needs to specify the properties attribute as well as the value...

Change Datagrid cell color based on cell value
I was wondering if there is a way to change the background color of an individual cell in a datagrid based on it's value. (I code in VB) Example: I have a Due Date field and the cells need to be highlighted yellow for all dates that are over 30 days old. Then for all of the dates that are over 60 days old, their cell backgrounds would need to be red. Thanks for the help in advance Dan Take a look @ Change Color of a Column Based on Column Values In your case you can use <Table> tag and change the <td> background color using helper function HTH Sushila ...

Changing a Cells color based on another cells value
We want to change the color of a previous cell based on the value in the current cell. For example, say we are ranking items as they are read into the datagrid. We have several columns of data we want to rank for first and second place. Once we encounter a value that is greater than the previous high value we would like to change the previous high values cell color to yellow and the new high cells color to green. For example column 1 in the following table would have 12 highlighted in green and 10 highlighted in yellow. See the following table. Column 2 would have 11 highlighted green and th...

Changing cell colors in a datagrid based on the information contained in the cell
Any help I can get would be greatly appreciated. I have a datagrid with information in several columns that show the status of certain aspects of a given project. Red for an area in trouble in trouble, yellow for those having problems that could become serious and green for those running as planned. What I would like to do is have the cell color change to correspond to the status of the project. Since the project managers update the status of projects as needed the color would need to change based on the text entered into the cell turning either red, yellow or green to correspond. H...

To change the color of a cell in a table control
I am in desparate need of this.. i would like to know how to change the color of a single cell in a table using a button click or clicking the corresponding cell itself... pls divrt me to the solution in ASP.NET uisng C# code. Are you refering to HTML Table or GridView?Regards,Vinz"Code, Beer and Music" that's my way of being a programmer!How to get your Forum Question Answered | Blog | CodeASP.NET It is a normal HTML table.   Try out this one  <td id="tdTest" onclick="this.style.backgroundColor='blue'" /> or ...

Changing DataGrid cells and child controls based on other cells values... having trouble
I am trying to examine the value of one cell, then disable other controls in the same row (in other cells) based on this. Basically if this cell = Yes or No, then disable a dropdown in another cell. I have tried the ItemCreated and ItemDataBound and am intercepting the event.itemtype by (ListItemType.Item and ListItemType.AlternatingItem) but it is telling me that value of this cell when i examine it is empty. Should i wrap the value in a label or something? I have tried that as well but it doesnt work, the value is always empty when checking during these events but at render time ...

how do I conditionally change bkg color of datalist cell and make the content of the cell clickable
Hi all, 1) how do I change background color of a datalist cell based on an attribute value (of a xml file) and make the content of the cell clickable ? 2) assuming the datalist is in an iframe. How do I make the cell content value available to another iframe page via clickable/url passing technique?  Thanks Here's how to change the color (BALANCE_COL is the cell index): protected void GridViewFun_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (e.Row.DataIt...

Move a control from cell to cell
I have a custom control, but for this question let's keep it simple and use a "button".  Without deleting the old button and creating a new button, I would like to "move" it's location from a cell in one table, to a cell in a completely different table. Any ideas? Doing "getElementById" to find the id of the control, and then "appendChild" to the cell gives me an "invalid pointer" error.  So obviously it doesnt want the same control pointed to twice on the page.   You can try the following. This might no...

How do I change the background color of a table cell for a Repeater Control
Hello,  What I would like to accomplish is to change the background color of a newly inserted row for a specific cell if it meets the condition.   For each row, the first column of the table has a button by which at runtime I can insert a new row. This newly inserted row has the same foreign key id as the row of the cell where the button was clicked. Because I’m using a Repeater control the new row has a button placed inside the cell and the text which is identical to the previous row.   As stated before, I would like to change the background color for only the new inser...

Accessing cell text and changing background color (vb.net)
 Hello! I am trying to add on to the function below a feature that would change the background color of a row based on the cell values. I basically have 3 cells with data in them ('In Stock, Needed, On Order). If something is not in stock, I want the row to be red, if it's on order I need it to be yellow, and so on. What I am having trouble with is actually accessing the text values of the cells. I thought it was e.Row.Cells[2].Text but this hasn't worked. I am very new to vb.net as I usually use C# for this. It seems like any input I give it crashes. Adding a s...

Changing the value of one cell when the user changes the value of another cell
I am using a standard GridView with multiple columns and a SQLDataSource. One column is called Qty and another column is called Date. When the user clicks the Edit button and enters a quantity into the Qty column, I would like to automatically fill in today's date into the Date column...before the user clicks Save. Any ideas on how to do that? Thanks in advance, Rick     You would have to make an asych call, check out ASP.NET AJAX: http://ajax.asp.net add a javascript event on the quantity textbox the onchange On the gridviews rowdatabound add this  Protected Sub Gr...

FormView control
When a user modifies the value in a textbox in a "EditTemplate" of the Form View, I would like the font color or back color of the text box to change - even before the update is submitted. How can I do that? Thanks. You can add an onchange event to your textbox: onchange="this.style.backgroundColor='yellow';" Or use the onkeyup event as well. You may need to add the handler for this if your textbox box is being created in the client side.Please mark as "answer" if this helped you in anyway. Thanks. here is how I did it:Protected Sub FirstName...

Web resources about - change grid cells back color (Cells Blinks) - asp.net.presentation-controls

Name change - Wikipedia, the free encyclopedia
For name changes within the Wikipedia community, see Wikipedia:Changing username . For name changes of places rather than persons, see Geographical ...

Rival A-League fans unite for extraordinary meeting to force change from FFA
One of the most remarkable meetings in the history of Australian football is set to take place next week when representatives of all 10 A-League ...

Cabinet document reveals Turnbull Government under pressure to change industrial relations laws
The Turnbull Government is being pushed to change Australia's workplace relations system, a document obtained by the ABC reveals.

FEATURED 10 free Chrome hacks that will change the way you browse the Internet
... are plenty of simple ways to make it better. In this post, we'll tell you about free 10 extension for Google's Chrome browser that will change ...

Climate Change Shouldn't Be A Partisan Issue But It Is
... Marco Rubio such a willfully ignorant science denier? Yesterday we talked about the passage of Fred Upton's disastrous anti-climate change ...

Obama: "You can't build a border wall" to stop climate change
President details why he considers it the world's "greatest threat" and how he hopes to make the fight a part of his legacy

Surprise! GOP Hard At Work Undermining President Obama's Climate Change Summit
... to you to discover that Republicans are working overtime to make sure President Obama fails to get to a finalized agreement on climate change ...

AP: Say ‘Climate Change’, It’s More ‘Scientific’ Than ‘Global Warming’
'Use climate change doubters or those who reject mainstream climate science'

Cartoon: Modest climate change goals
The U.N. Climate Conference is going on in Paris, and maybe everyone will agree to modest means-based reductions in carbon emissions at some ...

Is this climate change real estate agent for real?
Climate change threatens the lives of millions as it causes the seas to boil and the skies to burn, but hey, everything's a business opportunity ...

Resources last updated: 12/6/2015 1:43:00 AM