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
>
Hi, I have a problem with the GridCheckBoxColumn column filters.
This is my code.
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
telerik:RadStyleSheetManager
ID
=
"RadStyleSheetManager1"
runat
=
"server"
/>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
CellSpacing
=
"0"
Culture
=
"it-IT"
GridLines
=
"None"
DataKeyNames
=
"ID"
DataSourceID
=
"SqlDataSource1"
AutoGenerateColumns
=
"false"
Width
=
"100%"
AllowSorting
=
"true"
AllowPaging
=
"true"
AllowFilteringByColumn
=
"true"
GroupingSettings-CaseSensitive
=
"false"
EnableLinqExpressions
=
"false"
Skin
=
"Bootstrap"
>
<
MasterTableView
DataKeyNames
=
"ID"
DataSourceID
=
"SqlDataSource1"
>
<
Columns
>
<
telerik:GridBoundColumn
SortExpression
=
"Nome"
HeaderText
=
"Nome"
DataField
=
"Nome"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"Contains"
>
</
telerik:GridBoundColumn
>
<
telerik:GridCheckBoxColumn
SortExpression
=
"Test 1"
HeaderText
=
"Test 1"
DataField
=
"Test 1"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridCheckBoxColumn
SortExpression
=
"Test 2"
HeaderText
=
"Test 2"
DataField
=
"Test 2"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridCheckBoxColumn
SortExpression
=
"Test 3"
HeaderText
=
"Test 3"
DataField
=
"Test 3"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
</
telerik:GridCheckBoxColumn
>
<
telerik:GridCheckBoxColumn
SortExpression
=
"Test 4"
HeaderText
=
"Test 4"
DataField
=
"Test 4"
ShowFilterIcon
=
"false"
AutoPostBackOnFilter
=
"true"
CurrentFilterFunction
=
"EqualTo"
>
</
telerik:GridCheckBoxColumn
>
</
Columns
>
<
SortExpressions
>
<
telerik:GridSortExpression
FieldName
=
"Nome"
SortOrder
=
"Ascending"
/>
</
SortExpressions
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ProviderName
=
"System.Data.SqlClient"
ConnectionString="<%$ ConnectionStrings:StrConnection %>" SelectCommand="SELECT Nome, [Test 1], [Test 2], [Test 3], [Test 4], [ID] FROM vista_r WHERE [ID R] = 1" >
</
asp:SqlDataSource
>
Filters only start working after I click on the 4 GridCheckBoxColumn filters.
Here a sample video
How can I solve?
Thank you.
Hello Telerik Team,
I've noticed that the automatic height resizing doesn't apply to the editor immediately after a hard refresh, but as soon as any modifications are made to the editor, it will resize to the appropriate size. I was wondering if there was any way to force the editor to resize itself immediately when the page loads? This feature works fine under most circumstances, even after a regular refresh.
This can be re-created on the Automatic Height Resize demo, by simply performing a hard refresh and observing the results.
Thanks in advance,
Aidan Harris
I have Bootstrap 3 dropdowns (like these http://getbootstrap.com/docs/3.3/javascript/#dropdowns ) on my page and multiple buttons that open RadWindows. My trouble is that the RadWindows always put themselves overtop of the dropdowns, even if I give the dropdowns a super high z-index.
I can set all my dropdown menus to be "z-index: 9999999;" and no matter what, the RadWindows always position themselves above. I can manually force each ".RadWindow" class to use "z-index: 100 !important;" but that breaks the ability to have one RadWindow gain z-index advantage over competing RadWindows when clicked/focused. There doesn't seem to be a good way to make these two things work. I've also tried to capture the Bootstrap dropdown's "shown" event to adjust its z-index to always be higher than any RadWindows that might be obstructing it, but that didn't help either.
How can I make these two things play together nicely if giving the dropdowns a high z-index isn't working? I want my dropdown-menu's to always have the highest priority possible when displaying one because in my website they're more important than whats in the windows, and its very frustrating to have to move RadWindows out of the way to be able to see the contents of a dropdown.
I have a radgrid with a parent table and single detail table. The ItemCommand event works properly for the "Page" and "ChangePageSize" commands coming from the parent grid. It also works properly for the "Page" command from the detail grid. However, when changing the page size of the detail grid, the ItemCommand event does not get fired. The postback occurs and the new page size gets applied properly to the detail table of the grid. But the ItemCommand event does never fires. Since it works for the page change event, I don't think this is a configuration issue.
I'm using version 2018.1.117.45