Telerik Forums
UI for ASP.NET AJAX Forum
4 answers
200 views
Hi all,

I am working with a RadGrid with a NestedView that has Client row-selecting enabled and has EnablePostBackOnRowClick set to True.  When I attempt to expand a row (either by the Client "RowClick" or by using the expand column), I am handling the ItemCommand event server side to attempt to close any currently expanded rows, and expand only the currently clicked row (like in the "Overview" demo for the RadGrid).  Here is the RadGrid:

<telerik:RadGrid ID="gridShipmentsToBill" runat="server" Width="100%" DataSourceID="ShipmentsToBill" AllowSorting="True" AutoGenerateColumns="False" GridLines="Vertical">
                <ClientSettings EnablePostBackOnRowClick="true" EnableRowHoverStyle="True">
                    <Scrolling AllowScroll="True" ScrollHeight="500px" UseStaticHeaders="true"></Scrolling>
                    <Selecting AllowRowSelect="true" />
                </ClientSettings>
                 
                <MasterTableView HierarchyLoadMode="ServerBind" DataKeyNames="Shipment_Key" DataSourceID="ShipmentsToBill" RetainExpandStateOnRebind="false">
                    <Columns>
                        <telerik:GridBoundColumn DataField="Shipment_Key" ReadOnly="True" HeaderText="CPU #" SortExpression="Shipment_Key" UniqueName="Shipment_Key">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Shipment_AWorBOL" HeaderText="AWB/BOL #" SortExpression="Shipment_AWorBOL" UniqueName="Shipment_AWorBOL">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Customer_Name" HeaderText="Customer" SortExpression="Customer_Name" UniqueName="Customer_Name">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Shipment_Description" HeaderText="Description" SortExpression="Shipment_Description" UniqueName="Shipment_Description">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="Voyage_ArriveDate" HeaderText="Arrival Date" SortExpression="Voyage_ArriveDate" DataFormatString="{0:MM/dd/yyyy}" UniqueName="Voyage_ArriveDate" DataType="System.DateTime">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <NestedViewSettings DataSourceID="GeneralShipmentData">
                        <ParentTableRelation>
                            <telerik:GridRelationFields MasterKeyField="Shipment_Key" DetailKeyField="Shipment_Key"></telerik:GridRelationFields>
                        </ParentTableRelation>
                    </NestedViewSettings>
                    <NestedViewTemplate>
                        <div class="generalInfoForm">
                            <div class="leftForm">
                                <span>
                                    <label>Customer:</label>
                                    <%# Eval("Customer_Num")%> <%# Eval("Customer_Name") %></span>
                                <span>
                                    <label>Consignee:</label>
                                    <%# Eval("Consignee_Num")%> <%# Eval("Consignee_Name") %></span>
                                <span>
                                    <label>Arrival Date:</label>
                                    <%# Eval("Voyage_ArriveDate", "{0:MM/dd/yyyy}")%></span>
                            </div>
 
                            <div class="rightForm">
                                <span>
                                    <label>AWB/BOL:</label>
                                    <%# Eval("Shipment_AWorBOL")%></span>
                                <span>
                                    <label>Carrier:</label>
                                    <%# Eval("Carrier_Name")%></span>
                                <span>
                                    <label>Vessel:</label>
                                    <%# Eval("Vessel_Name") %></span>
                                <span>
                                    <label>Forwarding Agent:</label>
                                    <%# Eval("ForwardingAgent_Name") %></span>
                            </div>
 
                            <div class="middleForm"><%# Eval("Shipment_Description")%></div>
 
                            <div class="leftForm">
                                <span>
                                    <label>Volume Weight:</label>
                                    <%# Eval("ShipPackage_VolumeWeight")%></span>
                                <span>
                                    <label>Weight:</label>
                                    <%# Eval("ShipPackage_TotalWeight")%></span>
                                <span>
                                    <label>Cube:</label>
                                    <%# Eval("ShipPackage_TotalVolume")%></span>
                                <span>
                                    <label>Freight:</label>
                                    <%# Eval("ShipmentCover_FaceFreight")%></span>
                            </div>
                        </div>
                    </NestedViewTemplate>
                </MasterTableView>
            </telerik:RadGrid>
And here is the ItemCommand event handler:

