Jump to content
Software FX Community

Invalidcast exception: unable to cast GridItem to GridItemGroup


rvillamilj

Recommended Posts

Hi,

 I just downloaded and have been learning how to use the Grid FX control, so far it looks pretty good.  My biggest need is grouping, and I haven't been able to get it to work, when I try to collapse or expand the group I get a popup with the message:

There was a problem while processing your request.  The specific error message was: Exception type: System.InvalidCastExceptionMessage: Unable to cast object of type 'GridFX.WebForms.GridItem' to type 'GridFX.WebForms.GridItemGroup'.Stack Trace:   at GridFX.WebForms.CellContainerCommandArgs`1.a(Object A_0)

This is my markup:

<GridFX:Grid ID="selectedGrid" runat="server" Motif="xPExplorer" Palette="xPExplorer">   <DataFields>     <GridFX:TextField DataPath="salutation_id" UniqueID="salID" Title="Salutation">       <Grouping Enabled="true"></Grouping>     </GridFX:TextField>     <GridFX:TextField DataPath="EmailAddress" Title="Email" UniqueID="email"></GridFX:TextField>                     </DataFields>   <Border Type="none" />   <TitleBar Visible="false"></TitleBar>   <ToolBar Visible="false"></ToolBar>   <Grouping Enabled="True">     <RootLevel Expanded="false" Field="salID"></RootLevel>   </Grouping></GridFX:Grid>

I'm databinding the grid to a List<T> and when I don't do the grouping it works great.  If I enable the FloatingBar I can collapse/expand the group using one of the buttons for this, but I'm looking to disable the floating bar and just use the + or - sign.

Thanks! 

Link to comment
Share on other sites

 Hi, thanks, this is the code where I build a list and databind it to my grid.  The grid I want to group is selectedGrid. I'm building a proof of concept for work, so this code is pretty basic, but it's crucial to be able to determine if we can use this functionality of the grid before we decide to purchase GridFX or Infragistics, any help is highly appreciated!

 

  protected void OnAddSelectedClick(object sender, EventArgs e)   {     List<ProductOffering> selected = new List<ProductOffering>();     foreach (GridViewRow row in availableGrid.Rows)     {       ProductOffering po = new ProductOffering();       po.SolomonGR = row.Cells[1].Text;       po.OfferingName = row.Cells[3].Text;       po.CRMID = Int32.Parse(row.Cells[4].Text);       selected.Add(po);     }     selectedGrid.DataSource = selected;     selectedGrid.DataBind();   } 

Link to comment
Share on other sites

 Another thing that may help you help me is that I can't modify the grid on the designer since I get this error message, I've tried removing the grid then readding it without any options and I always get: 

Error Creating Control - selectedGrid

Exception has been thrown by the target of an invocation. 

 

I'm thinking it could be related to the assemblies registered in my aspx page, this is what gets auto added when I add a GridFX control:

<%@ Register Assembly="GridFX.WebForms" Namespace="GridFX.WebForms" TagPrefix="chartfx7" %><%@ Register Assembly="GridFX.WebForms" Namespace="GridFX.WebForms" TagPrefix="GridFX" %>

 

And these are the dlls in my Bin folder:

ChartFX.Base.dll

ChartFX.WebForms.Adornments.dll 

ChartFX.WebForms.Base.dll 

ChartFX.WebForms.Dhtml.dll 

ChartFX.WebForms.dll 

ChartFX.WebForms.Gauge.dll 

GridFX.WebForms.dll 

GridFX.WebForms.dll.refresh 

GridFX.WebForms.xml 

 

Thanks!

 Ricardo V.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...