The i-Technology Media!
Register | Log in
   
 
.NET  ·  AJAX  ·  CLOUD  ·  ECLIPSE  ·  FLEX  ·  OPEN WEB  ·  iPHONE  ·  JAVA  ·  LINUX  ·  OPEN SOURCE  ·  ORACLE  ·  PBDJ  ·  SEARCH  ·  SILVERLIGHT  ·  SOA  ·  VIRTUALIZATION  ·  WEB 2.0  ·  WIRELESS  ·  XML
Comments
Drool, Britannia? Is the UK Failing the Cloud?
By Roger Strukhoff
Richard Davies wrote: The UK has a good crop of technology pioneers in cloud computing - for example ElasticHosts, FlexiScale, Flexiant, OnApp - and also some strong government initiatives such as G-Cloud. We will have to see whether this kind of technical leadership converts into swift mass-market adoption or not.
Jan. 8, 2012 11:38 AM EST
read more & respond »
Cloud Expo on Google News
Did you read today's front page stories & breaking news?

Cloud Expo & Virtualization 2011 West
Keynotes
Oracle
Opening Keynote | An Enterprise Cloud for Business-Critical Applications
Abiquo
Day 2 Keynote | The Enterprise Cloud Tightrope - Balancing for Success
Akamai
Day 3 Keynote | The DNA of an Enterprise Cloud
DIAMOND SPONSOR:
Oracle
Many Clouds, Many Choices'Cloud
PLATINUM PLUS SPONSORS:
Abiquo
Enterprise Cloud Best Practices - Town Hall - Join the discussion…
PLATINUM SPONSORS:
Intel
Progressing Toward the Federated, Automated and Client-Aware Cloud
New Relic
How to build an app with Twitter-like throughput
Rackspace
Computing in the Cloud Era
GOLD SPONSORS:
Gale Technologies
Practical Cloud Migration
IBM
Re-think IT. Re-inventing Business.
Intel/McAfee
Identity Driven Security in the Cloud
PerspecSys
Hackers Hackers Everywhere, Is My Public Cloud That Safe?
Red Hat
Unlock the Value of the Cloud
SHI
Mission Critical Applications and the Cloud - Myth or Reality?
SoftLayer
Not Your Grandpa's Cloud
Terremark
Integrating Enterprise Clouds
VMware
Upgrade to a vCloud
POWER PANELS:
Cloud Expo Silicon Valley: CTO Power Panel
Cloud Expo Silicon Valley: CEO Power Panel
Cloud Expo Silicon Valley: Cloud SuperStars Panel
Cloud Expo Silicon Valley: CloudNOW Panel
Click For 2010 West
Event Webcasts
Cloud Expo & Virtualization 2011 East
DIAMOND SPONSOR:
Dell
Dell & VMware Deliver the Enterprise Hybrid Cloud
PLATINUM PLUS SPONSORS:
Abiquo
Are Financial Services Organizations Risking Security by Avoiding Cloud Computing?
Oracle
From Consolidation to Enterprise Private PaaS
PLATINUM SPONSORS:
Intel
Driving the Transformation to Next Generation Cloud Data Centers
Rackspace
The Inevitability of an Open Cloud
GOLD SPONSORS:
CA Technologies
Follow YOUR path to Cloud Computing
Interxion
Who Keeps the Cloud in the Air?
Microsoft
Patterns for Cloud Computing
PerspecSys
War in the Clouds: Are you ready?
ServiceMesh
The Big Win: Stop Playing Small-Ball with Your Cloud Strategy
Terremark
Evaluating Enterprise Clouds
Xiotech
Cloud Storage: Myths and Realities
POWER PANELS:
Cloud Expo New York: CTO Power Panel
Cloud Expo New York: CEO Power Panel
Cloud Expo New York: CMO Power Panel
Cloud Expo New York: Wrap-Up Power Panel
Click For 2010 West
Event Webcasts
Live Google News by SYS-CON!
Top Three Links You Must Click On


Grouped SPGridview Exceptions

By: Andrew Gelina
Dec. 8, 2008 09:50 AM

Yesterday I spent many hours trying to solve what should have been a simple issue - grouped views in a SPGridview.

 I was building a web part that used an embedded SPGridview - this was part of a template I created used by a TemplateBasedControl which was the created by the Web Part. All was working fine until I decided to add grouping. I set the GroupField, AllowGrouping, and AllowGroupCollapse properties:

<SharePoint:SPGridView AutoGenerateColumns="false" runat="server" ShowHeader="true" ShowFooter="true"
            GroupField="GroupField" AllowGroupCollapse="false"
            AllowGrouping="true"
 DisplayGroupFieldName="false"
            ID="inventoryGrid" AutoGenerateDeleteButton="false" AutoGenerateEditButton="false"
            AutoGenerateSelectButton="false">

The control rendered fine until a postback happened - then I started getting exceptions, relating to SPMenuField. Since I was not creating a SPMenuField I was confused. After much digging I came across some helpful hints - pointing to postback issues with SPGridview.

Of particular help was http://www.thesug.org/blogs/patrickr/Lists/Posts/Post.aspx?ID=2 . However I simplified my code down and it seemed to work for me. My solution involved creating my own Class derived from SPGridview and then overriding the LoadControlState method as shown in the above post but since my control was being used in a webpart and I cannot modify the page - I just called DataBind directly:

