Last post Sep 19, 2006 08:50 AM by carpenocturnum
Sep 14, 2006 01:44 AM|carpenocturnum|LINK
Hi all, I am trying to use the GridViewAdapter, but it appears as though there is a similar problem to the DetailViewAdapter as explained by this post
My issues is that I have set the visible attribute on one of my Databound columns to be false. When I apply the adapter, the column is displayed, the header is written, but the cells just contain no data. Can someone please confirm that this is in fact a
bug, and if/when it might be fixed.
"css friendly adapter"
Sep 14, 2006 02:49 AM|Russ Helfand|LINK
Interesting. Yes, I think this is a bug, though you are the first to the report it.
Would you mind working a bit with me to develop a fix? I'm going to propose some code. It would be terrific if you could try it out locally and let me know if it fixes your situation the way you'd like. OK?
BTW, I'm going to give this to you in VB but if you prefer it in C# left me know. I never know which language to publish these work arounds in!
In App_Code\Adapters\GridViewAdapter.vb (or cs) you need to dig down until you find the WriteRows method. In it, you'll find a loop that goes over each cell in the row. We need to add some logic inside that loop so we skip cells that are in columns that
aren't visible. The logic I propose is this:
For Each cell In row.Cells
If gridView.Columns(row.Cells.GetCellIndex(cell)).Visible Then
Can you give that a shot? If I've not been clear about what's needed let me know and I'll try to do better. It's nearly midnight and I'm a little blurry.
Sep 18, 2006 01:54 AM|carpenocturnum|LINK
Thanks Russ, that works fine..., I was soooo close, I just couldn't figure out how to get the columns visibility.
Incidently I prefer C#, but I'm bi-lingual :)
Sep 18, 2006 04:55 AM|Bolik|LINK
change GridViewAdapter.cs WriteRows Method
Change DetailsViewAdapter.cs BuildItem Method
CSS Control Adapter Toolkit GridView DetailsView NonVisible Column Field Fixed
Sep 19, 2006 08:50 AM|carpenocturnum|LINK
Yep, that works too.