I created a RadGrid with <telerik:GridTemplateColumn and <telerik:GridBoundColumn if i am using gridbound column itis working ,but using gridTemplatecolumn it isnot working that also not all the options some of the options only
Hello, I'm doing a system using UploadAsync and RadTilesList where images loaded the Upload will be generated in Tiles to be able to track which images the User uploaded, but I am facing a problem, I'm not managing to catch the Tiles after they are generated, the GetAllTiles is coming empty and visual images are there, another question is how to add the new images within the same group of Tiles? The following is a piece of code. Thank you
<telerik:RadTileList runat="server" ID="RadTileList1" Width="634px" TileRows="1" EnableDragAndDrop="true" CssClass="CustomSizeTiles"
ScrollingMode="Auto" AutoPostBack="false" RenderMode="Mobile" >
</telerik:RadTileList>
Private Sub GeraTileBtn_Click(sender As Object, e As System.EventArgs) Handles GeraTileBtn.Click
Dim Idx As Integer = 0
Dim Fator As Double
Dim Largura As Short
Dim Altura As Short
Dim g As System.Drawing.Image
Dim tileGroup As New TileGroup
'If RadTileList1.Groups.Count = 0 Then
RadTileList1.Groups.Add(tileGroup)
'End If
'ImageTile
Dim dirs As String() = Directory.GetFiles(Server.MapPath("~\" & Session("cache" & HiddenID.Value.ToString)) & "\Upload", "*.JPG")
Dim dir As String
For Each dir In dirs
g = System.Drawing.Image.FromFile(dir)
' Calcula o melhor fator
Fator = 100 / g.Height
Largura = Int(g.Width * Fator)
Altura = Int(g.Height * Fator)
If Largura > 100 Then
Fator = 100 / Largura
Largura = Int(Largura * Fator)
Altura = Int(Altura * Fator)
End If
g.GetThumbnailImage(Largura, Altura, Nothing, Nothing).Save(dir & "_Thumbs.JPG", System.Drawing.Imaging.ImageFormat.Jpeg)
'RadTileList1.Groups(0).Tiles
Dim ImageTile As New RadImageTile
ImageTile.ImageUrl = "~\cache\" & dir.Substring(Server.MapPath("").Length) & "_Thumbs.JPG"
'ImageTile.Title.Text = "Docpro"
ImageTile.Shape = TileShape.Square
tileGroup.Tiles.Add(ImageTile)
Idx += 1
Next
End Sub
Protected Sub CopiaImgBtn_Click(sender As Object, e As EventArgs) Handles CopiaImgBtn.Click
Count += 1
For Each Group As TileGroup In RadTileList1.Groups
For Each tile As RadBaseTile In Group.GetAllTiles()
'Code image imports
Next
Next
' For i = 0 To RadTileList1.Groups(0).Tiles.Count
' ImportaImagens(DirectCast(e.File.InputStream, System.IO.FileStream).Name, 0)
' Next
End Sub
I want to be able to intercept the insert action for a RadGrid and display a window allowing the user to select criteria which will then be carried over into the true editing control to pre-populate some of the data. I know that I can pre-populate controls in the ItemCommand event with hard-coded values by checking for InitInsertCommandName and locating the controls to populate.
Can I at this point open a radwindow containing the below and page. This window will allow the user to select from the 2 dropdowns & the textbox and on clicking the 'Select' button populate the grid with matching data from a database. On double clicking a row of data, that data will be sent back to the ItemCommand to populate the edit control.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ItemSelection.aspx.cs" Inherits="MaxOrdersTab.Dialogs.ItemSelection" %>
<!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"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
OnAjaxRequest
=
"RadAjaxManager1_AjaxRequest"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadAjaxManager1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"gridLoadingPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"gridLoadingPanel"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
>
<
asp:Label
ID
=
"Label1"
runat
=
"server"
AssociatedControlID
=
"ddlProviders"
>Product Provider: </
asp:Label
>
<
telerik:RadDropDownList
ID
=
"ddlProviders"
runat
=
"server"
Width
=
"200px"
CssClass
=
"DropDown_Providers"
>
</
telerik:RadDropDownList
>
<
asp:Label
ID
=
"Label2"
runat
=
"server"
AssociatedControlID
=
"ddlGroups"
> Product Group: </
asp:Label
>
<
telerik:RadDropDownList
ID
=
"ddlGroups"
runat
=
"server"
>
</
telerik:RadDropDownList
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
AssociatedControlID
=
"tbxDescription"
> Product Description: </
asp:Label
>
<
telerik:RadTextBox
ID
=
"tbxDescription"
runat
=
"server"
>
</
telerik:RadTextBox
>
<
telerik:RadButton
ID
=
"RadButton1"
runat
=
"server"
Text
=
"Select"
onclick
=
"RadButton1_Click"
>
</
telerik:RadButton
>
<
br
/>
<
br
/>
<
telerik:RadAjaxLoadingPanel
ID
=
"gridLoadingPanel"
runat
=
"server"
Skin
=
"Default"
Width
=
"100%"
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
OnItemCreated
=
"RadGrid1_ItemCreated"
AllowPaging
=
"True"
Width
=
"99%"
AutoGenerateColumns
=
"False"
IsExporting
=
"False"
PageSize
=
"15"
ShowHeader
=
"False"
GroupPanelPosition
=
"Top"
>
<
MasterTableView
ClientDataKeyNames
=
"SelectionID"
Width
=
"100%"
CommandItemDisplay
=
"None"
PageSize
=
"5"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Product_Provider"
HeaderText
=
"Product Provider"
ReadOnly
=
"true"
SortExpression
=
"Product_Provider"
UniqueName
=
"Product_Provider"
AllowSorting
=
"False"
Exportable
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Provider column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Group"
HeaderText
=
"Product Group"
ReadOnly
=
"true"
SortExpression
=
"Product_Group"
UniqueName
=
"Product_Group"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Group column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Code"
HeaderText
=
"Product Code"
ReadOnly
=
"True"
SortExpression
=
"Product_Code"
UniqueName
=
"Product_Code"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
FilterControlAltText
=
"Filter Product_Code column"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"20%"
Wrap
=
"False"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Product_Description"
HeaderText
=
"Product Description"
ReadOnly
=
"true"
SortExpression
=
"Product_Description"
UniqueName
=
"Product_Description"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
>
<
HeaderStyle
Font-Bold
=
"True"
/>
<
ItemStyle
Width
=
"40%"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Unit_Sell"
HeaderText
=
"Unit Sell"
SortExpression
=
"Unit_Sell"
UniqueName
=
"Unit_Sell"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Unit_Cost"
HeaderText
=
"Unit Cost"
SortExpression
=
"Unit_Cost"
UniqueName
=
"Unit_Cost"
AllowFiltering
=
"False"
AllowSorting
=
"False"
Groupable
=
"False"
Reorderable
=
"False"
Resizable
=
"False"
ShowSortIcon
=
"False"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
GroupingSettings
CollapseAllTooltip
=
"Collapse all groups"
MainTableCaption
=
"Line Item Selection"
/>
<
ExportSettings
>
<
Pdf
AllowPrinting
=
"False"
>
</
Pdf
>
<
Csv
EncloseDataWithQuotes
=
"False"
/>
</
ExportSettings
>
<
ValidationSettings
EnableModelValidation
=
"False"
EnableValidation
=
"False"
/>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
></
Selecting
>
<
ClientEvents
OnRowDblClick
=
"RadGrid1_RowDblClick"
></
ClientEvents
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
telerik:RadAjaxLoadingPanel
>
</
div
>
</
form
>
</
body
>
</
html
>
protected
void
RadGrid1_ItemCommand(
object
source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridEditableItem insertedItem;
String MyUserControlId;
UserControl MyUserControl;
switch
(e.CommandName)
{
case
RadGrid.InitInsertCommandName:
e.Canceled =
true
;
// display the RadWindow here to request the data to pre-populate the edit control.
e.Item.OwnerTableView.InsertItem();
insertedItem = e.Item.OwnerTableView.GetInsertItem();
MyUserControlId = GridEditFormItem.EditFormUserControlID;
MyUserControl = insertedItem.FindControl(MyUserControlId)
as
UserControl;
RadNumericTextBox box;
box = MyUserControl.FindControl(
"ntbUnitCost"
)
as
RadNumericTextBox;
box.Value =
// Value1 returned from selection dialog
box = MyUserControl.FindControl(
"ntbUnitSell"
)
as
RadNumericTextBox;
box.Value =
// Value2 returned from selection dialog
box = MyUserControl.FindControl(
"ntbQty"
)
as
RadNumericTextBox;
box.Focus();
break
;
default
:
break
;
}
}
This is the basic page set-up I have:
The RadTreeView is configured in code-behind to trigger the RadAjaxPanel.
Now, when the RadAjaxPanel loads the RadGrid, it doesn't call Sys.Application.on_init(RadGrid), so the RadGrid is no more a member of Sys.Application._components and $find(RadGrid) returns null when called from the RadAjaxManager's OnResponseEnd callback.
What do I need to do for having $find(RadGrid) find the RadGrid in the OnResponseEnd callback?
The RadGrid control assigns the "grid" role to a <div> surrounding the <table> containing the grid data (see screenshots attached).
I believe this is an unfortunate assignment as it seems to confuse JAWS because the <table> HTML element by definition comes with an intrinsic role of "grid". So Jaws recognizes two nested grids when focusing the table using the JAWS virtual cursor "T" key (see screenshots attached).
I suggest to assign the "grid" role to the RadGrid's master table and all other tables - or to omit all the "grid", "row" "gridcell" etc. roles, as the table model automatically comes with these roles.
Specifically for images in the copy buffer. Things like CKEditor have built-in support for handling pasted images, so I know the browsers can support it. Is this possible with any of the Telerik controls?
Thanks!
I created a RadGrid with <telerik:GridTemplateColumn and <telerik:GridBoundColumn if i am using gridbound column itis working ,but using gridTemplatecolumn it isnot working that also not all the options some of the options only |
<telerik:RadGrid ID="RadGrid1" runat="server" ShowStatusBar="false" AutoGenerateColumns="False"
Width="100%" PageSize="50" AllowSorting="True" AllowMultiRowSelection="true"
AllowPaging="True" AllowFilteringByColumn="true" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
OnPreRender="RadGrid1_PreRender" OnNeedDataSource="RadGrid1_NeedDataSource" GridLines="None"
OnItemCommand="RadGrid1_ItemCommand" OnDataBound="RadGrid1_DataBound" OnItemDataBound="RadGrid1_ItemDataBound"
OnExcelExportCellFormatting="RadGrid1_ExcelExportCellFormatting" OnInit="RadGrid1_Init"
Skin="Myskin" OnItemCreated="RadGrid1_ItemCreated" ItemStyle-BackColor="White"
AlternatingItemStyle-BackColor="White" EnableEmbeddedSkins="false" ViewStateMode="Enabled"
OnPageIndexChanged="RadGrid1_PageIndexChanged" Font-Size="11px" OnGridExporting="RadGrid1_GridExporting">
<%
-- <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" PageSizeLabelText="Results per page"
ShowPagerText="true" HorizontalAlign="Left" PagerTextFormat=""></PagerStyle>--
%>
<PagerStyle Mode="NextPrevAndNumeric" AlwaysVisible="true" PageSizeLabelText="Results per page"
Position="TopAndBottom" ShowPagerText="true" HorizontalAlign="Left"></PagerStyle>
<ExportSettings HideStructureColumns="true" />
<ClientSettings EnableRowHoverStyle="false">
<%
--<Scrolling AllowScroll="True" UseStaticHeaders="true" SaveScrollPosition="true">
</Scrolling>--
%>
<Selecting AllowRowSelect="false" />
<%
--<ClientEvents OnGridCreated="gridCreated" />--%>
</ClientSettings>
<SortingSettings EnableSkinSortStyles="false" />
<SelectedItemStyle CssClass="SelectedItem" />
<MasterTableView DataKeyNames="CredentialID,CredentialVersion" AllowMultiColumnSorting="false"
CommandItemDisplay="None" EnableNoRecordsTemplate="false" HierarchyDefaultExpanded="false"
TableLayout="Fixed" HierarchyLoadMode="ServerBind" ItemStyle-BackColor="LightGoldenrodYellow"
AlternatingItemStyle-BackColor="LightGoldenrodYellow" Name="MasterGrid" AllowFilteringByColumn="true">
<CommandItemSettings ShowExportToWordButton="false" ShowExportToExcelButton="false"
ShowExportToCsvButton="false" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
<NoRecordsTemplate>
No Master Records Found
</NoRecordsTemplate>
<ExpandCollapseColumn HeaderStyle-Width="20px">
</ExpandCollapseColumn>
<DetailTables>
<telerik:GridTableView DataKeyNames="CredentialID,CredentialVersion" Name="Orders"
EnableNoRecordsTemplate="false" AllowPaging="false" AllowFilteringByColumn="false"
TableLayout="Fixed" AllowSorting="false" ShowHeader="false" ItemStyle-BackColor="#F0F8FF"
AlternatingItemStyle-BackColor="#F0F8FF" Width="1070px">
<NoRecordsTemplate>
<asp:Label Text="No Records Found in Credential Version (Other)" CssClass="panelStyle1"
runat="server" ID="lblChildNoRecord" ForeColor="Pink" Font-Bold="true"></asp:Label>
</NoRecordsTemplate>
<Columns>
<telerik:GridTemplateColumn UniqueName="Checkbox" Display="true" AllowFiltering="true">
<HeaderStyle Width="27px" />
<HeaderTemplate>
<asp:CheckBox ID="headerChildChkbox" runat="server" AutoPostBack="true" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkChildChild" runat="server" AutoPostBack="false" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn SortExpression="CredentialID" HeaderText="Credential id"
Visible="false" HeaderButtonType="TextButton" DataField="CredentialID" UniqueName="CredentialID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn SortExpression="ClientName" HeaderText="Client name" HeaderButtonType="TextButton"
DataField="ClientName" Visible="false" UniqueName="CName">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn SortExpression="ClientName" UniqueName="ClientNameChild"
HeaderText="Client name" Visible="true">
<ItemTemplate>
<asp:HyperLink ID="LinkChild" runat="server" Text='<%#Bind("CredentialID") %>' Visible="false"></asp:HyperLink>
<asp:LinkButton runat="server" ID="hypidchild" Text='<%#Bind("ClientName") %>' Font-Bold="true"
OnClick="hypidchild_Click" ForeColor="Black"></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="204px" />
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="ProjectName" HeaderText="Project name" Visible="false"
HeaderButtonType="TextButton" DataField="ProjectName" AllowFiltering="true">
<HeaderStyle Width="10%" />
<ItemStyle Width="10%" />
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="CredentialVersionChild" HeaderText="Credential version"
Visible="true" HeaderButtonType="TextButton" DataField="CredentialVersionOther"
AllowFiltering="true">
<HeaderStyle Width="120px" />
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="MatterDescription"
DataField="MatterDescription" AllowFiltering="false">
<HeaderStyle Width="719px" />
<ItemTemplate>
<asp:Label ID="lblMatterDescription" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="ConfidentialYes"
DataField="MatterDescription" AllowFiltering="false" Visible="false">
<ItemTemplate>
<asp:Label ID="lblConfidentialYes" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="ConfidentialNo"
DataField="MatterDescription" AllowFiltering="false" Visible="false">
<ItemTemplate>
<asp:Label ID="lblConfidentialNo" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn UniqueName="ClientSector" DataField="ClientSector"
HeaderText="Client sector"Visible="false" SortExpression="ClientSector" AllowFiltering="true">
<ItemTemplate>
<asp:Label runat="server" ID="lblClientSector" Text='<%#Bind("ClientSector")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypClientSectormore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTClientSector" runat="server" TargetControlID="hypClientSectormore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="MatterSector" UniqueName="MatterSector"
HeaderText="Matter sector" DataField="MatterSector" Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblMatterSector" Text='<%#Bind("MatterSector")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypMatterSectormore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTMatterSector" runat="server" TargetControlID="hypMatterSectormore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Work type" UniqueName="WT" DataField="WorkType"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblWorkType" runat="server" Text=""></asp:Label>
<asp:LinkButton runat="server" ID="hypmore" Text="...more" Font-Bold="true" ForeColor="BurlyWood"
Visible="false"></asp:LinkButton>
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="hypmore" Width="150px"
RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="PracticeGroup" UniqueName="PracticeGroup"
HeaderText="Practice group" DataField="PracticeGroup" Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblPracticeGroup" Text='<%#Bind("PracticeGroup")%>'
CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypPracticeGroupmore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTPracticeGroup" runat="server" TargetControlID="hypPracticeGroupmore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="LeadPartner" UniqueName="LeadPartner"
HeaderText="Lead partner" DataField="LeadPartner" Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblLeadPartner" Text='<%#Bind("LeadPartner")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypLeadPartnermore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTLeadPartner" runat="server" TargetControlID="hypLeadPartnermore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="MatterLocation" UniqueName="MatterLocation"
HeaderText="Matter location" DataField="MatterLocation" Visible="false">
<ItemTemplate>
<asp:Label runat="server" ID="lblMatterLocation" Text='<%#Bind("MatterLocation")%>'
CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypMatterLocationmore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTMatterLocation" runat="server" TargetControlID="hypMatterLocationmore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn SortExpression="DateCompleted" HeaderText="Date completed"
Visible="false" HeaderButtonType="TextButton" DataField="DateCompleted" UniqueName="DateCompleted">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="CredentialType" HeaderText="Credential type"
Visible="false" HeaderButtonType="TextButton" DataField="CredentialType">
<HeaderStyle Width="10%" />
<ItemStyle Width="10%" />
</telerik:GridBoundColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<telerik:GridTemplateColumn UniqueName="Checkbox" Display="true" AllowFiltering="false">
<ItemTemplate>
<asp:CheckBox ID="chkMasterChild" runat="server" AutoPostBack="false" />
</ItemTemplate>
<HeaderTemplate>
<table>
<tr>
<td>
<asp:CheckBox ID="chkMasterHead" runat="server" AutoPostBack="false" onclick="RowSelectedMaster(this);" />
</td>
</tr>
</table>
</HeaderTemplate>
<HeaderStyle Width="30px" />
</telerik:GridTemplateColumn>
<%
--<telerik:GridClientSelectColumn HeaderStyle-Width="20px" UniqueName="Checkbox" Visible="false">
<HeaderStyle Width="20px" />
</telerik:GridClientSelectColumn>--
%>
<telerik:GridBoundColumn SortExpression="ClientName" HeaderText="Client name" HeaderButtonType="TextButton"
DataField="ClientName" Visible="false" UniqueName="CName">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn SortExpression="ClientName" UniqueName="ClientName" HeaderText="Client name"
DataField="ClientName" Visible="true" FilterControlWidth="115px">
<ItemTemplate>
<asp:HyperLink ID="Link" runat="server" Text='<%#Bind("CredentialID") %>' Visible="false"></asp:HyperLink>
<asp:LinkButton runat="server" ID="hypid" Text='<%#Bind("ClientName") %>' Font-Bold="true"
OnClick="hypid_Click" ForeColor="Black"></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Width="200px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="CredentialVersion" UniqueName="CredentialVersion"
HeaderText="Credential version"
DataField="CredentialVersion" Visible="true" AllowFiltering="true">
<ItemTemplate>
<asp:Label runat="server" ID="lblCredentialVersion" Text='<%#Bind("CredentialVersion")%>'
CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypCredentialVersionmore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTCredentialVersion" runat="server" TargetControlID="hypCredentialVersionmore"
Width="150px" RelativeTo="Element" Position="MiddleRight" Visible="false">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="120px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="MatterDescription"
DataField="MatterDescription" FilterControlWidth="300px">
<HeaderStyle Width="700px" />
<ItemTemplate>
<asp:Label ID="lblMatterDescription" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="ConfidentialYes"
DataField="MatterDescription" AllowFiltering="false" Visible="false">
<ItemTemplate>
<asp:Label ID="lblConfidentialYes" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Matter/credential description" UniqueName="ConfidentialNo"
DataField="MatterDescription" AllowFiltering="false" Visible="false">
<ItemTemplate>
<asp:Label ID="lblConfidentialNo" runat="server" Text=""></asp:Label>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="ClientSector" UniqueName="ClientSector"
HeaderText="Client sector" DataField="ClientSector" Visible="true" FilterControlWidth="150px">
<ItemTemplate>
<asp:Label runat="server" ID="lblClientSector" Text='<%#Bind("ClientSector")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypClientSectormore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTClientSector" runat="server" TargetControlID="hypClientSectormore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="200px" />
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn SortExpression="MatterSector" UniqueName="MatterSector"
HeaderText="Matter sector" DataField="MatterSector" Visible="true" FilterControlWidth="150px">
<ItemTemplate>
<asp:Label runat="server" ID="lblMatterSector" Text='<%#Bind("MatterSector")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypMatterSectormore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTMatterSector" runat="server" TargetControlID="hypMatterSectormore"
Width="180px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="200px" />
<%
--<ItemStyle Width="8%" />--%>
</telerik:GridTemplateColumn>
<%
-- <telerik:GridBoundColumn SortExpression="MatterSector" HeaderText="MatterSector"
HeaderButtonType="TextButton" DataField="MatterSector" UniqueName="MatterSector">
<HeaderStyle Width="15%" />
<ItemStyle Width="15%" Wrap="true" />
</telerik:GridBoundColumn>--
%>
<telerik:GridTemplateColumn HeaderText="Work type" UniqueName="WT" DataField="WorkType"
AllowFiltering="false">
<HeaderStyle Width="190px" />
<ItemStyle Wrap="true" />
<ItemTemplate>
<asp:Label ID="lblWorkType" runat="server" Text=""></asp:Label>
<asp:LinkButton runat="server" ID="hypmore" Text="...more" Font-Bold="true" ForeColor="BurlyWood"
Visible="false"></asp:LinkButton>
<telerik:RadToolTip ID="RadToolTip1" runat="server" TargetControlID="hypmore" Width="150px"
RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
</telerik:GridTemplateColumn>
<%
-- <telerik:GridBoundColumn SortExpression="PracticeGroup" HeaderText="PracticeGroup"
HeaderButtonType="TextButton" DataField="PracticeGroup" UniqueName="PracticeGroup">
<HeaderStyle Width="15%" />
<ItemStyle Width="15%" Wrap="true" />
</telerik:GridBoundColumn>--
%>
<telerik:GridTemplateColumn SortExpression="PracticeGroup" UniqueName="PracticeGroup"
HeaderText="Practice group" DataField="PracticeGroup" Visible="true" FilterControlWidth="150px">
<ItemTemplate>
<asp:Label runat="server" ID="lblPracticeGroup" Text='<%#Bind("PracticeGroup")%>'
CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypPracticeGroupmore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTPracticeGroup" runat="server" TargetControlID="hypPracticeGroupmore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="200px" />
<%
--<ItemStyle Width="8%" />--%>
</telerik:GridTemplateColumn>
<%
--<telerik:GridBoundColumn SortExpression="LeadPartner" HeaderText="LeadPartner" HeaderButtonType="TextButton"
DataField="LeadPartner" UniqueName="LeadPartner">
<HeaderStyle Width="15%" />
<ItemStyle Width="15%" Wrap="true" />
</telerik:GridBoundColumn>--
%>
<telerik:GridTemplateColumn SortExpression="LeadPartner" UniqueName="LeadPartner"
HeaderText="Lead partner" DataField="LeadPartner" Visible="true" FilterControlWidth="140px">
<ItemTemplate>
<asp:Label runat="server" ID="lblLeadPartner" Text='<%#Bind("LeadPartner")%>' CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypLeadPartnermore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTLeadPartner" runat="server" TargetControlID="hypLeadPartnermore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="190px" />
<%
--<ItemStyle Width="5%" />--%>
</telerik:GridTemplateColumn>
<%
--<telerik:GridBoundColumn SortExpression="MatterLocation" HeaderText="MatterLocation"
HeaderButtonType="TextButton" DataField="MatterLocation" UniqueName="MatterLocation">
<HeaderStyle Width="15%" />
<ItemStyle Width="15%" Wrap="true" />
</telerik:GridBoundColumn>--
%>
<telerik:GridTemplateColumn SortExpression="MatterLocation" UniqueName="MatterLocation"
HeaderText="Matter location" DataField="MatterLocation" Visible="true" FilterControlWidth="140px">
<ItemTemplate>
<asp:Label runat="server" ID="lblMatterLocation" Text='<%#Bind("MatterLocation")%>'
CssClass="panelStyle1"></asp:Label>
<asp:LinkButton runat="server" ID="hypMatterLocationmore" Text="...more" Font-Bold="true"
ForeColor="BurlyWood" Visible="false" CssClass="panelStyle1"></asp:LinkButton>
<telerik:RadToolTip ID="radTTMatterLocation" runat="server" TargetControlID="hypMatterLocationmore"
Width="150px" RelativeTo="Element" Position="MiddleRight">
</telerik:RadToolTip>
</ItemTemplate>
<HeaderStyle Width="190px" />
<%
--<ItemStyle Width="5%" />--%>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
Case 1)
If I place the below grid on a aspx page, the grid data is loaded client side and paging and sorting appear to be working as expected.
Case 2)
However, if I put the below grid on a web User Control, then place the control on an aspx page, paging and sorting do not work, the page number will change, but the data isn't refreshed in the grid, also if you click a heading to sort, the sort direction icon is shown, but the grid data does not refresh.
Case 3) (this is my end goal)
If you put the below grid in a ContentTemplate of a Menuitem, sort or paging does not work, and the page numbers won't change when changing pages, and the item count isn't correct. (this is my end goal). if I use server side binding, needdatasource everything works fine, but I'm really trying to get client side binding to avoid postbacks. No editing of data, just view only.
Also, the template column that is commented out, throws an error when the page first loads, as it's binding to an empty datasource is my guess, says fph_Private isn't part of the DataSource.
<
telerik:RadGrid
ID
=
"rgRecent1"
runat
=
"server"
ClientDataSourceID
=
"RadClientDataSource2"
AllowPaging
=
"true"
AllowSorting
=
"true"
PageSize
=
"5"
>
<
MasterTableView
>
<
Columns
>
<%-- <
telerik:GridTemplateColumn
>
<
ItemTemplate
>
<
asp:Image
ID
=
"imgShared"
runat
=
"server"
ImageUrl
=
"~/Images/Shared.png"
Visible='<%# IIf(CType(Eval("fph_Private"), Boolean), 0, 1)%>' ToolTip="Shared" BorderWidth="0" Width="16px" />
</
ItemTemplate
>
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"20px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"20px"
/>
</
telerik:GridTemplateColumn
>--%>
<
telerik:GridBoundColumn
UniqueName
=
"pt_Type"
DataField
=
"pt_Type"
HeaderText="<br />Type">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"75px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"75px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ItemsCount"
DataField
=
"ItemsCount"
HeaderText="Items<br />Count">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"50px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"50px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"rm_RepNumber"
DataField
=
"rm_RepNumber"
HeaderText="<br />Rep NO">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"75px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"75px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ot_Abbreviation"
DataField
=
"ot_Abbreviation"
HeaderText="Lead<br />Time">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"50px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"50px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"fph_ProjectNumber"
DataField
=
"fph_ProjectNumber"
HeaderText="<br />Project NBR">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"100px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"100px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"fph_ProjectName"
DataField
=
"fph_ProjectName"
HeaderText="<br />Project Name">
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"LastFirstMiddle"
DataField
=
"LastFirstMiddle"
HeaderText="<br />Initiator">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"200px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"200px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"fpr_AccessDate"
DataField
=
"fpr_AccessDate"
DataFormatString
=
"{0: MM/dd/yyyy hh:mm tt}"
HeaderText="<br />Last Access Date">
<
HeaderStyle
HorizontalAlign
=
"Left"
Width
=
"125px"
/>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"125px"
/>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
>
<
DataBinding
ShowEmptyRowsOnLoad
=
"false"
></
DataBinding
>
</
ClientSettings
>
<
PagerStyle
AlwaysVisible
=
"true"
Mode
=
"NextPrevNumericAndAdvanced"
/>
</
telerik:RadGrid
>
<
telerik:RadClientDataSource
ID
=
"RadClientDataSource2"
runat
=
"server"
AllowPaging
=
"true"
PageSize
=
"5"
>
<
DataSource
>
<
DataSourceControlSettings
DataSourceID
=
"ObjectDataSource_FPHR"
/>
</
DataSource
>
</
telerik:RadClientDataSource
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource_FPHR"
runat
=
"server"
SelectMethod
=
"GetFieldProjectRecent"
TypeName
=
"AppClassObjects.FieldProjectHeaderRecent"
>
<
SelectParameters
>
<
asp:SessionParameter
Name
=
"u_UsersID"
DefaultValue
=
"32"
SessionField
=
"UserID"
Type
=
"Int32"
/>
</
SelectParameters
>
</
asp:ObjectDataSource
>
In a telerik:RadGrid, I specify that every line will have a detail table:
<
telerik:RadGrid
ID
=
"grd"
AutoGenerateColumns
=
"False"
runat
=
"server"
OnDetailTableDataBind
=
"grd_OnDetailTableDataBind"
AllowMultiRowSelection
=
"True"
>
<
MasterTableView
DataKeyNames
=
"id1,id2"
>
<
Columns
>
<
telerik:GridClientSelectColumn
UniqueName
=
"DetailCheckColumn"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Date"
DataField
=
"foo"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Time"
DataField
=
"bar"
/>
<
telerik:GridBoundColumn
HeaderText
=
"Activity"
DataField
=
"xod"
/>
</
Columns
>
<
DetailTables
>
<
telerik:GridTableView
ShowHeadersWhenNoRecords
=
"True"
DataKeyNames
=
"id"
Name
=
"Child"
/>
</
DetailTables
>
</
MasterTableView
>
<
ClientSettings
>
<
Selecting
AllowRowSelect
=
"true"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
In the handler for the OnDetailTableDataBind event, I specify the data source for the DetailTableView. The handler is called when a line is expanded. Setting a list of anonymous objects as data source works fine, but a list of Dictionary will not.
I get a yellow page, It seems like the grid table view tries to find a property id of Dictionary
DataBinding: System.Collections.Generic.Dictionary`2[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] does not have a property with the name id.
If I remove the DataKeyNames attribute in the detail table, I will get a detail table with the correct number of lines, but the fields will be all blank (screenshot is attached).
The event handler where I create the detail table for each expanded line. Observe that I name columns c1, c2 etc. I create the columns in the first loop round.
protected void grd_OnDetailTableDataBind(object sender,
GridDetailTableDataBindEventArgs e)
{
var tv = e.DetailTableView;
var parentItem = e.DetailTableView.ParentItem;
var bis = dal.get_booking_informations();
tv.Columns.Add(new GridClientSelectColumn());
var columnNameDict = new Dictionary<
string
,string>();
var firstDict = true;
var dicts = bis.GroupBy(bi=>bi.platsBokadID).Select(group =>
{
var dict = new Dictionary<
string
, string>();
dict["id"] = "" + group.Key;
var list = group.ToList();
if (firstDict)
{
firstDict = false;
var num = 0;
var columns = list.Select(header=>
{
var shortName = "c" + ++num;
columnNameDict[header.HeaderName] = shortName;
return new GridBoundColumn
{
DataField = shortName,
HeaderText = header.HeaderName
};
});
foreach(var column in columns)
tv.Columns.Add(column);
}
foreach(var header in list)
{
var shortName = columnNameDict[header.HeaderName];
dict[shortName] = header.Value;
}
return dict;
});
tv.DataSource = dicts;
}
I have also tried to use dynamic objects instead of Dictionaries (with the same result):
protected void grdActivitiesToCopy_OnDetailTableDataBind(object sender, GridDetailTableDataBindEventArgs e)
{
var tv = e.DetailTableView;
var parentItem = e.DetailTableView.ParentItem;
var bis = dal.get_booking_informations();
tv.Columns.Add(new GridClientSelectColumn());
var columnNameDict = new Dictionary<
string
,string>();
var firstDict = true;
var dicts = bis.GroupBy(bi=>bi.platsBokadID).Select(group =>
{
var dict = new Dictionary<
string
, object>();
dict["id"] = "" + group.Key;
var list = group.ToList();
if (firstDict)
{
firstDict = false;
var num = 0;
var columns = list.Select(header=>
{
var shortName = "c" + ++num;
columnNameDict[header.HeaderName] = shortName;
return new GridBoundColumn
{
DataField = shortName,
HeaderText = header.HeaderName
};
});
foreach(var column in columns)
tv.Columns.Add(column);
}
var eo = new ExpandoObject();
var eoColl = (ICollection<
KeyValuePair
<string, object>>)eo;
foreach(var header in list)
{
var shortName = columnNameDict[header.HeaderName];
dict[shortName] = header.Value;
}
foreach (var kvp in dict)
{
eoColl.Add(kvp);
}
dynamic eoDynamic = eo;
return eoDynamic;
}).ToList();
tv.DataSource = dicts;
}