Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
112 views
So I have a grid that is pulling most of it's information from one context/one database (db1). But I have one column that is pulling it's information from another context/database (db2) based on one of the columns from db1. However, if I try to filter or sort on this column, nothing happens. I have exhausted my researching abilities and tried many fixes for this and none of them are working great. What, in your opinion, would be the best solve? 
Alyssa
Top achievements
Rank 1
 asked on 09 Apr 2018
2 answers
212 views
Hi

I have a GridColumnButton how would I print a pdf from its click event. Ideally I like to open the pdf print / preview window

Andy
JOSE LUIZ TORDINO
Top achievements
Rank 1
 answered on 09 Apr 2018
4 answers
251 views
I want open one pdf window on click of that Id.

How to open pdf in new window
JOSE LUIZ TORDINO
Top achievements
Rank 1
 answered on 09 Apr 2018
6 answers
659 views
Hello, 
I have a need to use filtering functionality for GridTemplateColumn which actually stored a datetime value. When I use the filter features, I get either of those 2 errors.

SCRIPT5022: Sys.WebForms.
PageRequestManagerServerErrorException: The string was not recognized as a valid DateTime. There is a unknown word starting at index 0. 

SCRIPT5022: Sys.WebForms.PageRequestManagerServerErrorException: String was not recognized as a valid DateTime. 

My MarkUp : 
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript" src="/JS/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="/JS/jquery-ui-1.9.2.custom.js"></script>
    <script type="text/javascript">
 
        function ShowColumnHeaderMenu(ev, columnName) {
            var grid = $find("<%=RadGrid1.ClientID %>");
            var columns = grid.get_masterTableView().get_columns();
 
            for (var i = 0; i < columns.length; i++) {
                if (columns[i].get_uniqueName() == columnName) {
                    columns[i].showHeaderMenu(ev, 75, 20);
                }
            }
        }
         
    </script>
</telerik:RadCodeBlock>
        <telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" AllowSorting="true"
            OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand"
            OnUpdateCommand="RadGrid1_UpdateCommand" OnNeedDataSource="RadGrid1_NeedDataSource"
            OnItemDataBound="RadGrid1_OnItemDataBound" Skin="Office2010Silver" EnableHeaderContextMenu="true"
            EnableHeaderContextFilterMenu="true">
            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
            <MasterTableView Width="100%" EditMode="InPlace" CommandItemDisplay="Bottom" DataKeyNames="ID, Status, Description"
                HorizontalAlign="NotSet" AutoGenerateColumns="False" NoMasterRecordsText="<%$Resources:Resources, NoItems%>"
                InsertItemDisplay="Bottom" EditItemStyle-VerticalAlign="Top"
                AllowFilteringByColumn="True" IsFilterItemExpanded="false">
                <CommandItemSettings AddNewRecordText="<%$Resources:Resources, NewItem%>"
                    ShowRefreshButton="false" />
                <Columns>
                    <telerik:GridBoundColumn DataField="ID" UniqueName="ID" Visible="false">
                    </telerik:GridBoundColumn>
                    <telerik:GridTemplateColumn DataField="DueDateTime" SortExpression="DueDateTime" UniqueName="DueDateTime"
                        ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left" GroupByExpression="DueDateTime Group By DueDateTime">
                        <HeaderTemplate>
                            <asp:LinkButton runat="server" CommandArgument="DueDateTime" CommandName="Sort"
                                Text="<%$Resources:Resources, Date%>"></asp:LinkButton>
                            <img src="/Images/funnel-icon.png" style="margin-top: 5px; margin-left: 5px;
                                cursor: pointer" onclick='ShowColumnHeaderMenu(event,"DueDateTime")'
                                alt="Filter" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:Label runat="server" ID="lblDate"></asp:Label>
                        </ItemTemplate>
                        <InsertItemTemplate>
                                <telerik:RadDateTimePicker ID="dtpDate" runat="server" Width="195">
                                    <Calendar ID="ddCalendar" runat="server" EnableKeyboardNavigation="true">
                                    </Calendar>
                                    <DateInput ID="ddDate" runat="server" DateFormat="dd/MM/yyyy hh:mm tt">
                                    </DateInput>
                                    <TimeView ID="TimeView1" runat="server" Interval="00:30:00">
                                    </TimeView>
                                </telerik:RadDateTimePicker>
                        </InsertItemTemplate>
                        <EditItemTemplate>
                                <telerik:RadDateTimePicker ID="dtpDate" runat="server"
                                    Width="195">
                                    <Calendar ID="ddCalendar" runat="server" EnableKeyboardNavigation="true">
                                    </Calendar>
                                    <DateInput ID="ddDate" runat="server" DateFormat="dd/MM/yyyy hh:mm tt">
                                    </DateInput>
                                    <TimeView runat="server" Interval="00:30:00">
                                    </TimeView>
                                </telerik:RadDateTimePicker>
                        </EditItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>

