[Mono-aspnet-list] Mono ASP.NET GridView.Rows behavior is different from .NET

Saw, Zach SawZ at meaust.meap.com
Tue May 29 06:17:18 UTC 2012


In my paginated GridView (contained in an UpdatePanel) bound to ObjectDataSource, I have an OnDataBound event,

protected void GridView1_DataBound(object sender, EventArgs e)
{
    foreach (GridViewRow row in GridView1.Rows)
    {
        // row.DataItemIndex is always zero regardless of which page it is!
        // But, row.DataItem returns the correct object.
        // This cannot be anything besides a bug since on pages other than the first, 
        // DataItemIndex will not be the index to DataItem.
    }
}


When running in .NET, I GridView.Rows always give me the ones in the current page (i.e. GridViewRow.DataItemIndex will not be 0 but its correct index into its data source). But on Mono 2.10.8, this gives me 0 regardless of which page I'm viewing!
However, GridView.Rows[0].DataItem returns the same item as .NET. It would appear that there's a bug in DataItemIndex.
Is there a way to workaround it and achieve the same behavior as .NET on Mono and still maintain compatibility with .NET?


Thanks,
Zach

__________________________________________________________________________________________________________________________________________________
The information contained in this email and any attachment/s may be privileged and confidential and are intended for the recipient designated only. If you have received this email in error, 
do not use, disseminate, distribute, or copy this email and any attachment/s. However, please notify us either on telephone +612 9684 7777 or the sender via return e-mail and delete all 
copies of this transmission together with any attachment/s. 

Mitsubishi Electric Australia Pty. Ltd. has implemented anti-virus software, and whilst all care is taken, it is the recipient's responsibility to ensure that any attachments are scanned for 
viruses prior to use.  



More information about the Mono-aspnet-list mailing list