Bug 13122 - GridView hidden BoundFields retain data
Summary: GridView hidden BoundFields retain data
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Web ()
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2013-07-09 10:26 UTC by ryepup
Modified: 2013-07-09 10:29 UTC (History)
1 user (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 13122 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description ryepup 2013-07-09 10:26:47 UTC
This is a behavior difference between Mono and Microsoft. 

If you have a `GridView` with a hidden `BoundField`, the text contents of that cell are discarded in Microsoft, and retained in Mono.

I'm not sure the best way to describe this, here's a brief example, assuming the grid is bound to some data source:


	<asp:GridView runat="server" OnSelectedIndexChanged="OnChange" id="gv">
		<BoundField DataField="test" Visible="false"/>
		<BoundField DataField="test"/>

	<script runat="server">
	protected void OnChange(object sender, EventArgs e){
	    Debug.Assert(gv.SelectedRow.Cells[1].Text == "test", "Microsoft and Mono both see the visible cell");
	    Debug.Assert(gv.SelectedRow.Cells[0].Text == string.Empty, "on Microsoft the hidden cell is empty");
	    Debug.Assert(gv.SelectedRow.Cells[0].Text == "test", "on Mono the hidden cell has it's value");


Personally, I prefer Mono's current functionality, but my production server is running Microsoft .NET, so any behavior differences are bugs for me.

As further evidence of this "feature" of Microsoft's `BoundField`, here are some links to other people trying to work around this behavior in Microsoft to get something more like Mono's behavior:

 * http://stackoverflow.com/questions/11486372/retrieve-data-from-visible-false-boundfield-of-gridview
 * http://www.codeproject.com/Tips/80964/How-to-get-Hidden-Column-Value-in-GridView
Comment 1 ryepup 2013-07-09 10:29:45 UTC
This is running xsp2 vs .NET runtime 2.x and ASP.NET 2.x