Gridview Rows Backcolor getting reset when selecting a row

I have a list of rows in my gridview that list one or more entries per date.  I have coded the RowDataBound event so that all of the rows for a given date have the same backcolor.  Day 1 is white, Day 2 is yellow, Day 3 is white, day 4 is yellow - where each day could have multiple rows. 

On each row, I also have an Edit imagebutton that allows each row to be edited via a separate panel and not in-line grid editing.  When I click on the Edit imagebutton, I set the gridviews selectedindex to that row and then using the skin for the grid, the selected row backcolor changes color. However then, all of the other rows lose the backcolor I set programmatically in the RowDataBound event.

Is there anyway of preserving the backcolor I set in the RowDataBound when I programmatically set the selectedindex of the grid?  I'm not seeing any solutions really except to rebind the grid which I could probably live with since it is a small amount of data beign returned everytime but I was hopeing for a more elegant solution. 

Thanks,
Greg


"Providing software solutions for your world!"
Excellent .NET Hosting here!
0
gknierim
10/7/2008 1:19:40 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
972 Views

Similar Articles

[PageSpeed] 7

 I agree with rebinding. That's what I have to do with customization in the gridview.


http://www.rocksthoughts.com
http://www.jumpstarttv.com - Free Technical Videos!
0
chrisrock
10/7/2008 1:35:31 PM
Reply:

Similar Artilces:

Add new controls to a gridview row; when editing that row using the edit row feature in the gridview control.
Hi all  I have a questions that looks hard / complex to me, and i know you can help me in this. Q {  I have row in a Gridview and i have an edit option to it. I press the edit button, to edit the values in that row and update data all the way back to the database. Now when i press the edit button, i want a drop down list to be displayed that contain values for a particular field in my grid view. (for now only plain text boxes appear.) } I hope you understand my question, all i need to do is replace the text box controls with a dropdown list when i am editing a row in ...

Selecting a gridview row and keeping the last selected row in a gridview highlighted after mouse moves over a new row.
What is the best way to show a gridview row highlighted once selected and keep it highlighted once the mouse moves over a different row? Thanks, Steve hi,you can use <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="#FFFFFF" /> plz let me know if i misunderstood you Thanks for your help. One problem; however, is that after the row has been selected and I check the "grid.SelectedIndex" it has a value of -1 and not the index of the row that was selected on the grid. What do you recommend? Thanks, Steve hi, sorry i din...

