当我们在新窗口中重定向到其他页面时,Gridview单元格的背景色消失

问题描述:



我将一些记录绑定到网格"视图,并将所有单元格的几行绑定,我们将背景色设置为蓝色".当我单击当前页面(Window1)中可用的链接按钮之一时,它将重定向到新窗口(Window2)中的新页面.即它将在新窗口中打开新页面.问题是

在打开新窗口(Window2)之后,如果我来到第一个窗口(Window1)(可使用网格视图和链接按钮),则网格视图行单元格的背景色将消失.但应按照上述说明进行查看,即那些行单元格的背景色应为蓝色.但这使颜色松动.

我要求从这个问题上帮助我.

谢谢
Raj ..

Hi,

I am binding few records to Grid view and few of the rows of all cells, we are making background color to Blue. When i click on one of link button available in current page (Window1), it will redirect to new page in new window (Window2). i.e It will open new page in new window. The issue is

After opening of new window(Window2), if i come to first window (Window1) (grid view and link button is available), the grid view row cells background color is loosing. But it should be view as per the above i.e those row cells background color should be BLUE. But it is loosing the color.

I request please help me out from this issue.

Thanks
Raj..

尝试此代码

try this code

void maintainColor()
       {
           CheckBox chk;

           foreach (GridViewRow gridviewrow in grvAuction.Rows)
           {
               chk = (CheckBox)gridviewrow.Cells[1].FindControl("chkitem");
               if (chk.Checked == true)
               {
                   gridviewrow.Attributes.CssStyle.Add("background-color", "#79B7E7");
                   gridviewrow.Attributes.CssStyle.Add("color", "white");
               }
               else
               {
                   if (gridviewrow.RowState == DataControlRowState.Alternate)
                   {
                       gridviewrow.Attributes.CssStyle.Add("background-color", "white");
                       gridviewrow.Attributes.CssStyle.Add("color", "#284775");

                   }
                   else
                   {
                       gridviewrow.Attributes.CssStyle.Add("background-color", "#F7F6F3");
                       gridviewrow.Attributes.CssStyle.Add("color", "'#333333");

                   }

               }
           }

       }



重定向页面后调用此方法.

希望对您有帮助.




如果有帮助,请将其标记为答案..谢谢..



call this method after you redirect the page..

hope it helps..




mark this as answer if it helps you.. thanks..