<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>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

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!
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>
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;
}
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>