Description:
If RadGrid has UseStaticHeaders enabled, different HTML Tables are rendered and instructing JAWS to read the tables one by one will also read the Header. It would say Header with "n" number of columns and one rows, since the table has only one row and that is containing the Column Names.
Goal:
It would be great, if the grid with Static Header could be made in a way that JAWS will only treat the grid as one Table instead of two separate tables.
Workaround and discussion:
Using CommandItemTemplate (Grid - Command Item) for Editing DetailTable records and selecting an item after filtering or from another page, one item from the first page is put for editing instead. Open the attached GIF animation (EditSelectedEditWrongItem.gif) to see it in action.
Currently the workaround we offer is to handle the EditSelected command manually for all the DetailTables Except for the Master.
Grid markup:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" Width="100%" PageSize="3"
OnItemCommand="RadGrid1_ItemCommand"
OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
OnNeedDataSource="RadGrid1_NeedDataSource">
<MasterTableView Name="MasterTable" AutoGenerateColumns="true" DataKeyNames="OrderID">
<DetailTables>
<telerik:GridTableView Name="ChildTable" DataKeyNames="OrderID" AutoGenerateColumns="true" CommandItemDisplay="Top">
<CommandItemTemplate>
<asp:LinkButton ID="btnEditSelected" runat="server" CommandName="EditSelected" CssClass="btn btn-default">Edit Selected</asp:LinkButton>
</CommandItemTemplate>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" />
</ClientSettings>
</telerik:RadGrid>
C# - ItemCommand
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
// Logic applies for all the tables (detail tables) which are not named "MasterTable"
if(e.Item.OwnerTableView.Name != "MasterTable" && e.CommandName == RadGrid.EditSelectedCommandName)
{
e.Canceled = true;
GridTableView detailTable = e.Item.OwnerTableView;
if (detailTable.OwnerGrid.SelectedIndexes.Count == 0)
{
return;
}
foreach (GridDataItem selectedItem in detailTable.OwnerGrid.SelectedItems)
{
selectedItem.Edit = true;
}
detailTable.Rebind();
}
}
VB - ItemCommand
Protected Sub RadGrid1_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs)
If e.Item.OwnerTableView.Name <> "MasterTable" AndAlso e.CommandName = RadGrid.EditSelectedCommandName Then
e.Canceled = True
Dim detailTable As GridTableView = e.Item.OwnerTableView
If detailTable.OwnerGrid.SelectedIndexes.Count = 0 Then
Return
End If
For Each selectedItem As GridDataItem In detailTable.OwnerGrid.SelectedItems
selectedItem.Edit = True
Next
detailTable.Rebind()
End If
End Sub
Currently the Width of the Edit controls inside the inline Edit form of the Grid can be set only in pixels. In order to be able to implement a responsive layout the developer has to be able to set the width of these controls in percentage.
When virtualization is enabled for RadGrid, NeedDataSource is called at every Post back with RebindReason = ExplicitRebind, regardless of the event target.
Steps to reproduce:
Use the following Code snippets for the runnable sample and debug the NeedDataSource event while doing post backs using other controls. For instance, you can use the RadButton1 from these snippets to make a standard Post Back.
<telerik:RadGrid ID="RadGrid1" runat="server"> <MasterTableView> <Columns> <telerik:GridClientDeleteColumn CommandName="Delete" ButtonType="LinkButton"></telerik:GridClientDeleteColumn> </Columns> </MasterTableView> <ClientSettings> <ClientEvents OnCommand="OnCommand" /> </ClientSettings></telerik:RadGrid>function OnCommand(sender, args) {}Private Function SomeTable() As DataTable Dim dt As New DataTable() dt.Columns.Add(New DataColumn("FieldName", Type.GetType("System.String"))) row("FieldName") = "C:\SomeDirectory\RadGridExport.pdf" dt.Rows.Add(row) Return dtEnd Function<telerik:GridAttachmentColumn DataSourceID="ObjectDataSource1" HeaderText="Attachment Column" AttachmentKeyFields="FieldName" AttachmentDataField="FieldName" DataTextField="FieldName" UniqueName="FieldName" ButtonType="ImageButton" UploadControlType="RadAsyncUpload" FileName="RadGridExport.pdf" ImageUrl="pdf-icon.png" ItemStyle-Height="36px" ItemStyle-Width="36px" ></telerik:GridAttachmentColumn> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="MySelectMethod" TypeName="MyApp"> <SelectParameters> <asp:Parameter Name="FieldName" Type="String" /> </SelectParameters></asp:ObjectDataSource>Public Class MyApp <DataObjectMethodAttribute(DataObjectMethodType.Select, True)> Public Function MySelectMethod(filePath As String) As DataTable Dim dt As New DataTable("Base") Dim col As New DataColumn("FieldName") col.DataType = System.Type.GetType("System.Byte[]") dt.Columns.Add(col) Dim row As DataRow = dt.NewRow row(0) = My.Computer.FileSystem.ReadAllBytes(filePath) dt.Rows.Add(row) Return dt End FunctionEnd Class<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="true" OnNeedDataSource="RadGrid1_NeedDataSource"> <ExportSettings ExportOnlyData="true"> <Excel Format="Biff" /> </ExportSettings> <MasterTableView Caption="My Personalized caption" CommandItemDisplay="Top"> <CommandItemSettings ShowExportToExcelButton="true" /> </MasterTableView></telerik:RadGrid>protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e){ RadGrid1.DataSource = OrdersTable();}private DataTable OrdersTable(){ DataTable dt = new DataTable(); dt.Columns.Add(new DataColumn("OrderID", typeof(int))); dt.Columns.Add(new DataColumn("OrderDate", typeof(DateTime))); dt.Columns.Add(new DataColumn("Freight", typeof(decimal))); dt.Columns.Add(new DataColumn("ShipName", typeof(string))); dt.Columns.Add(new DataColumn("ShipCountry", typeof(string))); dt.PrimaryKey = new DataColumn[] { dt.Columns["OrderID"] }; return dt;}System.ArgumentOutOfRangeException
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
This error seems to happen if there is a GridTemplateColumn that has the Exportable property set to False.
Hi
Since updating to the latest release of UI for ASP.NET AJAY the RadContextMenu of my RadGrid is misaligned at the right edge of the screen. Even in your sample https://demos.telerik.com/aspnet-ajax/grid/examples/columns-rows/columns/context-menu/defaultcs.aspx when you open the context menu at the right side of the screen the context menu is nor aligned to the left (like it used to be).
Please ses the attached printscreen.
Kind regards
Felix