This is a migrated thread and some comments may be shown as answers.

GridCommandEventArgs e problem with RadGrid upgrade from 2010 to 2013

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
grace yang
Top achievements
Rank 1
grace yang asked on 16 Sep 2013, 09:08 PM

 We had RadControls for ASP.NET AJAX 2010 verstion when this app was first created. ASPX file has a simple RadGrid in it and everything worked fine. 
Beginning this year we found out RadGrid in my App is not working with IE10. Telerik suggested us to upgrade to 2013 version.Then we did upgrade.
Now we are haveing the latest version of RadControls (2013 Q2). The .net framework is 3.5. I copied all dll files from C:\Program Files\Telerik\RadControls for ASP.NET AJAX Q2 2013\Bin35
to my own project bin folder and added reference again.

The problem is that RadGrid is getting worse it does not even work for IE8 anymore.
When<telerik:GridButtonColumn ButtonType="LinkButton" DataTextField="type" UniqueName="type" CommandName="OnType"  ></telerik:GridButtonColumn> is clicked
dataItem["document"].Text  keeps on getting a vaule of "&nbsp;".

Below are my ASPX file and code behind it.
  
Thank you for your help.



****ASPX file:***********


<
telerik:RadScriptManager runat="server" ID="RadScriptManager2" />
                        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
                            <AjaxSettings>
                                <telerik:AjaxSetting AjaxControlID="dgDocuments">
                                    <UpdatedControls>
                                        <telerik:AjaxUpdatedControl ControlID="dgDocuments" LoadingPanelID="RadAjaxLoadingPanel1" />
                                    </UpdatedControls>
                                </telerik:AjaxSetting>
                            </AjaxSettings>
                        </telerik:RadAjaxManager>
                        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />  
             <telerik:RadGrid runat="server" ID="dgDocuments" AllowPaging="True"  Width="60%" 
                   AllowSorting="False" GridLines="None"
                 Skin="Simple" AutoGenerateColumns="False"  PageSize="200" 
                 ShowStatusBar="true" OnItemCommand="dgDocuments_ItemCommand" 
                 onneeddatasource="dgDocuments_NeedDataSource" 
                 oncolumncreated="dgDocuments_ColumnCreated" 
                 onitemcreated="dgDocuments_ItemCreated" >
            <GroupHeaderItemStyle Font-Bold = "true"    /> 
            <GroupingSettings CaseSensitive="false" />
            <ClientSettings AllowGroupExpandCollapse="True" >
            </ClientSettings>
             <MasterTableView   GroupsDefaultExpanded="true" ItemStyle-Wrap="false" 
                  HeaderStyle-Wrap="false"  AutoGenerateColumns="false" EditMode="InPlace"   
                  ShowHeader = "false"    TableLayout="Auto"  GroupLoadMode="Client" >
                <PagerStyle Mode="NumericPages" />
             <Columns>                          
             <telerik:GridButtonColumn ButtonType="LinkButton" DataTextField="type" UniqueName="type" CommandName="OnType"  ></telerik:GridButtonColumn>
             <telerik:GridBoundColumn  DataField="status" Visible="false" ></telerik:GridBoundColumn
             <telerik:GridBoundColumn  DataField="document" Visible="false" ></telerik:GridBoundColumn>                      
            </Columns>          
            <GroupByExpressions>
              <telerik:GridGroupByExpression >
                                    <GroupByFields>
                                        <telerik:GridGroupByField   FieldName="id" HeaderText=" " HeaderValueSeparator=""  />
                                    </GroupByFields>
                                    <SelectFields>
                                        <telerik:GridGroupByField FieldName="document" HeaderText=" " HeaderValueSeparator=""   />
                                    </SelectFields>
               </telerik:GridGroupByExpression>
             </GroupByExpressions>
            </MasterTableView>
           </telerik:RadGrid>

*****Code****:

