If you just want to highlight the added row, couldn't you just look for it when binding? Keep a Boolean instance variable that states whether or not a row has been added, and based on that value, decide whether or not to color a row. One example could work something like this:

public class MyPage : Page
{
      private bool newRowAdded;
      private object newIdentityColumn;

      protected void Grid_ItemDataBound(...)
      {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                  if (newRowAdded)
                  {
                        DataRowView row = (DataRowView)e.Item.DataItem;

                        if (row["identityColumn"] == newIdentityColumn)
                        {
                              e.Item.CssClass = "colorMe";
                        }
                  }
            }
      }

      protected void Grid_InsertCommand(...)
      {
            newIdentityColumn = InsertRecordIntoDatabase();
            newRowAdded = true;
            Grid.DataSource = RefreshData();
            Grid.DataBind();
      }
}

-Brian

-----Original Message-----
From: stevens3t [mailto:[EMAIL PROTECTED]
Sent: Tuesday, October 26, 2004 9:08 AM
To: [EMAIL PROTECTED]
Subject: [C#.NET] Re: Index position in a Sorted DataView ?


No-one's jumped on this one.
Am what I'm looking at doing not possible ?
Thanks again ....
Steve

--- In [EMAIL PROTECTED], "stevens3t" <[EMAIL PROTECTED]>
wrote:
>
> We have a DataGrid component on an ASP.NET web form.
> We've got means to add a new row to an underlying table.
> We then call a method which sets up a DataView (dependent on
a 'Sort'
> criteria) and sets the DataSource of the DataGrid.
> If we know the IDX (identity field in the database table) how can
we
> establish the index position of the new row in the (sorted)
DataView ?
> Ideally we want to highlight the newly added row in the DataGrid.
> We've also got to then address the issue with paging in the
DataGrid
> but we'll sort that our after we've gotten over this first hurdle.
> Anyone offer any suggestions ?
> Thanks in advance,
> Steve





Yahoo! Groups Sponsor
ADVERTISEMENT





Yahoo! Groups Links
* To visit your group on the web, go to:
http://groups.yahoo.com/group/CSharpNET/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.


Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=315388.5526708.6599542.3001176/D=groups/S=:HM/A=2372354/rand=216744374


Yahoo! Groups Links

Reply via email to