Protected Sub gridShipmentsToBill_ItemCommand(sender As Object, e As GridCommandEventArgs) Handles gridShipmentsToBill.ItemCommand
        If e.CommandName = "RowClick" OrElse e.CommandName = RadGrid.ExpandCollapseCommandName Then
            Dim previousState As Boolean = e.Item.Expanded
 
            If e.CommandName = "ExpandCollapse" Then
                previousState = Not previousState
            End If
 
            CollapseAllRows()
            e.Item.Expanded = Not previousState
        End If
    End Sub
 
    Private Sub CollapseAllRows()
        For Each item As GridItem In gridShipmentsToBill.MasterTableView.Items
            item.Expanded = False
        Next
    End Sub

If I was to only click on the expand/collapse column to open the rows, I would have no issue and the Grid would behave as I expect.  But if I click on a row (which should expand that Row's NestedView), I see that the following uncaught exception is displayed in my browser's console:

"Uncaught Sys.WebForms.PageRequestManagerServerErrorException: Sys.WebForms.PageRequestManagerServerErrorException: DataBinding: 'ToString()' is not a valid indexed expression."

If, however, I change AllowRowSelect to be set to False (while leaving EnablePostbackOnRowClick set to True), the program works as I would expect (when clicking the expand/collapse column or clicking the row).

While I could probably work with this, I'm wondering why it is not working when AllowRowSelect is set to True.  (Also, the default styling for the SelectedRow is not applied when AllowRowSelect is set to False).

I'm fairly new to Telerik's controls, so I may be missing something obvious, but thanks for any help/suggestions.
Benjamin
Top achievements
Rank 1
 answered on 23 May 2014
2 answers
279 views
Hi ,

I have two Rad list box . On is the source and the other is the destination. The source list box is bound with data and on transfer to Destination i wanted a jquery event to fire so that the items in the Radlist Destination would refresh the Grid to the those items which are moved from source to destination. For example I Have selected Employee 2 and employee 4 to be moved to destination my rad grid should refresh and display data with employees 2 and 4. Please help me out i am not able to choose the proper even. I have used on client load but it works but it continuously loads without stopping.The page is continuously refreshed.

Thanks in advance.

Vvamc
Top achievements
Rank 1
 answered on 23 May 2014
2 answers
229 views
Hello,

I was wondering if someone could help me here. I have read both this and this but still struggling on what I am trying to do.

Here is my RAD GRID below

<telerik:RadGrid ID="rgDocuments" runat="server" DataSourceID="AssetDocument" AutoGenerateEditColumn="True" AllowAutomaticUpdates="True">
                                      <MasterTableView AutoGenerateColumns="False" DataKeyNames="Doc_DocumentID" DataSourceID="AssetDocument">
                                          <Columns>
                                              <telerik:GridBoundColumn Visible="false" ReadOnly="True"  DataField="Doc_DocumentID" FilterControlAltText="Filter Doc_DocumentID column" HeaderText="Doc_DocumentID" SortExpression="Doc_DocumentID" UniqueName="Doc_DocumentID">
 
                                              </telerik:GridBoundColumn>
                                              <telerik:GridTemplateColumn AllowFiltering="false" UniqueName="LessonColumn">
                                                  <ItemTemplate>
                                                      <a href="Download.aspx?File=<%#Eval("Doc_FullFilePath")%>">
                                                          <asp:Image ImageUrl="images/download.jpg"
                                                              ID="imgTest" runat="server" Height="25px" Width="25px" />
                                                      </a>
                                                  </ItemTemplate>
                                              </telerik:GridTemplateColumn>
 
                                              <telerik:GridButtonColumn HeaderText="Delete" ButtonType="ImageButton" CommandName="Delete"
                                                  FilterControlAltText="Filter DeleteColumn column"
                                                  ImageUrl="~/Images/delete_97221.jpg" Text="Delete"
                                                  UniqueName="DeleteColumn" Resizable="false" ConfirmText="Are you sure you wish to delete this document from this asset?">
                                                  <HeaderStyle CssClass="rgHeader ButtonColumnHeader"></HeaderStyle>
                                                  <ItemStyle CssClass="ButtonColumn" />
                                              </telerik:GridButtonColumn>
                                              <telerik:GridDropDownColumn EditFormColumnIndex="1" DataSourceID="DropDown" ListTextField="FieldAnswer" ListValueField="IDNo"
                                                  UniqueName="Doc_CategoryID" HeaderText="Category Column" DataField="Doc_CategoryID"
                                                  AllowAutomaticLoadOnDemand="true"
                                                  AllowVirtualScrolling="true" ShowMoreResultsBox="true" ItemsPerRequest="10">
                                              </telerik:GridDropDownColumn>
                                                                                            <telerik:GridBoundColumn DataField="Doc_Description" FilterControlAltText="Filter Doc_Description column" HeaderText="Description" SortExpression="Doc_Description" UniqueName="Doc_Description">
                                                  <ColumnValidationSettings>
                                                      <ModelErrorMessage Text="" />
                                                  </ColumnValidationSettings>
                                              </telerik:GridBoundColumn>
                                          </Columns>
                                      </MasterTableView>
                                  </telerik:RadGrid>

Below are the two SQL Data Sources.

The link between them is that the Table "Documents" Column "Doc_CategoryID" should match up to the Table "Customisation" column IDNO and the available choices which the user can select should be displayed from the Table "Customisation" Column "FieldAnswer".

  <asp:SqlDataSource ID="AssetDocument" runat="server" ConnectionString="<%$ ConnectionStrings:SD %>" SelectCommand="Select Doc_DocumentID,Doc_Description,Doc_LongNotes, Doc_FilePath,Doc_FileName,Doc_CategoryID, Doc_FilePath + Doc_FileName as Doc_FullFilePath from Documents where Doc_AssetID = @AssetID and Doc_Deleted is null order by Doc_DocumentID ASC" UpdateCommand="UPDATE Documents SET Doc_Description = @Doc_Description WHERE (Doc_DocumentID = @Doc_DocumentID) AND (Doc_Deleted IS NULL)">
                <SelectParameters>
                    <asp:SessionParameter DefaultValue="0" Name="AssetID" SessionField="AssetID" />
                </SelectParameters>
                <UpdateParameters>
                    <asp:Parameter Name="Doc_Description" />
                  <asp:Parameter Name="Doc_DocumentID" />
                </UpdateParameters>
            </asp:SqlDataSource>
 
 
<asp:SqlDataSource ID="DropDown" runat="server" ConnectionString="<%$ ConnectionStrings:SD %>" SelectCommand="SELECT IDNO, FieldAnswer from easb_Customisation WHERE (([ScreenName] = 'Documents') AND ([FieldName] = 'Category')) ORDER BY [OrderBy], [FieldAnswer]"></asp:SqlDataSource>
 
The part where it fails to work is when the user clicks the Edit Button on the RadGrid, it just errors out saying this below. I have tried different options in the UniqueName but none of them i have tried is working. Any ideas?  

Server Error in '/' Application.
 
Editor cannot be initialized for column: Doc_CategoryID
  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: Telerik.Web.UI.GridColumnEditorException: Editor cannot be initialized for column: Doc_CategoryID
 
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. 


Thanks,
Alex


Alex
Top achievements
Rank 1
 answered on 23 May 2014
5 answers
139 views
Hello,

I am trying to save user preference and load them back again.  I did check this (http://demos.telerik.com/aspnet-ajax/pivotgrid/examples/applicationscenarios/persisting-radpivotgrid-settings/defaultcs.aspx) demo for it and created a test page but I am not able to load a saved state.  So I am able to save a state but after I reset the state I am not able to load it again.  I am missing something but am not sure what it is.  Can you please help me.


My aspx page

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="TelerikPersistance.aspx.cs" Inherits="Test_TelerikPersistance"  %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">    
    <asp:Label ID="lst" runat ="server" Text ="test"/>
    <tlrk:RadScriptManager runat="server" ID="RadScriptManager1" />
    <tlrk:RadPersistenceManager runat="server" ID="RadPersistenceManager1">
        <PersistenceSettings>
            <tlrk:PersistenceSetting ControlID="RadPivotGrid1" />
        </PersistenceSettings>
    </tlrk:RadPersistenceManager>
    <tlrk:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></tlrk:RadAjaxLoadingPanel>
    <tlrk:RadAjaxPanel ID="RadAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        <tlrk:RadButton ID="SaveButton" runat="server" Text="Save state" OnClick="SaveButton_Click"  AutoPostBack="true"/>
        <tlrk:RadButton ID="ResetButton" runat="server" Text="Reset stored state" OnClick="ResetButton_Click"  AutoPostBack="true"/>
        <tlrk:RadButton ID="LoadButton" runat="server" Text="Load state" OnClick="LoadButton_Click"  AutoPostBack="true"/>
        <tlrk:RadPivotGrid ID="RadPivotGrid1" runat="server" AllowFiltering="true"
            AllowPaging="true" PageSize="12" ShowFilterHeaderZone="false" AllowSorting="true" EnableConfigurationPanel="true">           
            <ConfigurationPanelSettings Position="Left" DefaultDeferedLayoutUpdate="true" />
        </tlrk:RadPivotGrid>
    </tlrk:RadAjaxPanel>
    </form>
</body>
</html>



My C# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Configuration;
using System.Configuration;

public partial class Test_TelerikPersistance : System.Web.UI.Page
{
 protected void Page_Load(object sender, System.EventArgs e)
 {
  if (!IsPostBack)
  {
   string s = null;
   if (WebConfigurationManager.ConnectionStrings["XXXXXX"] != null)
    s = WebConfigurationManager.ConnectionStrings["XXXXXX"].ConnectionString;
   string cubeName = ConfigurationManager.AppSettings["LaborCubeName"];
   RadPivotGrid1.OlapSettings.ProviderType = Telerik.Web.UI.PivotGridOlapProviderType.Adomd;
   RadPivotGrid1.OlapSettings.AdomdConnectionSettings.ConnectionString = s;
   RadPivotGrid1.OlapSettings.AdomdConnectionSettings.Cube = cubeName;
  }
  if (!IsPostBack && Object.Equals(Session["CustomPersistenceSettingsKey"], null))
  {
   LoadButton.Enabled = false;
   lst.Text = "in page load ";
  }
 }

 protected void SaveButton_Click(object sender, EventArgs e)
 {
  Session["CustomPersistenceSettingsKey"] = this.Session.SessionID;
  string fileId = Session["CustomPersistenceSettingsKey"].ToString();
  lst.Text = fileId;
  LoadButton.Enabled = true;
  RadPersistenceManager1.StorageProviderKey = fileId;
  RadPersistenceManager1.SaveState();
 }

 protected void ResetButton_Click(object sender, EventArgs e)
 {
  Response.Redirect(Request.Url.ToString());
 }

 protected void LoadButton_Click(object sender, EventArgs e)
 {
  string fileId = Session["CustomPersistenceSettingsKey"].ToString();
  RadPersistenceManager1.StorageProviderKey = fileId;
  lst.Text = " Load btn " + fileId;
  RadPersistenceManager1.LoadState();
  RadPivotGrid1.Rebind();
 }
}

Thank you,
Kalyani
Maria Ilieva
Telerik team
 answered on 23 May 2014
3 answers
82 views
Hi
Is it possible to set a max number of columns fields in the fieldswindows?
Maria Ilieva
Telerik team
 answered on 23 May 2014
1 answer
92 views
Hi All, I 'm a matter when using RadGrid and radwindow to
insert/update data from database. I used Formview to add data( controls:
textbox, combobox), but i used two related combox in formview to filter
data , i have  error:
Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control.
My codes:
1. combox 1:
<telerik:RadComboBox ID="ddlMaSP" Runat="server" DataSourceID="SqlDsMaSP"

DataTextField="TenSP" DataValueField="MaSP" SelectedValue='<%# Bind("MaSP") %>'

Skin="Office2007" Width ="300px">

</telerik:RadComboBox>

<asp:SqlDataSource ID="SqlDsMaSP" runat="server"

ConnectionString="<%$ ConnectionStrings:PGKH %>" SelectCommand="PGKH_CboMaSP"

SelectCommandType="StoredProcedure">

</asp:SqlDataSource>

2. combbox thứ 2:

<telerik:RadComboBox ID="ddlCTMaSP" Runat="server" DataSourceID="SqlDsCTMaSP"

DataTextField="CTMaSP" DataValueField="IdCTMaSP"

SelectedValue='<%# Bind("IdCTMaSP") %>' Skin="Office2007" Width ="300px">

</telerik:RadComboBox>

<asp:SqlDataSource ID="SqlDsCTMaSP" runat="server"

ConnectionString="<%$ ConnectionStrings:PGKH %>"

SelectCommand="PGKH_CboChiTietMaSP" SelectCommandType="StoredProcedure">

<SelectParameters>

<asp:ControlParameter ControlID="ddlMaSP" Name="MaSP"

PropertyName="SelectedValue" Type="Int32" />

</SelectParameters>

</asp:SqlDataSource>
I get error When i using Autopostback for two comboxbox, but i not
use Autopostback is not error but two comboxbox not related. Thanks all.
Nencho
Telerik team
 answered on 23 May 2014
1 answer
34 views
When using Internet Explorer on a Windows Phone, when typing the first character into a radmaskedtextbox, the cursor will skip to past the end of the input mask. So if the mask if four characters, after the first character is entered, the cursor will skip to the fifth position. Tested on a HTC6990LVW running Windows Phone 8.
Daniel
Telerik team
 answered on 23 May 2014
3 answers
110 views


Hi  all.

I have a radtreelist in my application.I have given the code  in 'aspx' below.

 

 

<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"  />

 

 

 

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">

 

 

 

<AjaxSettings>

 

 

 

 

<telerik:AjaxSetting AjaxControlID="RadTreeList1">

 

 

 

<UpdatedControls>

 

 

 

<telerik:AjaxUpdatedControl ControlID="RadTreeList1" LoadingPanelID="RadAjaxLoadingPanel1" />

 

 

 

</UpdatedControls>

 

 

 

</telerik:AjaxSetting>

 

 

 

 

</AjaxSettings>

 

 

 

</telerik:RadAjaxManager>

 

 

 

<br />

 

 

 

 

<telerik:RadTreeList ID="RadTreeList1" runat="server" OnNeedDataSource="RadTreeList1_NeedDataSource"

 

 

 

AutoGenerateColumns="false" AllowMultiItemSelection="true"

 

 

 

AllowPaging="false" AllowSorting="true" DataKeyNames="ID"

 

 

 

ParentDataKeyNames="PID" AlternatingItemStyle-BackColor ="#EFF5FB" ItemStyle-BackColor="#E0ECF8" ShowTreeLines="false" >

 

 

 

 

<Columns>

 

 

 

 

 

<telerik:TreeListBoundColumn DataField="Code" UniqueName="Code" HeaderText="Heading" HeaderStyle-Width="90" ItemStyle-Font-Names="Arial, Sans-Serif" />

 

 

 

<telerik:TreeListBoundColumn DataField="StatisticalCode" UniqueName="StatisticalCode" HeaderText="Stats Code" HeaderStyle-Width="50" HeaderStyle-Wrap="true" ItemStyle-Font-Names="Arial, Sans-Serif" ItemStyle-Font-Size="Medium" HeaderStyle-Font-Names="Arial, Sans-Serif" HeaderStyle-Font-Size="Medium" HeaderStyle-Font-Bold="true" HeaderStyle-BackColor="White" ItemStyle-BorderColor="White"/>

 

 

 

<telerik:TreeListBoundColumn DataField="Test" UniqueName="Test"/>

 

 

 

 

</Columns>

 

 

 

 

</telerik:RadTreeList>

My problem is when I expand the node I feel the page flickering.How to avoid this flickering (postback) feeling?

Thanks

Sindu

 

Princy
Top achievements
Rank 2
 answered on 23 May 2014
6 answers
964 views
Hi,

When resizing a column by increase to the right, it reduce left columns size.
Is there any way to freeze the left columns or at least one column during resize?
Galin
Telerik team
 answered on 23 May 2014
1 answer
89 views
I am inserting a large csv into a db and would like to keep track of the progress. During the insert of the csv I update an additional progress table with the total and current row count. Is there anyway for me to update the progressarea while the csv data is being inserted with a query to the progress table? I've tried to just add a query the custom progressarea demo but can seem to get both to run at the same time. Any help or suggestions on a different approach would be well appreciated.

Thanks
Peter Filipov
Telerik team
 answered on 23 May 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?