Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
194 views
Hi,

We have been using an older version of Telerik components (Telerik.Web.UI 2010.3.1317.20) in our web application and now we're looking into the latest one trial to upgrade.

One problem we're facing now is that in the same implementation of a RadGrid, getting the index of the selected row was zero based in our existing code (older version of Telerik). However, implementing the same using the new version of Telerik (2014.1.513.40) will return an incremented result. 
For example, if the first row of the grid is selected, in the old version the index value was zero, but in the new version it returns 1.

This is the implementation of my RadGrid:
<telerik:RadGrid GridLines="none" ID="RadGrid1" runat="server"
        AllowMultiRowSelection="true"
        AllowPaging="true"
        AllowCustomPaging="true"
        AllowSorting="true"
        AllowAutomaticDeletes="true"
        AutoGenerateColumns="true"
        ShowStatusBar="false"
        OnNeedDataSource="RadGrid1_NeedDataSource"
        OnItemDataBound="RadGrid1_ItemDataBound"
        OnItemCommand="RadGrid1_ItemCommand"
        OnGroupsChanging="RadGrid1_GroupsChanging"
        OnColumnCreated="RadGrid1_ColumnCreated"
        OnDataBound="RadGrid1_DataBound"
        OnSortCommand="RadGrid1_SortCommand"
        OnItemCreated="RadGrid1_ItemCreated"
        OnPreRender="RadGrid1_PreRender"
        HorizontalAlign="NotSet"
        Visible="false">
        <ClientSettings AllowColumnHide="true"
            AllowColumnsReorder="true"
            AllowDragToGroup="true"
            ReorderColumnsOnClient="true"
            AllowKeyboardNavigation="true"
            AllowRowsDragDrop="true"
            AllowAutoScrollOnDragDrop="false"
            EnablePostBackOnRowClick="false"
            EnableRowHoverStyle="true">
            <Resizing AllowColumnResize="true" EnableRealTimeResize="true" ResizeGridOnColumnResize="true" />
            <Selecting AllowRowSelect="true" />
            <Scrolling UseStaticHeaders="true" SaveScrollPosition="true" AllowScroll="true" />
            <ClientEvents OnRowContextMenu="RadGrid1_RowContextMenu"
                OnRowDropping="RadGrid1_RowDropping"
                OnActiveRowChanged="RadGrid1_ActiveRowChanged"
                OnRowSelected="RadGrid1_RowSelected"
                OnRowDblClick="RadGrid1_RowDblClick"
                OnKeyPress="RadGrid1_KeyPress"
                OnCommand="RadGrid1_Command"
                OnRowClick="rowClick"
                OnRowMouseOver="RowMouseOver"
                OnRowMouseOut="RowMouseOut"            
                OnMasterTableViewCreated="RadGrid1_MasterTableViewCreated" />
        </ClientSettings>
        <MasterTableView AllowMultiColumnSorting="false" DataKeyNames="ID,Unread,FolderPath" Width="100%"
            ClientDataKeyNames="ID,Unread,FolderPath" TableLayout="Fixed">
            <PagerStyle Mode="NextPrevNumericAndAdvanced" PageButtonCount="3" AlwaysVisible="true" />
        </MasterTableView>
     </telerik:RadGrid>


This is how I am getting the index from js:
function RadGrid1_RowSelected(sender, eventArgs)
{
    var mst = sender.get_masterTableView();
    var index = eventArgs.get_gridDataItem().get_element().rowIndex;
}

I would like to know if the behavior of the RadGrid has been changed since the older version, or I am doing something wrong here.

Thank you.



Ali
Top achievements
Rank 1
 answered on 26 May 2014
1 answer
227 views
hello,
i want to add a check box on the each tab in a tabstrip in front of the tab text can i do that and user can check or uncheck this also.

Regards.
Sotir
Top achievements
Rank 1
 answered on 25 May 2014
18 answers
1.3K+ views

After a lot of searching and hair pulling I have tracked down what seems to be a real deal breaker issue with a lot of rad controls especially radgrid, sorry for the vagueness of this post but it has been a long few days of deadlines :)

When using IE11 preview to view sites with enablepostbackonrowclick set on a radgrid -  clicking on the rows does not work and rather raises a hidden away JavaScript error of: if($telerik.isIE){document.attachEvent("onmousedown",this._onDocumentClickDelegate);

The problem is particular to IE11 and it is not just related to it being in preview.

It is discussed at http://msdn.microsoft.com/en-us/library/ie/ms536343(v=vs.85).aspx 

In this post it says:

attachEvent method

[attachEvent is no longer supported. Starting with Internet Explorer 11 Preview, use addEventListener. For info, see Compatibility changes.]

Binds the specified function to an event, so that the function gets called whenever the event fires on the object.

So it seems that until there is an update to the core way rad controls handle mouse clicks they will not work even on IE final.

Mike Hobbs
Top achievements
Rank 1
 answered on 25 May 2014
1 answer
153 views
Hi,

I am trying to programmatically (Server side) to filter a rad grid based on combo boxes and radio buttons and before the page loads for the user.

using VB.NET I am using this on LoadComplete (I know this is two different methods, but neither work to an extent).
Dim rowStateColumn As GridColumn = RadGrid1.MasterTableView.GetColumnSafe("Comp_ProjectCount")
 
        rowStateColumn.CurrentFilterFunction = GridKnownFunction.GreaterThan
        rowStateColumn.CurrentFilterValue = 0
 
        RadGrid1.MasterTableView.FilterExpression = "([Comp_ProjectCount] > 0 ')"
        RadGrid1.Rebind()


The first option puts in the value of 0 in that column but doesn't display the results filtered only the entire data source.
The second option just doesn't do anything from what I can tell. (I had to sent LINQ to False as it just errored out as I found out in a previous thread).

Any ideas why this doesn't work? Or how to get it to work please?

Thanks,
Alex
Alex
Top achievements
Rank 1
 answered on 24 May 2014
9 answers
614 views
I'm using a RadGrid with the theme Web20 and I'm having trouble changing the color for a specific cell in the RadGrid header. I noticed the header is using an image to create the gradient look, but I need to create the look of a spacer. I was able to accomplish this with the tree list, but I'm having issues doing this with the radgrid. See the pictures attached. 

I'm looking to do this in CSS on inline style or something that doesn't require a reference to System.Drawing in the VS project. Capture1.png below is the radgrid. Capture2.png is the treelist.

Thanks,

Derek
Logan Marshall
Top achievements
Rank 2
Iron
 answered on 24 May 2014
4 answers
256 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
349 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
278 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
168 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
106 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
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?