function
PrintRadGrid(radGridId){
var radGrid = document.getElementById(radGridId);
var sh = '<%= ClientScript.GetWebResourceUrl(rgrdUser.GetType(),String.Format("Telerik.Web.UI.Skins.{0}.Grid.{0}.css",rgrdUser.Skin)) %>';
var styleStr = "<html><head><link href = '" + sh + "' rel='stylesheet' type='text/css'></link></head>";
var htmlcontent = styleStr + "<body>" + radGrid.outerHTML + "</body></html>";
previewWnd.document.open();
previewWnd.document.write(htmlcontent);
previewWnd.document.close();
previewWnd.print();
}
Thanks,
Lubna.
Hi All, i have a rad grid in which i am assigning datasource on code behind , how to print this grid <telerik:RadGrid Width="100%" HeaderStyle-Height="22px" HeaderStyle-HorizontalAlign="Left" GridLines="Horizontal" DataKeyNames="UnitId" AutoGenerateColumns="false" AllowSorting="true" MasterTableView-HierarchyDefaultExpanded="true" AllowPaging="false" ID="gvReportUnit" runat="server" OnDetailTableDataBind="gvReportUnit_DetailTableDataBind" OnSortCommand="gvReportUnit_SortCommand"> <PagerStyle Mode="NumericPages"></PagerStyle> <ClientSettings AllowColumnsReorder="true" ReorderColumnsOnClient="true"> </ClientSettings> <MasterTableView AllowSorting="true" DataKeyNames="UnitId" Width="100%"> <Columns> <telerik:GridBoundColumn DataField="UnitId" Visible="false"> </telerik:GridBoundColumn> <telerik:GridTemplateColumn HeaderText="Unit ID" ItemStyle-CssClass="ItemStyle" ItemStyle-VerticalAlign="Top" ItemStyle-HorizontalAlign="Left" SortExpression="UnitNameId" HeaderStyle-HorizontalAlign="Left" ItemStyle-Width="100%"> <ItemTemplate> <%# Eval("UnitNameId") %> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> <DetailTables> <telerik:GridTableView AllowPaging="false" AutoGenerateColumns="false" AllowSorting="false" GridLines="Horizontal" Width="100%" runat="server"> </telerik:GridTableView> </DetailTables> </MasterTableView> </telerik:RadGrid> Thanks Pankaj Agarwal
I have created a content page which I will use with my Master Page.
When I drag and drop my RadGrid onto my page I get an ASP Error
<telerick:RadGrid -
Element RadGrid is not a known element. This can occur if there is a compliation error in the website, or the web.config file is missing.
<HeaderContextMenu -
Validation (xhtml 1.0 Transiational) "Element 'header' is not supported
I started to get this error after I created my master page - Here is what I have in the Content file...
<%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Organization.aspx.vb" Inherits="Basic.Organization1" |
title="Untitled Page" %> |
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> |
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server"></asp:Content> |
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> |
<asp:SqlDataSource ID="SqlDataSource1" runat="server"></asp:SqlDataSource> |
<br /> |
<telerik:RadGrid ID="Organization" runat="server"> |
<HeaderContextMenu> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</HeaderContextMenu> |
<MasterTableView> |
<RowIndicatorColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</RowIndicatorColumn> |
<ExpandCollapseColumn> |
<HeaderStyle Width="20px"></HeaderStyle> |
</ExpandCollapseColumn> |
</MasterTableView> |
<FilterMenu> |
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> |
</FilterMenu> |
</telerik:RadGrid> |
</asp:Content> |
<ClientEvents OnRowClick="onClick_HistoryTable" />
to ClientSettings of my Grid and add to .js file function: a) var masterTable = sender.get_masterTableView();
b) var masterTable = $find(WorkflowsControls.HistoryGrid).get_masterTableView();
masterTable.clearSelectedItems();
1) masterTable.selectItem(masterTable.get_dataItems()[0].get_element());
2) masterTable.selectItem(0);
3) masterTable.get_dataItems()[0].set_selected("true");
4) masterTable.get_dataItems()[0]._selected = true;
5) var rowControl = masterTable.get_dataItems()[0].get_element();
masterTable.selectItem(rowControl, true);
}
I tied both cases a) and b) with all options (1-5) but it never worked.
This is using Grid:
<telerik:RadGrid ID="HistoryGrid" runat="server" AutoPostBack="true" CellSpacing="0"
GridLines="None" Skin="Office2010Blue" AutoGenerateColumns="False"
OnDetailTableDataBind="HistoryGrid_DatdataBind" OnNeedDataSource="HistoryGrid_NeedDataSource"
MasterTableView-ShowHeadersWhenNoRecords="False" Height="520px">
<ClientSettings EnablePostBackOnRowClick="True" AllowKeyboardNavigation="false" AllowColumnsReorder="True" Resizing-AllowColumnResize="True">
<Selecting AllowRowSelect="True" />
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<ClientEvents OnRowClick="onClick_HistoryTable" />
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" TableLayout="Fixed" BorderStyle="None"
ExpandCollapseColumn-Visible="True">
<Columns>
<telerik:GridImageColumn UniqueName="ColumnImage" AllowSorting="false" DataImageUrlFields="ImageUrl"
Resizable="false" Reorderable="false">
<HeaderStyle Width="25px"></HeaderStyle>
</telerik:GridImageColumn>
<telerik:GridBoundColumn UniqueName="FileName" HeaderText="File Name" DataField="FileName"
AllowSorting="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="StageName" HeaderText="Stage Name" DataField="StageName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn UniqueName="User" HeaderText="User" DataField="User">
</telerik:GridBoundColumn>
</Columns>
<DetailTables>
<telerik:GridTableView runat="server" AutoGenerateColumns="False">
<SortExpressions>
<telerik:GridSortExpression FieldName="Date" SortOrder="Descending" />
</SortExpressions>
</telerik:GridTableView>
</DetailTables>
</MasterTableView>
</telerik:RadGrid>
What must I do?
Regards,
Michael Milman.
I have a radgrid I am using to hold data about client interests likes and dislikes. I need the user to be able to filter the results. I was using radfilter, and it works, but is very complicated for the end user and is too confusing. I thought that the way it is set up in the rad grid itself may be easier.
Though from what I can tell, I can only do one expression at a time. I cannot do "and" and "or" expressions. Say I wanted to see who likes TV-Cartoon and who likes TV-Outdoors. Is there a way I can make BOTH of those appear?
As far as I can tell, you can only type one thing in the text box, use the filter drop down (I just used contains) and have that one expression show. Is there a way to do multiple?
Hi,
Very new to telerik. I have a radgrid that has a radcombobox in each row using an edititemtemplate. For each row I'm trying to get the value in the data source for the radgrid and then set the radcombobox to that same value. Eventually I want to choose a value from the radcombox and save the grid using that value for that same field in the radgrid. So there is one field in the radgrid that is always tied to the radcombobox for any row
After some digging I figured out how to get the value in the radgrid for the field I want in the ItemDatabound event:
if (e.Item is GridDataItem)
{
GridDataItem item = (GridDataItem)e.Item;
string Line = item.GetDataKeyValue("WO_ID").ToString();
//string MachineID = (item["Machine"].Controls[0]).ToString();
string s = ((DataRowView)e.Item.DataItem)["MachineID"].ToString();
RadComboBox cboMachine = item.FindControl("cboMachine") as RadComboBox;
cboMachine.SelectedValue = s;
}
What I would like to do now is take the the "s" variable and set the combobox to that value (this would be on the first display of the screen). As you can see in the line:
cboMachine.SelectedValue = s;
I was attempting to set the combobox to the value that is read into the radgrid;unfortunately the findcontrol I used did not find the combobox control. What I think I found in my naive understanding of this is that I couldn't get to combo box as a control and set it as long as I was using this if statement
"if (e.Item is GridDataItem)"
It seemed I need to use GridEditFormItem.The problem is that would involve require another call to ItemDataBound and I'd lose the value I got from the grid is the variable "s". I suppose I could make "s" a session variable but that seems clumsy and not decent design. I'm sure I'm missing something.
Any help would be appreciated.
Thanks,
Neil
In a RadTreeList, when a user clicks on a checkbox, I want
to check its child nodes, but only ones that are enabled. The issue is that
there is no API to determine if a node is enabled. I’m have been trying with
JQuery selector, so far unsuccessfully.
I include the code as follows.
<telerik:RadTreeList ID="rtlFolderView" runat="server" OnNeedDataSource="rtlFolderView_NeedDataSource" Width="100%" Height="100%"
ParentDataKeyNames="ParentDocumentFolderId" DataKeyNames="DocumentFolderId" AllowPaging="false" AllowMultiItemSelection="true"
OnItemDataBound="rtlFolderView_ItemDataBound" AutoGenerateColumns="false" AllowSorting="true" ExpandCollapseMode="Server">
<ClientSettings>
<Selecting AllowItemSelection="true" />
<ClientEvents OnItemSelected="clientNodeChecked" />
</ClientSettings>
//javascript.
function clientNodeChecked(sender, eventArgs) {
var dataItem =
eventArgs.get_item();
var childNodes =
dataItem.get_childItems();
if (childNodes === null) {
return;
}
var isChecked =
dataItem.get_selected();
UpdateAllChildren(childNodes, isChecked);
}
function UpdateAllChildren(nodes, checked) {
var i = 0;
var nodeCount =
nodes.length;
for (i = 0; i <
nodeCount; i++) {
//console.log(nodes[i]._element.childNodes);
var found = false;
//$(nodes[i]._element.childNodes).each(function
(index, elmnt) {
//console.log((elmnt));
//if
(index > 0 && $(elmnt).attr('class').indexOf('aspNetDisabled')
>= 0) {
//if
(el.length > 0) {
//
found = true;
//
console.log(el);
//}
//});
//var chk
= $(nodes[i]).find('input[type=checkbox]').first();
//var
disabled = $(chk).attr('disabled');
if (!found) {
nodes[i].set_selected(checked);
}
}
}
Any help would be appreciated.