So my class code looks like:

 public class LTCSPGridView : SPGridView
 {
     protected override void LoadControlState(object savedState)
        {
            base.LoadControlState(savedState);
            if (this.DataSource == null)
            {
                this.DataBind();
                this.InvokeRequiresDataSource();
            }
        }

        public event EventHandler RequiresDataSource;

        protected void InvokeRequiresDataSource()
        {
            EventHandler handler = this.RequiresDataSource;
            if (handler != null)
            {
                handler(this, new EventArgs());
            }
        }
    }

My modified Template definition then looks like:

<ltc:LTCSPGridView AutoGenerateColumns="false" runat="server" ShowHeader="true" ShowFooter="true"
            GroupField="GroupField" AllowGroupCollapse="false" AllowGrouping="true" DisplayGroupFieldName="false"
            ID="inventoryGrid" AutoGenerateDeleteButton="false" AutoGenerateEditButton="false"
            AutoGenerateSelectButton="false">

 

This fixed my problems - I hope it helps someone else.

Ian.

Read the original blog entry...

Published Dec. 8, 2008— Reads 929
Copyright © 2008 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
About Andrew Gelina
Andrew Gelina brings over 12 years of software architecture and development experience to his role as CEO of Syrinx Consulting, where he is responsible for the strategic direction, technology focus, operations management, and growth of the firm.

Prior to joining Syrinx in 2003, Andrew helped build Web Technology Partners into a leading software engineering consulting firm before selling it in 2000 to Monster.com, the global online career and recruitment resource. During the next three years at Monster, he developed software and managed projects for virtually every area of Monster's operations, from CRM integration to e-commerce to high-traffic, high-volume Web development. He also worked closely with Microsoft to scale its .NET platform to Monster's huge transaction volumes.

Andrew has also worked in several other areas of technology leadership, performing technical due diligence for companies considering acquisitions and selling professional services. He started his career at EDS, helping them develop cellular billing and switch interface software to support the emerging wireless industry.

He graduated cum laude from the University of Massachusetts at Amherst, where he received a bachelor's degree in operations management. Andrew is a member of the CEO Roundtable of the Massachusetts Technology Leadership Council.

Andrew and his 35-member team work on-site with clients all over New England.

Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
Click to Add our RSS Feeds to the Service of Your Choice:
Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
Publish Your Article! Please send it to editorial(at)sys-con.com!

Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

SYS-CON Featured Whitepapers

ADS BY GOOGLE

Breaking Java News
EVE CINA First Shown at London Fashion Week
Post No Bills or Murals
CFIA/Allergy Alert Certain Lin's Farm Brand Honey Products May Contain Sulfonamide Antibiotic Drug Residue
Teamsters' Drive Up Standards Bus Campaign Reaches Milestone 300th Win

ADVERTISE   |   MAGAZINE SUBSCRIPTIONS   |   FREE BREAKING-NEWSLETTERS!   |   SYS-CON.TV   |   BLOG-N-PLAY!   |   WEBCAST   |   EDUCATION   |   RESEARCH

.NET Developer's Journal - .NETDJ   |   ColdFusion Developer's Journal - CFDJ   |   Eclipse Developer's Journal - EDJ   |   Enterprise Open Source Magazine - EOS
Open Web Developer's Journal - OPENWEB   |   iPhone Developer's Journal - iPHONE   |   Virtualization - Virtualization   |   Java Developer's Journal - JDJ   |   Linux.SYS-CON.com
PowerBuilder Developer's Journal - PBDJ   |   SEO / SEM Journal - SJ   |   SOAWorld Magazine - SOAWM   |   IT Solutions Guide - ITSG   |   Symbian Developer's Journal - SDJ
WebLogic Developer's Journal - WLDJ   |   WebSphere Journal - WJ   |   Wireless Business & Technology - WBT   |   XML-Journal - XMLJ   |   Internet Video - iTV
Flex Developer's Journal - Flex   |   AJAXWorld Magazine - AWM   |   Silverlight Developer's Journal - SLDJ   |   PHP.SYS-CON.com   |   Web 2.0 Journal - WEB2
Apache   |   CMS   |   CRM   |   HP   |   Oracle Journal   |   Perl   |   Python   |   Red Hat   |   Ruby on Rails   |   SAP   |   SaaS

SYS-CON MEDIA:   ABOUT US   |   CONTACT US   |   COMPANY NEWS   |   CAREERS   |   SITE MAP
SYS-CON EVENTS:   |  AJAXWorld Conference & Expo  |  iPhone Developer Summit  |  Cloud Computing Conference & Expo  |  SOA World Conference & Expo  |  Virtualization Conference & Expo
INTERNATIONAL SITES:   India  |  U.K.  |  Canada  |  Germany  |  France  |  Australia  |  Italy  |  Spain  |  Netherlands  |  Brazil  |  Belgium
 Terms of Use & Our Privacy Statement     About Newsfeeds / Video Feeds
Copyright ©1994-2008 SYS-CON Publications, Inc. All Rights Reserved. All marks are trademarks of SYS-CON Media.
Reproduction in whole or in part in any form or medium without express written permission of SYS-CON Publications, Inc. is prohibited.
 
close this window