How to get the row index of a selected row in listview control
Can someone please tell me how to get the index of a selected row in a listview.  <ItemTemplate> <asp:LinkButton runat="server" class="linkButton" id="xxxxx" Text='<%#Eval("documenttype") %>' CommandName="OpenFile" CommandArgument='<%#Eval("DocumentKey") %>'></asp:LinkButton></ItemTemplate>what you have to do is, in itemcommand event of ListView, you have to get the value of row indexif(e.CommandName == "corrospondingcommaandname"){     &nb...

Gridview paging enabled. Has checkbox to select the row . If user select the checkbox on one page and move to 2nd page to select the rows there also to export the selected rows to excel. But doing so
HiI am using Gridview and that has paging enabled. Using checkbox to select the particular row of the gridview to export the selected rows to the excel . Everything is working fine except for one case.Let user selected the "check" box for, five rows which user would like to export to excel (two of rows on page 1 of results and 3 of them on page 2 of results), however it only exports the 3 row details from page 2, because it seems to de-select the 2 rows from page 1 when I move to page 2 and vice versa. The code i am using is as :protected void BtnExcel_Click(object sender, EventArg...

Selecting the multiple rows in GridView and inserting the selected rows to another Gridview & Performing some operations on it
 Dear All, I have become mad for solving this problem. Please Help me. I have a Gridview bound to a datasource. I inserted the CheckBox Control in Templet to select certain rows. Gridview1 contains some products id & name.I want to insert the selected rows in to second Gridview  and in the second Gridview I need to add two more colums AdvicedQty & AcceptedQty(TextBox Cotrol).The user will select few products in Gridview1 & clicks add which will be added another gridview then in second Gridview he enters the AdviceQty & AcceptedQty.After entering the data he cli...

How to delete row from GridView control
Hello,  I am working on an ASP.NET 2.0 app, and I am trying to wire up a "Delete" button to a gridview control on a form. Here is the code for the ASP :  <asp:GridView ID="gvInConditions" runat="server" AutoGenerateColumns="true" OnRowDeleting="gvInConditions_RowDeleting" DataKeyNames="Condition_ID" >         <Columns>                <asp:CommandField ButtonType="Button" SelectText=&...

Problem in Using DropDownList Control to select a selected row of SqlDataSource that is under GridView Control
Hi all,In my SQL Server Management Studio Express, I have a database "ChemDatabase" that has a table "LabData"  formatted in the following way: SampleID int PRIMARY KEY, SampleName nvarchar(25), ChemicalName, nvarchar(25), Concentration decimal(6.2) with 5 rows of records in this .dbo table. In my Visual Web Developer Express, I created a website "RPD-TCE" for extracting a row of record from the LabData table by using a DropDownList, a GridView and a SqlDataSource.  I want to click DropDownList to list one number of S...

How to set the row number and get the row number for ("selected row) in Datagrid
I face a problem that i can't get the selected row of the datagrid in both server side script (VB.net) and client side script (javascript) As i can't use the button column / hyperlink column in the datagrid. Thus , i need to handle the change the background color of the selected row and also to get the selected row number for Update/Delete. Thanks in advance. This depends on how do you perform the selection. Do you want to implement chaning of the SelectedRow at the client side without any postback? If you have no issues with postback, then you can do s little trick here: 1. ...

new row below selected row in gridview to display child gridview
Hello,   I have a gridview that up selected..shows the nested child grivdview. The problem I currently have is that it stuffs all the data into a column whcih blows the whole tbale out of whack. What I need to do is create a new row below the sleected row to house the new child grivdview. I have seen third party controls do this such as teleriks radgrid but I wont to do this with the gridview control.  Any articles on how to do this? Does AJAX support this? Any help is greatly appreciated.    ...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column.  Without editing the grid view i want to know the selected index of dropdownlistbox for each row. See http://forums.asp.net/t/1170088.aspx.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

How to get selected index of dropdownlistboxs present in two different rows of gridview
I have a gridview, in that i have dropdownlistbox as one column. Without editing the grid view i want to know the selected index of dropdownlistbox for each row. Simply itearte through the Rows collection of your GridView. Then, use the FindControl method of the GridViewRow reference and retrieve a reference to your DropDownList. From here, you can then retrieve your SelectedIndex. This can be done within the GridView.DataBound event or later.Thanks, EdMicrosoft MVP - ASP/ASP.NET...

I can't get value of control in the selected row of a Gridview
I'm trying to perform an update using a sqldatasource from a gridview after a selection is made from a dropdown and a linkbutton "lbnUpdate" is clicked. I assigned  "select" as the command name of the linkbutton so I was assuming that I could then reference the gridviews selected row from the code behind but I guess I made a bad assumption. During debug there is "nothing" in the variable I use to capture the gridview selected row. I will post what I have. If I set AutoGenereateSelect button to true I can get the SelectedIndexChanged event...

I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row.
 Hi, Let say I've 4 rows in a table. I want to select top 3 rows except the first from 4 rows of a Table. It should select from top 2 row,top3 row and top4 row. Thanks in advance Asghar Ali Mohammed http://www.aliwebdev.com(Web Designer and Developer)Do not forget to "MARK AS ANSWER" on the post that helped you. If you can use Linq, you can use Skip. http://msdn.microsoft.com/en-us/vcsharp/aa336757.aspxThanks, EdMicrosoft MVP - ASP/ASP.NET Hii dear..U can fire the Query select Top(3) from Table1 order by id desc.. "A conclusion is whe...

Using a row selection in a gridview to create database rows for another gridview
Hi there, I have 2 gridviews on a form, the first displays some template rows from a database table.  The second displays some user specific rows (with additional data added to the template info) from the same table. They both work fine for displaying the info.  Now what I want to do, is allow users to 'select' a template row on the first gridview, and have that action automatically: create a new user-specific row, with added fields from profile data etc. insert it into the table then refresh the second gridview in order to show the new added row. C...

Web resources about - Gridview Rows Backcolor getting reset when selecting a row - asp.net.presentation-controls

Wikipedia:Glossary - Wikipedia, the free encyclopedia
Note: while the definitions below may be useful for understanding and communicating on project and discussion pages , and with edit summaries ...

Home - China Forum
Home ,China Forum

浜插瓙棰戦亾-鐕曢兘缃?.0
棣栭〉 鏂伴椈 娌冲寳 鐕曢樀 鐧诲綍 娉ㄥ唽 鎴夸骇棰戦亾 姹借溅棰戦亾 缇庨浼戦棽 閮藉競璐墿 閴磋棌棰戦亾 鐞嗚储棰戦亾 鏁扮爜棰戦亾 娲诲姩涓撳尯 浜插瓙鍓嶆部 鐖稿浜ゆ祦 鐑笘鎺掕 鐢熸棩棰勭害 浜插瓙闃呰 瀹濆疂绉€ 浠婃棩涔嬫槦鈥斺€斿懆浣虫棴 鍙埍瀹濊礉楂樻鐏碉紙鎮犳偁锛?/p> ...

Dresses – Beckley
Menu collections Fall 2015 Spring 2015 Fall 2014 Spring 2014 Fall 2013 Spring 2013 Fall 2012 shop Tops Bottoms Dresses Rompers Jackets Sunglasses ...

CompulsiveCode - AFPviewer
A free AFP viewer. View pages, apply a grid, apply an overlay, extract pages, convert pages to pdfs or images, extract resources, print pages, ...

Overview
ComicRack is the best eComics reader and manager for Windows computers. You can think of it as an ITunes for electronic comics.

Intel-IT168搜索-综合
Intel-IT168搜索-综合

my masterpiece, v1.0
posts to keep you entertained, thinking, sharing, and discussing

LucidScience - Build the VGA VIDEO GENERATOR - Page 15 of 16
Generate VGA graphics using an AVR microcontroller and an external frame buffer

Seattle City Hall completes switch to Microsoft
... s79.addVariable('width','472'); s79.addVariable('autostart','false'); s79.addVariable('frontcolor','0xffffff'); s79.addVariable('backcolor','0x000000'); ...

Resources last updated: 11/26/2015 11:58:41 PM