*Note : I also added this tag "DataType="System.DateTime" " though its not in the markup.
Fahad
Top achievements
Rank 1
 answered on 09 Apr 2018
2 answers
1.3K+ views
Hi,

I wonder if anyone can help, im currently getting an error to do with the Telerik Rad Script Manager Control.
The solution works fine on my local machine and on a staging server but it fails when it is integrated into the main site.

This error only seems to affect IE and Firefox and Chrome work fine.

The error i receive is:

  Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object.  Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-US%3a8ac4a3ed-a467-4f19-a8ed-9270f6e4c6d6%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2010.2.929.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-US%3a15a8cff0-9e51-4282-a100-c2dcd204ecf2%3a16e4e7cd%3aed16cbdc%3af7645509, line 6 character 62099



The error appears when you change user controls however if i refresh the page and keep the browser open the application then works without errors.

The application is .Net 3.5 and is using Telerik RadControls for ASP.NET AJAX Q2 2010

If anyone could help it would be much appreciated

Thanks

Tim
Scribe Genie
Top achievements
Rank 1
 answered on 09 Apr 2018
2 answers
932 views

I'm testing out the radgrid functionality and I'm trying to export data to excel. This works fine in having it export to an actual Excel spreadsheet instead of as an HTML file. The problem I'm running into is that I want one column to be a LinkButton. In testing, this would not show up when I exported to excel. I then read about calling "NeedsDataSource", which does show the column that has the linkbutton (shows it as text in the excel spreadsheet). The problem is, it only shows the current page (paging is on). But, if I remove the function, then I will get all pages, but no text in the buttonlink column. What I want it to do is:

1 - For the ID column, display a link to a separate page. This works ok, although I would rather have it open to a new window as opposed to a new tab.
2 - When exporting, display the text in for the column with the linkbutton, and display all pages.

I'm not sure how to proceed.

 

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="RadGridTest.aspx.vb" Inherits="Test.RadGridTest" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True" PageSize="25" ShowFooter="True" ShowStatusBar="True">
<GroupingSettings CollapseAllTooltip="Collapse all groups"></GroupingSettings>
<ExportSettings IgnorePaging="True">
<Excel FileExtension="xlsx" Format="Xlsx" />
</ExportSettings>
</telerik:RadGrid>
</div>
<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
</telerik:RadScriptManager>
<telerik:RadButton ID="RadButton1" runat="server" Skin="Default" Text="RadButton">
</telerik:RadButton>
</form>
</body>
</html>

 

Imports Telerik.Web.UI
Public Class RadGridTest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Bind()
End If
End Sub
Protected Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click
Dim alternateText As String = "Xlsx"
RadGrid1.ExportSettings.Excel.Format = DirectCast([Enum].Parse(GetType(GridExcelExportFormat), alternateText), GridExcelExportFormat)
RadGrid1.ExportSettings.IgnorePaging = True
RadGrid1.ExportSettings.ExportOnlyData = False
RadGrid1.ExportSettings.OpenInNewWindow = True
RadGrid1.MasterTableView.ExportToExcel()
End Sub
Private Sub RadGrid1_PreRender(sender As Object, e As EventArgs) Handles RadGrid1.PreRender
For Each item As GridDataItem In RadGrid1.MasterTableView.Items
Dim link As New HyperLink
link.Text = item("PrimaryKeyValue").Text
link.NavigateUrl = "http://www.google.com/" & item("PrimaryKeyValue").Text
link.Target = "_blank"
If True Then
item("PrimaryKeyValue").Controls.Add(link)
End If
Next
End Sub
Private Sub RadGrid1_SortCommand(sender As Object, e As GridSortCommandEventArgs) Handles RadGrid1.SortCommand
Bind()
End Sub
Private Sub Bind()
RadGrid1.DataSource = dbData.getDataTable("SELECT PrimaryKeyValue FROM _GridTest", SQLDataClass.GetConnection())
End Sub
Private Sub RadGrid1_PageIndexChanged(sender As Object, e As GridPageChangedEventArgs) Handles RadGrid1.PageIndexChanged
Bind()
End Sub
Private Sub RadGrid1_PageSizeChanged(sender As Object, e As GridPageSizeChangedEventArgs) Handles RadGrid1.PageSizeChanged
Bind()
End Sub
Private Sub RadGrid1_NeedDataSource(sender As Object, e As GridNeedDataSourceEventArgs) Handles RadGrid1.NeedDataSource
Bind()
' When Bind() is called in this event, then the export will not show the link button field, but will show all pages.
' When Bind() is not called, the export will show the link button field, but only for the current page.
End Sub
End Class