protected
void dgDocuments_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
       {
           DataTable table = new DataTable();
           table.Columns.Add("document", typeof(string));
           table.Columns.Add("type", typeof(string));
           table.Columns.Add("status", typeof(string));
           table.Columns.Add("id", typeof(int));
           if (Session["commercial"].ToString().ToUpper() == "N")
           {
               table.Rows.Add("Product Catalog", "Active Product", "CURRENT",1);
           }
           table.Rows.Add("Product Specifications (EHB)", "Active Product", "CURRENT", 2);
           table.Rows.Add("Product Specifications (EHB)", "Out of Production", "DISCONTINUED", 2);
           table.Rows.Add("Installation Instructions", "Active Product", "CURRENT",3);
           table.Rows.Add("Installation Instructions", "Out of Production", "DISCONTINUED",3);
           table.Rows.Add("Service Literature", "Active Product & Out of Production", "BOTH", 4);
           table.Rows.Add("Service & Application Notes", "Active Product & Out of Production", "BOTH",5);
           table.Rows.Add("Application and Design Guidelines", "Active Product & Out of Production", "BOTH",6);
           table.Rows.Add("Wiring Diagrams", "Active Product", "CURRENT",7);
           table.Rows.Add("Wiring Diagrams", "Out of Production", "DISCONTINUED",7);
           table.Rows.Add("User Manuals", "Active Product", "CURRENT", 8);
           table.Rows.Add("User Manuals", "Out of Production", "DISCONTINUED", 8);                  
           dgDocuments.DataSource = table;
       }
       protected void dgDocuments_ItemCommand(object source, GridCommandEventArgs e)
       {
           if (e.CommandName.Equals("OnType"))
           {
               GridDataItem dataItem = (GridDataItem)e.Item;
               Session["ProductStatus"] = dataItem["status"].Text;
               if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == PRODUCT_CATALOG.ToUpper())
               {
                   Session["publication"] = PRODUCT_CATALOG;
                   Session["publicationID"] = "9";
                   Response.Redirect("SearchbyCategory_ProductCatlog.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == ENGINEERING_HANDBOOK.ToUpper())
               {
                   Session["publication"] = ENGINEERING_HANDBOOK;
                   Session["publicationID"] = "8";
                   Response.Redirect("SearchbyCategory_engineering.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == HOMEOWNERS_MANUALS.ToUpper())
               {
                   Session["publication"] = HOMEOWNERS_MANUALS;                  
                   Session["publicationID"] = "5";
                   Response.Redirect("SearchbyCategory.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == INSTALLATION_INSTRUCTION.ToUpper())
               {
                   Session["publication"] = INSTALLATION_INSTRUCTION;
                   Session["publicationID"] = "1";
                   Response.Redirect("SearchbyCategory.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == WIRING_DIAGRAMS.ToUpper())
               {
                   Session["publication"] = WIRING_DIAGRAMS;
                   Session["publicationID"] = "3";
                   Response.Redirect("SearchbyCategory.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == SERVICE_MANUALS.ToUpper())
               {
                   Session["publication"] = SERVICE_MANUALS;
                   Session["publicationID"] = "4";
                   Response.Redirect("SearchbyCategory.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == SERVICE_APP.ToUpper())
               {
                   Session["publication"] = SERVICE_APP;
                   Session["publicationID"] = "6";
                   Response.Redirect("SearchbyCategory.aspx");
               }
               else if (dataItem["document"].Text.ToUpper().Trim().ToUpper() == APPLICATION_DESIGN.ToUpper())
               {
                   Session["publication"] = APPLICATION_DESIGN;
                   Session["publicationID"] = "13";
                   Response.Redirect("SearchbyCategory.aspx");
               }
           }
       }

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Sep 2013, 06:24 AM
Hello,

Please use Display in-place of visible.

<telerik:GridBoundColumn DataField="status" Display="false">
               </telerik:GridBoundColumn>
               <telerik:GridBoundColumn DataField="document" Display="false">
               </telerik:GridBoundColumn>

for more information : http://www.telerik.com/community/forums/aspnet-ajax/grid/breaking-change-hidden-column-cell-text-is-not-persisted-in-viewstate.aspx

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
grace yang
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or