Telerik Forums
UI for ASP.NET AJAX Forum
7 answers
134 views
We have a RadGrid that contains columns and a NestedViewTemplate which contains a user control that only has a RadGrid.  The export functionality has been working fine since Jan 2010, but ever since updating to Q1 2011 we receive an Object Reference error each time we try to export.  The stack trace shows that "Telerik.Web.UI.GridTableView.PrepareExport()" is the function throwing the error.  All other RadGrid export functions work fine, but they do not contain a NestedViewTemplate that contains another RadGrid.

The only way that the export will work is if I set IgnorePaging to false, but then all data that is on the other pages do not get exported to the excel.  So basically anytime the IgnorePaging is not false, you get the object reference error.  Also, if I remove the user control and just leave the empty NestedViewTemplate elements, the export works all the time.  Only when the user control (which just contains a RadGrid) is within a NestedViewTemplate do I get the object reference error.

The user control within the nestedviewtemplate is always set to visible = false, however, when you export, the radgrid within the user control, which is always visible = false, has its OnNeedDataSource event fired and after this is when you get the object reference error.  Below is the call stack

Using 2010 Q3 Telerik assembly, this problem does not exists and the RadGrid within the user control that exists in the NestedViewTemplate does not have the OnNeedDataSource event fired when exporting.

[NullReferenceException: Object reference not set to an instance of an object.]
   Telerik.Web.UI.GridTableView.PrepareExport() +72
   Telerik.Web.UI.Grid.Export.TableViewExporter.PrepareForExportInternal(GridTableView tableView, Boolean ignorePaging, Boolean dataOnly) +373
   Telerik.Web.UI.GridTableView.ClearTableViewControls(Control control, TableViewExporter exporter, GridTableView ownerTable) +597
   Telerik.Web.UI.Grid.Export.TableViewExporter.PrepareForExportInternal(GridTableView tableView, Boolean ignorePaging, Boolean dataOnly) +670
   Telerik.Web.UI.Grid.Export.TableViewExporter.PrepareForExport() +59
   Telerik.Web.UI.Grid.Export.TableViewExporter.page_PreRender(Object sender, EventArgs e) +34
   System.EventHandler.Invoke(Object sender, EventArgs e) +0
   System.Web.UI.Control.OnPreRender(EventArgs e) +8695510
   System.Web.UI.Control.PreRenderRecursiveInternal() +80
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842


<

 

 

telerik:RadGrid ID="RadGridCustomers" runat="server" Width="100%" AllowSorting="true" SkinID="ExpandCollapse"

 

 

 

AllowPaging="true" OnItemDataBound="RadGridCustomers_ItemDataBound" PageSize="20"

 

 

 

OnItemCommand="RadGridCustomers_ItemCommand" OnNeedDataSource="RadGridCustomers_NeedDataSource">

 

 

 

<ExportSettings FileName="RelationshipList" />

 

 

 

<ClientSettings>

 

 

 

<Resizing AllowColumnResize="true" />

 

 

 

</ClientSettings>

 

 

 

<PagerStyle Mode="NextPrevAndNumeric" />

 

 

 

<MasterTableView DataKeyNames="CcnNumber" Name="CcnList">

 

 

 

 

<NestedViewTemplate>

 

 

 

<tcb:ViewCustomers ID="ViewCustomersByCcn" runat="server" Visible="false" />

 

 

 

</NestedViewTemplate>

 

 

 

<Columns>

 

 

 

<telerik:GridTemplateColumn HeaderText="Relationship Name" DataField="CcnName"

 

 

 

SortExpression="CcnName" HeaderStyle-Width="140px">

 

 

 

<ItemTemplate>

 

 

 

<asp:HyperLink ID="HyperLinkCcnAccountList" runat="server" Target="_blank"

 

 

 

NavigateUrl="#" ToolTip="View Accounts" />

 

 

 

</ItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 


Thanks.
Mira
Telerik team
 answered on 13 Jun 2011
3 answers
218 views

When I programmatically add a grid in the Page Init event, I understand how I can create the paging and it works.

However if the grid is not created in the Page Init, but in the Ribbon Buttonclicked event the paging command on the grid is not working. How should I enable this.