Eyup
Telerik team
 answered on 09 Apr 2018
2 answers
85 views

In the RadEditor, when the cursor is inside an HTML element (such as a div, h1, span, etc.), and you press the enter key, the containing HTML element is duplicated instead of using <p> elements as expected.

Steps to reproduce:

1. Open an editor and switch to HTML pane.
2. Enter the following HTML:
<div >hello telerik</div>
3. Click Accept.
4. Switch to the Design view.
5. Place the cursor between the two words, and press the Enter key.
6. Switch back to HTML view, and see the result.

Actual Result:

<div >hello</div>
<div >telerik</div>

Desired Result:

<div >
    <p>hello</p>
    <p>telerik</p>
</div>

It works fine if the text is not enclosed in a div. For example, if I start with just the text "hello telerik", and in design view I place the cursor between the two words, and press the Enter key, I get this:

    <p>hello</p>
    <p>telerik</p>

..which is what we want to happen.

Is there a fix for this behavior?

Thanks!

David
Top achievements
Rank 1
 answered on 07 Apr 2018
2 answers
271 views

Howdy all.  I've been banging my head on the wall trying to make this work and just need a bit of assistance.  So at a high level, I'm migrating several RadGrid from a server side databinding to a RadClientDataSource/ClientDataSourceID.  Everything is going great and I've replaced most of the functionality but have one area where I just can't seem to make it work right.

 

In the past, I would have a RadGrid and it would have an OnItemDataBound event that included something like:

 

((LinkButton)e.Item.FindControl("linkButton")).CommandArgument = DataBinder.Eval(e.Item.DataItem, "SomethingInData").ToString();

And then clicking on that LinkButton in the RadGrid would run the associated event on the LinkButton.  What I can't seem to figure out is how to set the CommandArgument when we are doing a clientSide Databind.

 

I'm assuming I will need to use ClientSettings-ClientEvents-OnDataBound event and some JavaScript to set the CommandArgument value but I can't seem to figure out how to do it.

 

Thanks,

Richard

 

Here is the full code.  I'm setting the Select URL from CodeBehind based on a few variables.

<telerik:RadClientDataSource ID="RadClientDataSource1" runat="server" AllowBatchOperations="true">
        <DataSource>
            <WebServiceDataSourceSettings>
                <Select DataType="JSON" />
            </WebServiceDataSourceSettings>
        </DataSource>
        <Schema>
            <Model ID="SipID">
                <telerik:ClientDataSourceModelField FieldName="UserPrincipalName" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="SamAccountName" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="LockoutTime" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="UnlockURL" DataType="String" />
            </Model>
        </Schema>
    </telerik:RadClientDataSource>
 
     
 
    <telerik:RadGrid ID="gridItems" OnItemDataBound="gridItems_ItemCreated" RenderMode="Lightweight" ClientDataSourceID="RadClientDataSource1"
        Width="100%" AutoGenerateColumns="false" AllowFilteringByColumn="False" Skin="Silk" PagerStyle-Position="TopAndBottom"
        AllowSorting="True" AllowMultiRowSelection="False" runat="server" Gridlines="None">
        <MasterTableView HeaderStyle-ForeColor="Black" Width="100%" DataKeyNames="SamAccountName" ClientDataKeyNames="SamAccountName" AllowFilteringByColumn="False">
            <Columns>
                <telerik:GridBoundColumn DataField="UserPrincipalName" HeaderText="User" HeaderStyle-BackColor="LightSteelBlue" />
                <telerik:GridBoundColumn DataField="UserPrincipalName" HeaderText="User" HeaderStyle-BackColor="LightSteelBlue" ItemStyle-Width="200" />
 
                <telerik:GridTemplateColumn InitializeTemplatesFirst="true" AllowFiltering="false" HeaderStyle-BackColor="LightSteelBlue" ItemStyle-Width="100">
                    <HeaderTemplate>Unlock</HeaderTemplate>
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="lnkUnlock" Text="Unlock" OnCommand="lnkUnlock_Command" />
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
        <PagerStyle Mode="NumericPages" />
        <GroupingSettings CaseSensitive="false" />
        <ClientSettings EnableRowHoverStyle="true">
            <ClientEvents />
        </ClientSettings>
    </telerik:RadGrid>

 

 

Richard
Top achievements
Rank 1
Veteran
 answered on 06 Apr 2018
1 answer
288 views

     I'd like to populate my menu from the sitemap, utilizing the SecurityTrimmingEnabled feature, and also add some additional menu nodes from a database.

 

Before I added the sitemap and SecurityTrimming I was doing this to dynamically add records to my Help menu.  Now it's not adding the child menus.

 

