i'm trying to execute one jquery function, but it giver me an error and i don't know what is going on. It is really kiling me. I don't know what else i can do.
If someone know's how to fix it, please help me.
error:
Exception was thrown at line 5263, column 7 in localhost:8538/Scripts/jquery-1.8.2.js
0x800a139e - JavaScript runtime error: SyntaxError
<%# Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
<%# Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
<script src="Script/jquery-1.8.2.js"></script>
<script>
$(document).ready(function () {
setpager();
});
function setpager() {
$("#grdTeste .rgPagerCell:first").find('div').not(".rgInfoPart").css('display', 'none');
$("#grdTeste .rgPagerCell:last").find('.rgInfoPart').css('display', 'none');
}
</script>
<section class="featured">
<div class="content-wrapper">
<hgroup class="title">
<h1><%: Title %></h1>
</hgroup>
</div>
</section>
<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
<tbody>
<tr>
<td width="50%" valign="bottom" height="25">
<font id="tituloTela" style="padding-left:6px"> Feriados </font>
<input id="Button1" type="button" value="button" onclick="setpager();"/>
</td>
</tr>
</tbody>
</table>
</asp:Content>
<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
<telerik:RadGrid ID="grdTeste" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" CellSpacing="0"
DataSourceID="SqlDataSource" GridLines="None" PageSize="5" OnNeedDataSource="RadGrid1_NeedDataSource" >
<ExportSettings>
<Pdf PageWidth="">
</Pdf>
</ExportSettings>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="COD_FERIADO" DataSourceID="SqlDataSource" CommandItemDisplay="Top" >
<CommandItemSettings AddNewRecordText="Adicionar Novo Registro" RefreshText="Atualizar"/>
<Columns>
<telerik:GridBoundColumn DataField="DATA" FilterControlAltText="Filter DATA column" HeaderText="DATA" SortExpression="DATA" UniqueName="DATA">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="NOME" FilterControlAltText="Filter NOME column" HeaderText="NOME" SortExpression="NOME" UniqueName="NOME">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="COD_FERIADO" DataType="System.Int32" FilterControlAltText="Filter COD_FERIADO column" HeaderText="COD_FERIADO" ReadOnly="True" SortExpression="COD_FERIADO" UniqueName="COD_FERIADO">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column"></EditColumn>
</EditFormSettings>
</MasterTableView>
<PagerStyle Position="TopAndBottom" AlwaysVisible="true"/>
</telerik:RadGrid>
<asp:SqlDataSource ID="SqlDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:StringConexao %>"
DeleteCommand="DELETE FROM feriados WHERE (COD_FERIADO = #COD_FERIADO)"
SelectCommand="SELECT DATA, NOME, COD_FERIADO FROM feriados"
UpdateCommand="UPDATE feriados SET NOME = #NOME, DATA = #DATA WHERE (COD_FERIADO = #COD_FERIADO)"
InsertCommand="INSERT INTO feriados VALUES (NEXT VALUE FOR SEQ_FERIADO_NOVA, #DATA, #NOME)">
<DeleteParameters>
<asp:Parameter Name="COD_FERIADO" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="DATA" />
<asp:Parameter Name="NOME" />
</InsertParameters>
<UpdateParameters>
<asp:Parameter Name="NOME" />
<asp:Parameter Name="DATA" />
<asp:Parameter Name="COD_FERIADO" />
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
The error is because your are using plain javascript for finding radgrid(telerik controls).
The javascript used for telerik contols is different than the normal javascript for html contols:
To find radgrid with id="grdTeste":
var grdTeste=$find("<%=grdTeste.ClientID%>"); //find radgrid
This will help you to work with radgrid on client side:
Working with Radgrid on client side
Related
I'm using CommandItemSettings in MasterTablreView to show Export to Excel button.
The CommandItemSettings section of the grid is displayed when Grid has at least 10 records or when I select less than 10 records using a Pager.
However, with less than 10 records after I click the Search button, the CommandItemSettings section is not there and I cannot export the data into an Excel.
Here is the aspx file:
MOSS2 Merchants Report:
<telerik:RadAjaxManager ID="RadAjaxManager" runat="server" EnableAJAX="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="btnSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="grdMoss2Merchants" LoadingPanelID="RadAjaxLoadingPanel2"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
<table class="moss2Search" width="100%">
<tr>
<td colspan="4">
<asp:CustomValidator ID="checkForTwoDates" ClientValidationFunction="AtLeastOneDate_ClientValidate"
EnableClientScript="True" ErrorMessage="At least one date should be selected" runat="server"></asp:CustomValidator> <br />
<asp:CompareValidator ID="CompareValidator2" ControlToCompare="RadDatePicker1" ControlToValidate="RadDatePicker2" Operator="GreaterThanEqual"
ErrorMessage="Date range is not valid" runat="server"></asp:CompareValidator>
</td>
</tr>
<tr>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding Start Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker1" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div runat="server">
<asp:Label runat="server" CssClass="dateLabels">Boarding End Date</asp:Label>
<telerik:RadDatePicker RenderMode="Lightweight" ID="RadDatePicker2" runat="server" onkeydown="keyPress(this, event)">
<Calendar runat="server">
<FastNavigationSettings EnableTodayButtonSelection="true"></FastNavigationSettings>
</Calendar>
</telerik:RadDatePicker>
</div>
</td>
<td>
<div>
<asp:CheckBox ID="chkMerActive" runat="server" Checked="true" TextAlign="Left"/>Active
</div>
</td>
<td>
<telerik:RadButton RenderMode="Lightweight" runat="server" Text="Search" ID="btnSearch" OnClick="btnSearch_Click"/>
</td>
</tr>
</table>
<asp:Label ID="lblMsg" ForeColor="red" runat="server"></asp:Label>
<br />
</telerik:RadAjaxPanel>
<%----%>
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel2" runat="server" Skin="Default">
</telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxPanel ID="RadAjaxPanel2" runat="server" LoadingPanelID="RadAjaxLoadingPanel2">
<telerik:RadGrid
RenderMode="Lightweight"
runat="server"
ID="grdMoss2Merchants"
AllowPaging="True"
AllowSorting="true"
PagerStyle-AlwaysVisible="true"
OnNeedDataSource="BindToDatasource"
OnSortCommand="grdMoss2Merchants_SortCommand"
ViewStateMode="Enabled"
AutoGenerateColumns="false"
OnPageIndexChanged="grdMoss2Merchants_ChangePage"
ClientSettings-Scrolling-ScrollHeight="360px">
<GroupingSettings CaseSensitive="false"/>
<ExportSettings HideStructureColumns="true" ExportOnlyData="true" OpenInNewWindow="true" Excel-Format="Xlsx" IgnorePaging="true" FileName="Moss2Merchants">
<Excel WorksheetName="Moss2Merchants" Format="Xlsx" AutoFitColumnWidth="AutoFitAll" />
</ExportSettings>
<ClientSettings EnableRowHoverStyle="true">
<Scrolling AllowScroll="true" UseStaticHeaders="True"/>
</ClientSettings>
<SortingSettings EnableSkinSortStyles="false" />
<HeaderStyle Width="160px" CssClass="grdHeader" ForeColor="#2E6E9E" />
<MasterTableView AllowNaturalSort="false" CommandItemDisplay="Bottom">
<CommandItemSettings ShowExportToExcelButton="true" ShowAddNewRecordButton="false" ShowRefreshButton="false" />
<CommandItemStyle HorizontalAlign="Right" />
<PagerStyle AlwaysVisible="true" Mode="NextPrevAndNumeric" PageSizes="5,10,25,50,100" />
<Columns>
<telerik:GridBoundColumn DataField="Moss2 MID" HeaderText="MOSS2 MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DBA" HeaderText="DBA" HeaderStyle-Width="250px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Original MID" HeaderText="ORIGINAL MID" AllowSorting="false" DataFormatString="{0:#}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn
DataField="BoardingDate"
DataType="System.DateTime"
HtmlEncode="false"
DataFormatString="{0:MM/dd/yyyy}"
SortExpression="BoardingDate"
UniqueName="BoardingDate"
HeaderText="BOARDING DATE"
HeaderStyle-Width="170px"
ShowFilterIcon="false"
/>
<telerik:GridBoundColumn DataField="Status" HeaderText="STATUS" AllowSorting="false"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>
</telerik:RadAjaxPanel>
The Export To Excel button is showing with Grid having
My problem is that I have 2 radgrids on a page and I cannot filter the columns.
One table is created like this:
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="demo-container" id="demo-container">
<div class="gridPositioning">
<div>
<telerik:RadGrid ID="mdegGrid" runat="server"
AllowPaging="True" AllowCustomPaging="true"
AllowSorting="True"
AllowFilteringByColumn="True"
OnNeedDataSource="mdegGrid_NeedDataSource"
OnItemCommand="mdegGrid_ItemCommand"
OnItemCreated="mdegGrid_ItemCreated"
OnItemDataBound="mdegGrid_ItemDataBound"
OnPreRender="mdegGrid_PreRender"
CellSpacing="0" GridLines="None"
EnableLinqExpressions="false"
PageSize="12"
PagerStyle-AlwaysVisible="true"
EnableEmbeddedSkins="False"
Skin="_HBB"
CellPadding="0"
MasterTableView-CellSpacing="0" >
<GroupingSettings CaseSensitive="false" />
<MasterTableView AutoGenerateColumns="false" TableLayout="Auto" HierarchyLoadMode="ServerOnDemand"
DataKeyNames="ImportID" CommandItemDisplay="None" InsertItemPageIndexAction="ShowItemOnFirstPage">
<CommandItemSettings ShowRefreshButton="false" />
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn UniqueName="ImportID" HeaderText="<%$ Resources:HBS, Import_ID %>" DataField="ImportID_Filter"
SortExpression="ImportID"
FilterControlWidth="99%" ShowFilterIcon="false"
AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
<HeaderStyle ForeColor="Silver" Height="20px" Width="7%" HorizontalAlign="Left"></HeaderStyle>
<ItemStyle ForeColor="Gray" Height="20px" Width="7%" HorizontalAlign="Left"></ItemStyle>
</telerik:GridBoundColumn>
In the code behind in the mdeGrid_PreRender funtion I have the following code:
mdegGrid.MasterTableView.FilterExpression = string.Format("([{0}] LIKE N\'%{1}%\') ", _columnNameImports, txt.Text);
GridColumn column = mdegGrid.MasterTableView.GetColumnSafe(_columnNameImports);
column.CurrentFilterFunction = GridKnownFunction.Contains;
column.CurrentFilterValue = txt.Text;
mdegGrid.MasterTableView.Rebind();
UpdatePanel2.Update();
The problem is that nothing is happening. The grid becomes disabled with a Please wait loading message but after that, no filtering is happening.
I am having a RadTextBox in my page. This control is one of the search criteria to bring the results. The issue is, if I focus on the text box and press enter, the browser window / tab closes immediately. The RadTextBox tag does not have anything other than the runat, ID attributes.
Please share if you have faced a similar issue like this and found a solution.
Source Code:
<%# Control Language="C#" AutoEventWireup="True" Inherits="Controls_ProductListControl_ProductListControl"
CodeBehind="ProductListControl.ascx.cs" ClientIDMode="AutoID" %>
<%# Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script language="javascript" type="text/javascript">
ProductList = {
openAdd: function (catID) {
PopupWindow.open('/ProductCatalog/Popups/AddNewProductDialog.aspx?PID=0&PAID=0&CID=' + catID, 960, 700, ProductList.refreshGrid);
return false;
},
refreshGrid: function () {
$find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("refreshGrid");
},
onRequestStart: function (sender, args) {
if (args.get_eventTarget().indexOf("ExportToExcelButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToWordButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToCsvButton") >= 0 ||
args.get_eventTarget().indexOf("ExportToPdfButton") >= 0) {
args.set_enableAjax(false);
}
}
}
</script>
</telerik:RadScriptBlock>
<div class="heading">
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="LinkButtonSearch">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="LinkButtonShowAll">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="RadGridProducts">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGridProducts" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<asp:Label ID="LabelProductName" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelProductName %>" />
<telerik:RadTextBox ID="RadTextBoxProductName" runat="server" MaxLength="50"></telerik:RadTextBox>
<asp:Label ID="LabelProductID" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelProductID %>" />
<telerik:RadNumericTextBox ID="RadNumericTextBoxProductID" runat="server" Width="100px"
DataType="System.Int32" MaxLength="9" MaxValue="999999999" MinValue="1" Style="text-align: center">
<NumberFormat DecimalDigits="0" GroupSeparator="" />
</telerik:RadNumericTextBox>
<asp:Label ID="LabelRuleID" runat="server" Text="<%$ Resources:UI, ProductListControl_Text_LabelRuleID %>" Visible="false" />
<telerik:RadTextBox ID="RadTextBoxRuleID" runat="server" Visible="false" />
<asp:LinkButton ID="LinkButtonSearch" runat="server" OnClick="LinkButtonSearch_Click"><%= Resources.UI.ProductListControl_HTML_Search %></asp:LinkButton>
<asp:placeholder ID="Placeholder2" runat="server"><img src="<%= Resources.UI.ProductListControl_HTML_ImagesSearchPng %>" width="14" height="14" alt="<%= Resources.UI.ProductListControl_HTML_Search_1 %>" /></asp:placeholder>
<asp:LinkButton ID="LinkButtonShowAll" runat="server" OnClick="LinkButtonShowAll_Click"><%= Resources.UI.ProductListControl_HTML_ShowAll %> </asp:LinkButton>
<asp:LinkButton ID="LinkButtonAddNew" runat="server"><%= Resources.UI.ProductListControl_HTML_AddNewProduct %></asp:LinkButton>
<asp:LinkButton ID="LinkButtonCopyProducts" runat="server" OnClientClick="window.open('/ProductCatalog/CopyProducts.aspx?catid=0','CopyProducts');"><%= Resources.UI.ProductListControl_HTML_CopyProducts %></asp:LinkButton>
</div>
<br />
<div class="fullrow">
<telerik:RadGrid ID="RadGridProducts" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" OnNeedDataSource="RadGridProducts_NeedDataSource" Visible="False" Skin="Windows7" OnItemDataBound="RadGridProducts_ItemDataBound">
<MasterTableView>
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<%--<CommandItemSettings ExportToPdfText="<%$ Resources:UI, ProductListControl_ExportToPdfText_ExportToPdf %>"></CommandItemSettings>--%>
<Columns>
<telerik:GridBoundColumn DataField="pcProductId" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_Product_ID %>" ReadOnly="True" UniqueName="ProductID">
</telerik:GridBoundColumn>
<telerik:GridHyperLinkColumn DataTextField="ExtProductName" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ProductName %>"
UniqueName="ProductDetailLink" DataNavigateUrlFields="pcProductId" DataNavigateUrlFormatString="~/ProductCatalog/ProductDetail2.aspx?PID={0}"> </telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="ExtEffectiveDate" DataFormatString="{0:d}"
HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_EffectiveDate %>" UniqueName="EffectiveDate"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtPositions" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtPositions %>" ReadOnly="True"
UniqueName="Positions"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtRatingType" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtRatingType %>" ReadOnly="True"
UniqueName="RatingType"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtBaseBillRate" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtBaseBillRate %>"
ReadOnly="True" UniqueName="BaseBillRate" DataFormatString="{0:0.00}" FilterControlWidth="30px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtBasePayRate" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtBasePayRate %>" ReadOnly="True"
UniqueName="BasePayRate" DataFormatString="{0:0.00}" FilterControlWidth="30px">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtMargin" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtMargin %>" ReadOnly="True"
UniqueName="Margin" DataFormatString="{0:0.00}"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtEntityName" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtEntityName %>" ReadOnly="True"
UniqueName="EntityName"></telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ExtProductStatus" HeaderText="<%$ Resources:UI, ProductListControl_HeaderText_ExtProductStatus %>" UniqueName="Status">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
</HeaderContextMenu>
</telerik:RadGrid></div>
Thanks,
Sriram
I have two RadGrids on my aspx page and have used one search TextBox to search items from the RadGrid.
There's a button on click of which the selected items are transferred to other grid.
The problem is when i search the items with particular key word and then select items from the RadGrid and click the button. No action is performed and in the code behint it shows no data items selected. Then if I again select from the searched list and click the button it works fine.
function requestStart(sender, args) {
if (args.get_eventTarget().indexOf("ButtonPrint") > 0
||
args.get_eventTarget().indexOf("ButtonSelect") > 0
)
args.set_enableAjax(false);
}
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="EnrollmentPanel">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="EnrollmentPanel" LoadingPanelID="RadAjaxLoadingPanel1" />
<telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="ButtonEnroll">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManagerProxy>
<telerik:RadGrid ID="EnrollmentGrid" runat="server" Width="100%" GridLines="None"
AllowPaging="True" ShowStatusBar="true" AutoGenerateColumns="false" DataSourceID="CourseCreditDS"
OnItemCommand="EnrollmentGrid_ItemCommand" OnItemDataBound="EnrollmentGrid_ItemDataBound">
<MasterTableView DataKeyNames="pid" CommandItemDisplay="None">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px" />
<telerik:GridEditCommandColumn UniqueName="EditCommandColumn" EditText="<%$ Resources: Manager, EditCredit %>"
Visible="false" />
<telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:Image runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
<asp:Image runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="pid" Target="_blank" />
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="lname" Target="_blank" />
<telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
SortExpression="div_name" />
<telerik:GridTemplateColumn UniqueName="ResultColumn" HeaderText="<%$ Resources: Manager, Result %>"
Visible="false">
<ItemTemplate>
<asp:Literal ID="ResultText" runat="server" Text="<%$ Resources: Manager, EmptyDataText %>" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>"
Visible="false" />
<telerik:GridTemplateColumn UniqueName="AttachColumn" Visible="false" HeaderText="Attachment">
<ItemTemplate>
<table>
<tr>
<td>
<telerik:RadAsyncUpload ID="CCFileUploader" runat="server" PostbackTriggers="btnUploadPost" OnFileUploaded="CCFileUploader_FileUploaded" OnClientFileUploaded="CCFileUploader_ClientFileUploaded" UploadedFilesRendering="BelowFileInput" />
</td>
<td>
<asp:Button ID="btnUploadPost" runat="server" CausesValidation="false" Text="hidden" Style="display: none" /></td>
<td>
<asp:LinkButton ID="CCExistingUploadsLink" runat="server" Text="<%$ Resources: Manager, NoExistingAttachments %>" Enabled="false" Style="text-decoration: none; color: #769e1a;" />
<asp:HiddenField ID="CCPid" runat="server" Visible="false" Value='<%# Eval("pid")%>' />
</td>
</tr>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
<EditItemStyle CssClass="EditedItem" />
<EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
<FormStyle BackColor="White" />
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
</ClientSettings>
<ExportSettings IgnorePaging="true" OpenInNewWindow="true">
<Pdf PageHeight="297mm" PageWidth="210mm" PageTitle="Training Session" />
</ExportSettings>
</telerik:RadGrid>
<telerik:RadGrid ID="EnrollListGrid" runat="server" Width="100%" GridLines="None" AllowPaging="true" PageSize="10" ShowStatusBar="true" AllowMultiRowSelection="true" AutoGenerateColumns="false" OnDetailTableDataBind="EnrollListGrid_DetailTableDatabind"
OnNeedDataSource="EnrollListGrid_OnNeedDataSource" OnPreRender="EnrollListGrid_OnPreRender">
<PagerStyle Mode="NumericPages"></PagerStyle>
<MasterTableView AllowMultiColumnSorting="true" DataKeyNames="listname">
<DetailTables>
<telerik:GridTableView DataKeyNames="pid" Name="DetailList">
<Columns>
<telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" HeaderStyle-Width="20px">
<HeaderStyle Width="20px" />
</telerik:GridClientSelectColumn>
<telerik:GridTemplateColumn UniqueName="AssignedColumn" Visible="false" HeaderStyle-Width="60px">
<ItemTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/Contents/Images/tick.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolled %>" Visible='<%# Eval("enrolled").ToString() == "Y" %>' />
<asp:Image ID="Image2" runat="server" ImageUrl="~/Contents/Images/error.gif" ToolTip="<%$ Resources: Manager, SessionAlreadyEnrolledOther %>" Visible='<%# Eval("already_assigned").ToString() == "Y" %>' />
</ItemTemplate>
<HeaderStyle Width="60px" />
</telerik:GridTemplateColumn>
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, StudentId %>" DataTextField="pid"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="pid" Target="_blank" />
<telerik:GridHyperLinkColumn HeaderText="<%$ Resources: Manager, Name %>" DataTextField="name"
DataNavigateUrlFields="pid" DataNavigateUrlFormatString="../Reporting/PivotView.aspx?id={0}"
SortExpression="lname" Target="_blank" />
<telerik:GridBoundColumn HeaderText="<%$ Resources: Manager, Division %>" DataField="div_name"
SortExpression="div_name" />
<telerik:GridBoundColumn UniqueName="CapIdColumn" HeaderText="<%$ Resources: Manager, CapId %>"
DataField="ot1" SortExpression="ot1" ConvertEmptyStringToNull="true" EmptyDataText="<%$ Resources: Manager, EmptyDataText %>" />
</Columns>
<EditItemStyle CssClass="EditedItem" />
<EditFormSettings UserControlName="~/Courses/Template/CourseCredit.ascx" EditFormType="WebUserControl">
<FormStyle BackColor="White" />
</EditFormSettings>
</telerik:GridTableView>
</DetailTables>
<Columns>
<%--<telerik:GridClientSelectColumn UniqueName="ClientSelectList" ></telerik:GridClientSelectColumn>--%>
<%--<telerik:GridBoundColumn UniqueName="EnrollListID" HeaderText="Enroll List ID" DataField="listid"></telerik:GridBoundColumn>--%>
<%--<telerik:GridEditCommandColumn UniqueName="ViewListItems" EditText="View List Items" ></telerik:GridEditCommandColumn>--%>
<telerik:GridBoundColumn UniqueName="EnrollListName" HeaderText="Enroll List Name" DataField="listname"></telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="true" EnableDragToSelectRows="false" />
<%--<ClientEvents OnRowSelecting="EnrollListGrid_OnRowSelecting" />--%>
</ClientSettings>
</telerik:RadGrid>
Please let me know if u need the code behind
Try to ajaxify the source of the binding (i think it's the filtered grid) to the destination of the binding (the second grid).
<telerik:AjaxSetting AjaxControlID="EnrollmentGrid">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="EnrollListGrid" />
</UpdatedControls>
</telerik:AjaxSetting>
Let me know if it help. Otherwise i really need a simpler working version of your code...
I try to program a page, where the content of the database will be loaded into the CKEditor then the content can be changed and saved again. The page is devided into different areas and if the user doubleclicks on an area the Editor should appear. With the following Code, Loading the Content and Doubleclick works, but I can't find any solution to save it back to the database:
<%# Page Title="" Language="C#" MasterPageFile="~/Templates/MasterPageBasic.master"
AutoEventWireup="true" CodeFile="EditTemplate.aspx.cs" Inherits="Templates_EditTemplate" %>
<%# Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="Styles/EditTemplate.css" rel="stylesheet" type="text/css" />
<script src="Scripts/EditTemplate.js" type="text/javascript" />
</asp:Content>
<asp:Content ID="ContentPlaceHolder2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
<div id="header1" class="editable">
<asp:FormView ID="FormViewHeader" runat="server" DataSourceID="SqlDataSourceHeader"
DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox ID="HeaderTextBox" runat="server" Text='<%# Bind("Header") %>' />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceHeader" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [Header] FROM [PageContent]"></asp:SqlDataSource>
</div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','navbar','',1)"
onmouseover="MM_nbGroup('over','navbar','','',1)" onmouseout="MM_nbGroup('out')">
<img src="Images/Clean-Navigation-Bar-by-willyepp.png" alt="" name="navbar" border="0"
id="Articles" onload="" /></a>
</td>
</tr>
</table>
<div id="sidebarLeft" class="editable">
<asp:FormView ID="FormViewSidebarLeft" runat="server" DataSourceID="SqlDataSourceSidebarLeft"
DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox ID="SidebarLeftTextBox" runat="server" Text='<%# Bind("SidebarLeft") %>' />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceSidebarLeft" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [SidebarLeft] FROM [PageContent]"></asp:SqlDataSource>
</div>
<div id="sidebarRight" class="editable">
<asp:FormView ID="FormViewSidebarRight" runat="server" DataSourceID="SqlDataSourceSidebarRight"
DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox ID="SidebarRightTextBox" runat="server" Text='<%# Bind("SidebarRight") %>' />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceSidebarRight" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [SidebarRight] FROM [PageContent]"></asp:SqlDataSource>
</div>
<div id="content" class="editable">
<asp:FormView ID="FormViewContent" runat="server" DataSourceID="SqlDataSourceContent"
DefaultMode="Edit">
<EditItemTemplate>
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%# Bind("Content") %>' />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceContent" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [Content] FROM [PageContent]"></asp:SqlDataSource>
</div>
<div id="footer" class="editable">
<asp:FormView ID="FormViewFooter" runat="server" DataSourceID="SqlDataSourceFooter"
DefaultMode="Edit">
<EditItemTemplate>
<CKEditor:CKEditorControl ID="CKEditorFooter" Text='<%# Bind("Footer") %>' runat="server"
CustomConfigurationsPath="../ckeditor/config.js" ToolbarSet="Footer" EditorAreaCSS="/css/editor.css"
Width="947px" Height="100px">
</CKEditor:CKEditorControl>
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourceFooter" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [Footer] FROM [PageContent]"></asp:SqlDataSource>
</div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>
JS-File
//<![CDATA[
// Uncomment the following code to test the "Timeout Loading Method".
// CKEDITOR.loadFullCoreTimeout = 5;
window.onload = function () {
// Listen to the double click event.
if (window.addEventListener)
document.body.addEventListener('dblclick', onDoubleClick, false);
else if (window.attachEvent)
document.body.attachEvent('ondblclick', onDoubleClick);
};
function onDoubleClick(ev) {
// Get the element which fired the event. This is not necessarily the
// element to which the event has been attached.
var element = ev.target || ev.srcElement;
// Find out the div that holds this element.
var name;
do {
element = element.parentNode;
}
while (element && (name = element.nodeName.toLowerCase()) && (name != 'div' || element.className.indexOf('editable') == -1) && name != 'body')
if (name == 'div' && element.className.indexOf('editable') != -1)
replaceDiv(element, element.id);
}
var cke_header1;
var cke_sidebarLeft;
var cke_sidebarRight;
var cke_content;
function replaceDiv(div, id) {
//First check if an editor is already open, if so close it
if (cke_header1)
cke_header1.destroy();
if (cke_sidebarLeft)
cke_sidebarLeft.destroy();
if (cke_sidebarRight)
cke_sidebarRight.destroy();
if (cke_content)
cke_content.destroy();
switch (id) {
case "header1":
cke_header1 = CKEDITOR.replace(div, {
height: "200", width: "950",
language: 'en',
uiColor: '#350e1e',
toolbar: 'MyToolbar'
});
break;
case "sidebarLeft":
cke_sidebarLeft = CKEDITOR.replace(div, {
height: "690", width: "180",
language: 'en',
uiColor: '#350e1e',
toolbar: 'MyToolbar'
});
break;
case "sidebarRight":
cke_sidebarRight = CKEDITOR.replace(div, {
height: "690", width: "180",
language: 'en',
uiColor: '#350e1e',
toolbar: 'MyToolbar'
});
break;
case "content":
cke_content = CKEDITOR.replace(div, {
height: "690", width: "500",
language: 'en',
uiColor: '#350e1e',
toolbar: 'MyToolbar'
});
break;
}
}
So I tried to use only one FormView, now loading from database and save back works. But the Doubleclick to get the Editor doesn't work anymore. Also I can't save anymore if I add the link to the Javascript file. (I used the same one as below.
Does anyone has a solution for this?
<%# Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
CodeFile="Default2.aspx.cs" Inherits="Default2" %>
<%# Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<link href="Templates/Styles/EditTemplate.css" rel="stylesheet" type="text/css" />
<script src="Scripts/EditTemplate.js" type="text/javascript" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder" runat="Server">
<asp:FormView ID="FormViewPage" runat="server" DataSourceID="SqlDataSourcePage" DefaultMode="Edit">
<EditItemTemplate>
<div id="header1" class="editable">
<asp:TextBox ID="HeaderTextBox" runat="server" Text='<%# Bind("Header") %>' />
</div>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<a href="javascript:;" target="_top" onclick="MM_nbGroup('down','group1','navbar','',1)"
onmouseover="MM_nbGroup('over','navbar','','',1)" onmouseout="MM_nbGroup('out')">
<img src="Templates/Images/Clean-Navigation-Bar-by-willyepp.png" alt="" name="navbar" border="0"
id="Articles" onload="" /></a>
</td>
</tr>
</table>
<div id="content" class="editable">
<asp:TextBox ID="ContentTextBox" runat="server" Text='<%# Bind("Content") %>' />
</div>
<div id="sidebarLeft" class="editable">
<asp:TextBox ID="SidebarLeftTextBox" runat="server" Text='<%# Bind("SidebarLeft") %>' />
</div>
<div id="sidebarRight" class="editable">
<asp:TextBox ID="SidebarRightTextBox" runat="server" Text='<%# Bind("SidebarRight") %>' Visible="True" />
</div>
<div id="footer" class="editable">
<asp:TextBox ID="FooterTextBox" runat="server" Text='<%# Bind("Footer") %>' />
</div>
<asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
Text="Aktualisieren" />
<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
CommandName="Cancel" Text="Abbrechen" />
</EditItemTemplate>
</asp:FormView>
<asp:SqlDataSource ID="SqlDataSourcePage" runat="server" ConnectionString="<%$ ConnectionStrings:CMSConnectionString %>"
SelectCommand="SELECT [Header], [Content], [SidebarLeft], [SidebarRight], [Footer] FROM [PageContent]"
UpdateCommand="UPDATE PageContent SET Header = #Header, [Content] = #Content, SidebarLeft = #SidebarLeft, SidebarRight = #SidebarRight, Footer = #Footer">
<UpdateParameters>
<asp:Parameter Name="Header" />
<asp:Parameter Name="Content" />
<asp:Parameter Name="SidebarLeft" />
<asp:Parameter Name="SidebarRight" />
<asp:Parameter Name="Footer" />
</UpdateParameters>
</asp:SqlDataSource>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
</asp:Content>