Private Sub ribbon_ButtonClick(sender As Object, e As Telerik.Web.UI.RibbonBarButtonClickEventArgs) Handles ribbon.ButtonClick
Dim radGrid = New RadGrid() With {
.AllowCustomPaging = True,
.AllowFilteringByColumn = True,
.AllowPaging = True,
.AllowSorting = True,
.AutoGenerateColumns = True,
.ID = "myGrid",
.PageSize = 4,
.ShowGroupPanel = True,
.ShowStatusBar = True,
.VirtualItemCount = 20,
.Width = Unit.Percentage(95)
}
AddHandler radGrid.NeedDataSource, Sub(_sender As Object, _e As GridNeedDataSourceEventArgs) RefreshData(CType(_sender, RadGrid))
AddHandler radGrid.PageIndexChanged, Sub(_sender As Object, _e As GridPageChangedEventArgs) RefreshData(CType(_sender, RadGrid))
AddHandler radGrid.PageSizeChanged, Sub(_sender As Object, _e As GridPageSizeChangedEventArgs) RefreshData(CType(_sender, RadGrid))
phGrid.Controls.Add(radGrid)
RadAjaxManager.AjaxSettings.AddAjaxSetting(radGrid, radGrid)
End Sub
Private Sub RefreshData(grid As RadGrid)
grid.DataSource = New List(Of String)({grid.CurrentPageIndex, grid.PageSize})
End Sub
Iana Tsolova
Telerik team
 answered on 13 Jun 2011
2 answers
77 views
Hi,

I have 2 FilterEditors with the same FieldName, but when selecting the 2nd item, it displays the first.

<FieldEditors>
    <custom:CustomDropdown DisplayName="Priority" FieldName="post_priority" DataTextField="Display" DataValueField="Value" />
    <custom:CustomDate DisplayName="Date" FieldName="post_time" DataType="System.DateTime" />
    <telerik:RadFilterDateFieldEditor DisplayName="Post Date" FieldName="post_time" DataType="System.DateTime" />
</FieldEditors>

Can this be done?

Take Care
Mira
Telerik team
 answered on 13 Jun 2011
3 answers
392 views
As the title says, is this possible?

I would like to have a two- or three column based layout exported to pdf, instead of the gridview look which is one item per row.

Daniel
Telerik team
 answered on 13 Jun 2011
1 answer
41 views
I'm using a RadGrid to display a list of invoices. The Invoices can be in multiple currencies (dollars, pounds, euros, etc.) and I'd like to have each row use a different culture for currency display. I have the currency culture in a seperate database field, so I'd like to use that to determine the currency type.

Is there a way to do this? (Other than format it in SQL, which I can do, but would prefer not to)
Pavel
Telerik team
 answered on 13 Jun 2011
7 answers
231 views
I have RadWindow, inside page with RadTabStrip/RadMultiPage, each RadPageView have RadSplitter with Width/Height=100%. RadSplitter usualy have 2 horizontal panels, up for main content (grid or test boxes) and bottom is height=40 for buttons like Save/Cancel. When I open RadWindow, RadSplitter fills entire space and controls iniside fills pane and everything is ok.


When I resize RadWindow at same time is RadSplitter resized to fill space and that is ok but only in active RadPageView. Other  RadSplitters in other RadPageViews is frozen to initial size and it looks ugly and the useless.
How to persuade all RadSplitters in all RadPageViews to resize and fill Width/Height=100% when I resize RadWindow?


It can be done by some client function on RadTabStrip.OnClientTabSelected but what to do with RadPageViews without tabs? 
I have some RadPageViews that are accessed by code behind (not by tabs) and there is no RadMultiPage.OnClientSelected event. 
Niko
Telerik team
 answered on 13 Jun 2011
1 answer
50 views
Hi guys, I've been pouring over the demos looking for a solution to a scenario i'm facing, and I'm starting to get a little bug-eyed so I thought I would throw it out there...

I have a radgrid with rows that contain a location, a quantity, and a dollar amount like this:

  • location X, qty 1, amount $1
  • location X, qty 2, amount $1.33
  • location Y, qty 1, amount $1.01
  • location Y, qty 2, amount $1.17
  • etc

