GroupButton OnItemSelect generates exception when changing the selection causes exception

Exception is:

Value cannot be null.
Parameter name: input

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.ArgumentNullException: Value cannot be null.
Parameter name: input

Source Error: 

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace: 

[ArgumentNullException: Value cannot be null.
Parameter name: input]
   System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(JavaScriptSerializer serializer, String input, Type type, Int32 depthLimit) +114
   Syncfusion.JavaScript.Web.GroupButton.LoadViewState(Object state) +214
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +224
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +144
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +207
   System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) +144
   System.Web.UI.Control.LoadViewStateRecursive(Object savedState) +207
   System.Web.UI.Page.LoadAllState() +464
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1863

Code from Codebehind which is causing the error, when removed, doesn't error
        protected void gb_ItemSelect(object sender, Syncfusion.JavaScript.Web.GroupButtonEventArgs e)
        {
            //SelectedText = gb.Items[(int)e.Arguments["index"]].Text;
        }
Code .aspx page
                <ej:GroupButton ID="gb" runat="server" OnItemSelect="gb_ItemSelect" 
                    Width="100%" Height="100%" 
                    GroupButtonMode="RadioButton"  
                    ShowRoundedCorner="true">                   
                </ej:GroupButton>
Yes, jquery is included, yes all of the required .js and .css files are included
Created page by dragging control from Tools onto page
Updated to latest stable version
Any suggestions would be appreciated
Trying to access what button is selected.
Simple page, not a user control, but I will be migrating to a user control when done


3 Replies

BC Berly Christopher Syncfusion Team October 23, 2017 12:44 PM UTC

Hi Chris,   
   
Thanks for contacting Syncfusion Support.   
  
We were unable to reproduce the reported issue (“GroupButton OnItemSelect generates exception when changing the selection causes exception”) at our end. We suspected that this issue may be caused due to GroupButton items are not defined in the view page. Also, please ensure that all script files are loaded correctly in your application.    
Please refer the below code example.   
 
Default.aspx: 
<ej:GroupButton ID="GroupButton1" runat="server" Width="100%" Height="100%" ShowRoundedCorner="true" GroupButtonMode="RadioButton" OnItemSelect="GroupButton1_ItemSelect"> 
<Items> 
<ej:GroupButtonItem Text="Save"></ej:GroupButtonItem> 
<ej:GroupButtonItem Text="Open"></ej:GroupButtonItem> 
<ej:GroupButtonItem Text="Delete"></ej:GroupButtonItem> 
</Items> 
</ej:GroupButton> 
 
Default.aspx.cs: 
 
   protected void GroupButton1_ItemSelect(object sender, Syncfusion.JavaScript.Web.GroupButtonEventArgs e) 
        { 
         SelectedText = GroupButton1.Items[(int)e.Arguments["index"]].Text; 
        } 
 
 
We have prepared a sample based on your requirement. Please get the sample from the below location.   
 
  
To know more about OnItemSelect please refer the below UG Documentation link.   
 
Please check with given sample. If issue persists, please revert with issue reproducing sample that will help us to provide solution.   
 
Regards, 
Berly B.C 



CK chris kraft October 26, 2017 10:20 PM UTC

Thank you for the reply, however the button's text values are being set in the code behind file.  The example from Syncfusion uses this method in the Page_Load section of the .cs file.  My prototype does the same.

As stated prior, all required files are loaded in the header.

Page loads, but OnItemSelect generates and error.  When I remove the OnItemSelect from the groupbutton, it works fine but I'm not able to take action when an item is selected.

I added some logging and the issue seems to occur right at the click.  I logged the setting of the buttons and it occurs when the page initially loads but not when clicked.


Can you provide a sample with the buttons set in codebehind and using the OnItemSelect event?

I did look at your sample but since it doesn't set the buttons in the codebehind isn't relavent.  I also tested with setting the buttons in the aspx file and it seemed to work ok.  The purpose is to build a user control for different button types but have the same basic methods for retrieving the settings, validation, etc.  My project includes about 5 different button groups and I'd rather maintain one user control rather than 5 since they are very similar.

Thanks




BC Berly Christopher Syncfusion Team October 27, 2017 12:43 PM UTC

Hi Chris, 
Sorry for the inconvenience caused. 
We were able to reproduce the reported issue while we render the group button by using data source (“GroupButton OnItemSelect generates exception when changing the selection causes exception”). We have created a support incident to track the status of this forum has been created under your account. Please log on to our support website to check for further updates. 
 
 
Regards, 
Berly B.C 


Loader.
Up arrow icon