private void LoadHelpMenu()
        {
            List<HelpDocumentation> menuItems = new List<HelpDocumentation>();
            menuItems = BaseUserProcess.GetHelpMenuItems();

            if (menuItems != null)
            {
                RadMenuItem HelpMenu = radMenuNavigation.Items.Where(f => f.Text == "Help").FirstOrDefault();
                HelpMenu = LoadMenuNode(menuItems, HelpMenu);

                string version = typeof(WorkBench).Assembly.GetName().Version.ToString();
                RadMenuItem Appversion = new RadMenuItem("Version: " + version);
                HelpMenu.Items.Add(Appversion);
            }
            else
            {
                radMenuNavigation.Items.Where(f => f.Text == "Help").FirstOrDefault().Visible = false;
            }

        }

        private RadMenuItem LoadMenuNode(List<HelpDocumentation> menuItems, RadMenuItem node, int? ParentID = null)
        {
            List<HelpDocumentation> GroupingItems = new List<HelpDocumentation>();
            if (ParentID == null)
            {
                GroupingItems = menuItems.Where(F => F.ParentID.HasValue == false).ToList();
            }
            else
            {
                GroupingItems = menuItems.Where(F => F.ParentID == ParentID).ToList();
            }

            foreach (var item in GroupingItems.OrderBy(F => F.DisplayDescription).ToList())
            {
                RadMenuItem i = new RadMenuItem(item.DisplayDescription);
                if (!string.IsNullOrEmpty(item.Link))
                    i.NavigateUrl = item.Link;
                if (!string.IsNullOrEmpty(item.Target))
                    i.Target = item.Target;
                if (menuItems.Any(F => F.ParentID == item.ID))
                    i = LoadMenuNode(menuItems, i, item.ID);
                node.Items.Add(i);
            }
            return node;
        }

Marin Bratanov
Telerik team
 answered on 06 Apr 2018
1 answer
77 views

I have the Gantt in a RadWizard and it doesnt seem to render correctly. I set the bound column widths and it doesnt care, i set the ListWidth and it doesnt care. It is putting an extra column in the List - looks like a complete column, but as you can see its not even in my Column definitions and autogenerate is false.

See the attached screen shots. One is when i put it INSIDE the Wizard, another is when i have it OUTSIDE the wizard container.

You need to address this.

 

 

<telerik:RadGantt RenderMode="Auto" runat="server" ID="RadGanttTasks" DataSourceID="SqlDataSource1" DependenciesDataSourceID="SqlDataSource2" Height="800px"
                                                        SelectedView="MonthView" AutoGenerateColumns="false" AllowColumnResize="true" DisplayDeleteConfirmation="true" EnablePdfExport="true" SnapToGrid="true"
                                                         Width="600px" ListWidth="300px" >
 
                                                        <Localization />
 
                                                        <YearView SlotWidth="250px" />
                                                        <MonthView SlotWidth="250px" />
                                                        <WeekView SlotWidth="250px" />
                                                        <DayView SlotWidth="250px" />
 
                                                        <Columns>
                                                            <telerik:GanttBoundColumn UniqueName="Subject" DataField="Title" AllowEdit="true" Width="125px" AllowSorting="false" HeaderText="Task" DataType="String" />
                                                            <telerik:GanttBoundColumn UniqueName="StartDate" DataField="Start" AllowEdit="true" Width="105px" AllowSorting="false" HeaderText="Start Date" DataType="DateTime" DataFormatString="MM/dd/yyyy hh:mm tt" />
                                                            <telerik:GanttBoundColumn UniqueName="EndDate" DataField="End" AllowEdit="true" Width="105px" AllowSorting="false" HeaderText="End Date" DataType="DateTime" DataFormatString="MM/dd/yyyy hh:mm tt" />
                                                        </Columns>
 
                                                        <DataBindings>
                                                            <TasksDataBindings
                                                                IdField="TaskProjectDetailTemplateId" ParentIdField="TaskProjectDetailTemplateIdParent"
                                                                StartField="Start" EndField="End"
                                                                OrderIdField="TaskLevel" ExpandedField="Expanded" PercentCompleteField="PercentComplete"
                                                                TitleField="Title" SummaryField="Summary" />
                                                            <DependenciesDataBindings
                                                                TypeField="Type" IdField="TaskProjectDetailTemplateDependId"
                                                                PredecessorIdField="PredecessorID"
                                                                SuccessorIdField="SuccessorID" />
                                                        </DataBindings>
 
                                                    </telerik:RadGantt>

 

SDI
Top achievements
Rank 1
 answered on 06 Apr 2018
Narrow your results
Selected tags
Tags
+? more
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?