L
Logician
I have a Web Server App which colors the row based on a selection from
a listbox (ie the data is expanded and highlighted on the grid from
the listbox).
This works OK except when the DataGrid has several pages, and then the
correct page is not shown (but the correct is still highlighted just
on a page not shown).
How can I set the right page index based on the selected row?
My Code:
DataGrid1_ItemDataBound(...)
if ((e.Item.ItemType==ListItemType.Item)
|| (e.Item.ItemType==ListItemType.AlternatingItem))
{
string thisPartNumber = lblPartNumber.Text;
string thisDBPartNumber =
DataBinder.Eval(e.Item.DataItem,"PartNumber").ToString();
if (thisDBPartNumber == thisPartNumber)
{
e.Item.BackColor=System.Drawing.Color.Azure;
// I want to add the page index here and set the index somehow
}
else
{
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='azure';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='white';");
}
a listbox (ie the data is expanded and highlighted on the grid from
the listbox).
This works OK except when the DataGrid has several pages, and then the
correct page is not shown (but the correct is still highlighted just
on a page not shown).
How can I set the right page index based on the selected row?
My Code:
DataGrid1_ItemDataBound(...)
if ((e.Item.ItemType==ListItemType.Item)
|| (e.Item.ItemType==ListItemType.AlternatingItem))
{
string thisPartNumber = lblPartNumber.Text;
string thisDBPartNumber =
DataBinder.Eval(e.Item.DataItem,"PartNumber").ToString();
if (thisDBPartNumber == thisPartNumber)
{
e.Item.BackColor=System.Drawing.Color.Azure;
// I want to add the page index here and set the index somehow
}
else
{
e.Item.Attributes.Add("onmouseover","this.style.backgroundColor='azure';");
e.Item.Attributes.Add("onmouseout","this.style.backgroundColor='white';");
}