I have a radwindow pop-up that 'sits on top' of this radgrid (actually a separate aspx). The popup allows them to enter a value that will be used to adjust the amount for all rows matching a given quantity. So if I pick qty 1 and adjust by .1 (up), i want to programmatically and automatically update the data for the matching rows in the grid. regardless of the value of location. In this case the data would look like this after the update:

  • location X, qty 1, amount $1.1 (updated +.1)
  • location X, qty 2, amount $1.33
  • location Y, qty 1, amount $1.11 (updated +.1)
  • location Y, qty 2, amount $1.17

I have the radwindow passing back the necessary values and I'm trying to plug through the JavaScript necessary to programmatically  1) loop through and find the rows with the matching quantity (it's a key field), 2) edit them with a new amount, 3) post the update.Sort of an automatic batch update.

Is there a demo on this scenario out there? I'm sure I'm missing it.

Thanks!

  • location X, qty 1, amount $1
  • location X, qty 2, amount $1.33
  • location Y, qty 1, amount $1.01
  • location Y, qty 2, amount $1.17
  • etc
  • location X, qty 1, amount $1
  • location X, qty 2, amount $1.33
  • location Y, qty 1, amount $1.01
  • location Y, qty 2, amount $1.17
  • etc
  • Marin
    Telerik team
     answered on 13 Jun 2011
    1 answer
    129 views
    Hi All,

    I have one functionality where in RadGrid when user clicks on row i am redirecting to another page. I have updated radgrid, before updating i can found ItemType by row.Itemtype property where as after updating i can't getting RowType. Can any one please help in this.

    I did like below but no use

    function RowSelected(sender, eventArgs)
    {
    if (($get(eventArgs.get_id()).ItemType == "Item") ||
    ($get(eventArgs.get_id()).ItemType == "AlternatingItem")) {
    var rowTable = $get(eventArgs.get_id()).Owner;
    var myIdCell = rowTable.GetCellByColumnUniqueName($get(eventArgs.get_id()), "ID");

    I have searched in below link but i did not find suitable solution for me

    http://demos.telerik.com/aspnet-ajax/grid/examples/client/clientsideevents/defaultcs.aspx

    Thanks in advance.

    Thanks,
    Sai Charan.M
    Iana Tsolova
    Telerik team
     answered on 13 Jun 2011
    5 answers
    230 views
    Hello,

    I saw my problem has already been explained in others threads, but I can't resolve it.

    Here it is:

    Server side:
    - I use a datasource to populate my listbox, and I select an item

    Client side:
    - I want to scroll to my selected item with te code below:

    <

     

    body >

     

     

    <form id="form1" runat="server">  

     

    <asp:ScriptManager ID="ScriptManager1" runat="server">

     

    </asp:ScriptManager>

     

     

    <script type="text/javascript"> 

     

    function 

     

    scrollToSelected(sender, args)
    {

     

     

            var item = sender.get_selectedItem();  

     

            if (item)

            {  

     

                item.ensureVisible(); 

     

                sender.clearSelection();  

     

            }  

     

    }

     

    </script 

     

    <div>...

     

    and in my listbox definition I add

     

     

    OnClientLoad

     

    ="scrollToSelected"

     

     

    This works only when I refresh my page, but it doesn't work the first time. I tried with OnSelectedIndexChanged, but it doesn't work anymore.

    Coul do help me please?
    Best regards,

    André

    Helen
    Telerik team
     answered on 13 Jun 2011
    1 answer
    104 views
    I would like to create a hierarchical Grid that has a parent row and then 1-n child rows.
    The parent row would be indexed by a unique datetime. Then containing many rows of data that would make up the
    parent rows many attributes.

    Example

    Automobile          1/1/2009
                    Color              red
                    Engine            V8
                    Horse Power  225

    Automobile          2/1/2009
                    Color              Green
                    Engine            V6
                    Horse Power  200

    My question is if I had created the parent row and the children rows is there a way to select the parent and then copy/duplicate/clone
    all of the rows that makeup the parent and children and then allow the user to set the new date for the copied parent row. 
    Veli
    Telerik team
     answered on 13 Jun 2011
    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
    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
    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?