Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Pamela Baker   on Sep 16 In Asp.net Category.

  
Question Answered By: Clayton Richardson   on Sep 16

Client side  JS:


function setRowColor()
{
rowId = parseInt(frmMain.all["rowIndex"].value);
if ((rowId != -1) && (window.document.all[rowId].tagName == "TR"))
{
//window.document.all[rowId].style.backgroundColor = "yellow";
window.document.all[rowId].cells[0].style.backgroundColor = "yellow";
window.document.all[rowId].cells[1].style.backgroundColor = "yellow";
}
}

HTML
<body MS_POSITIONING="GridLayout" onload="setRowColor()"
bgcolor="ActiveBorder" scroll="no" leftmargin="10" topmargin="0"
rightmargin="10" bottommargin="0">


In code behind do something like:

if post back
...
string rowSourceIndex = Request["rowIndex"];
if (itemClicked != "")
getRelatedItems();
Page.RegisterHiddenField("rowIndex", rowSourceIndex);
...

else

Page.RegisterHiddenField("rowIndex", "-1");


Email me off list if you have trouble with the above code.

Share: 

 
 
Didn't find what you were looking for? Find more on Highlight datagrid row client side Or get search suggestion and latest updates.


Tagged: