Hi all,
I have a tree view that is going to be used for an email application and has all of its folder structure bound from a self referencing database table. When I do my binding I set a node attribute of FolderId to each node on the NodeDataBound event (e.Node.Attributes.Add("FolderId", currentNode["FolderId"].ToString());) so that I can access the FolderId in the code behind.
I have a context menu on the tree view that allows the user to add, rename and delete a folder. This is done on the ContextMenuItemClick event of the context menu and updates the database accordingly. Howerver what I am having problems with is updating the new folder with the new default text of ‘New Folder’ and applying the newly created FolderId from the database when a user clicks the create item in the context menu. The only way I found to do this is to reload the whole menu in again and bind. However this is a very poor solution and with the possability of hundereds of folders performance is likely to suffer and has the addeded annoyence of closing the menu back to the root rather than keeping it open on the selected node.
Is there a way I can click the context menu and create the new folder by adding it to the database. Then updating the newly created folder with its FolderId from the database whilst keeping the menu expanded on the selected node?
Any help with this would be much appreciated.
| <%@ Control Language="C#" AutoEventWireup="true" Inherits="DotNetNuke.Entities.Modules.PortalModuleBase" %> | |
| <%@ Import Namespace="System.Data" %> | |
| <%@ Import Namespace="DotNetNuke" %> | |
| <%@ Import Namespace="DotNetNuke.Security" %> | |
| <%@ Import Namespace="DotNetNuke.Modules" %> | |
| <%@ Register TagName="IQqeqmTag" TagPrefix="IQqeqmPrefix" Src="~/DesktopModules/MBS/iqEquipmentMaintCT.ascx" %> | |
| <%@ Reference Control="~/DesktopModules/MBS/iqEquipmentMaintCT.ascx" %> | |
| <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
| <body> | |
| <div> | |
| <asp:HiddenField ID="iqEQGClientTime" runat="server" /> | |
| </div> | |
| <telerik:RadAjaxManagerProxy ID="RadAjaxManageriq1" runat="server" > | |
| <AjaxSettings > | |
| <telerik:AjaxSetting AjaxControlID="equipmentGrid" > | |
| <UpdatedControls> | |
| <telerik:AjaxUpdatedControl ControlID="equipmentGrid" | |
| LoadingPanelID="RadAjaxLoadingPanel1" /> | |
| <telerik:AjaxUpdatedControl ControlID="RadToolTipGeneralHelp" /> | |
| </UpdatedControls> | |
| </telerik:AjaxSetting> | |
| </AjaxSettings> | |
| </telerik:RadAjaxManagerProxy> | |
| <%-- 090921a --%> | |
| <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"> | |
| <script language="javascript" type="text/javascript"> | |
| function EQGClientTime() { | |
| // alert("scriptmgr clientTime"); | |
| var dte = new Date(); | |
| document.forms[0]['<%=iqEQGClientTime.ClientID%>'].value = dte.toLocaleString(); | |
| //alert(document.forms[0]['<%=iqEQGClientTime.ClientID%>'].value); | |
| } | |
| </script> | |
| </telerik:RadCodeBlock> | |
| <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" | |
| runat="server" Transparency="5"> | |
| <table style="width: 100%; height: 100%;"> | |
| <tr style="height: 100%"> | |
| <td align="center" valign="middle" style="width: 100%"> | |
| <asp:Image ID="Image2" ImageUrl="~/mybodyscience/iqimages/Loading_Images/loading3.gif" | |
| BorderWidth="0px" Height="45px" Width="145px" AlternateText="Processing Data ...." | |
| runat="server"></asp:Image> | |
| </td> | |
| </tr> | |
| </table> | |
| </telerik:RadAjaxLoadingPanel> | |
| <%-- 090818c Removed RadGrid Height=500 --%> | |
| <telerik:RadGrid ID="equipmentGrid" runat="server" AllowPaging="True" | |
| GridLines="none" AutoGenerateDeleteColumn="false" EnableHeaderContextMenu="false" | |
| AutoGenerateColumns="false" OnItemCommand="equipmentGrid_ItemCommand" | |
| OnNeedDataSource="equipmentGrid_NeedDataSource" | |
| Skin="Office2007" OnItemDataBound="equipmentGrid_ItemDataBound" | |
| style="overflow:hidden" | |
| ShowStatusBar="true" ShowFooter="true" Width="398" | |
| OnPreRender="equipmentGrid_PreRender" OnItemCreated="equipmentGrid_ItemCreated"> | |
| <%--090814g00 <FooterStyle Font-Bold="true"/> --%> | |
| <%--090814g00--%> <FooterStyle Font-Bold="true" BackColor="#9AB5DB" /> | |
| <StatusBarSettings LoadingText="Loading ..." ReadyText="Ready ..." /> | |
| <ClientSettings> | |
| <Scrolling AllowScroll="true" /> | |
| <Resizing AllowRowResize="false" EnableRealTimeResize="false" | |
| ResizeGridOnColumnResize="false" ClipCellContentOnResize="false" | |
| AllowColumnResize="true" ></Resizing> | |
| </ClientSettings> | |
| <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" GridLines="None" | |
| HeaderStyle-Wrap="false" | |
| TableLayout="Fixed" AllowSorting="true" | |
| RowIndicatorColumn-Display="false" DataKeyNames="equEquipmentNo"> | |
| <ItemStyle Font-Size="Small" ForeColor="#4E026E" BackColor="#FFE140" /> | |
| <AlternatingItemStyle Font-Size="Small" BackColor="#FFE973" ForeColor="Black" /> | |
| <%-- --%> | |
| <CommandItemTemplate> | |
| <asp:Image ID="Image1" runat="server" ImageUrl="~/mybodyscience/iqimages/iqimage$/iStock_000003163184XSmall.jpg" | |
| Height="135px" Width="100%" /> | |
| <div style="text-align: center; background-color: #996633; color: Blue; font-size: medium"> | |
| <asp:Label ID="capID" runat="server" BackColor="#996633" ForeColor="Yellow" Text="Add or Change Your Equipment Information" /> | |
| <telerik:RadMenu OnClientMouseOut="Mmouseout" OnClientMouseOver="Mmouseover" OnItemClick="RadMenu1_OnItemClick" | |
| ID="RadMenuLine" ExpandAnimation-Type="InOutBack" | |
| CollapseAnimation-Type="InQuad" BorderColor="Brown" | |
| Skin="WebBlue" runat="server" Font-Size="Small" | |
| Width="100%" commandName="MenuCommand" > | |
| <Items> | |
| <telerik:RadMenuItem GroupSettings-ExpandDirection="Up" runat="server" Text="Select View" | |
| PostBack="false" | |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" Style="font-weight: bold"> | |
| <Items> | |
| <telerik:RadMenuItem runat="server" Text="Detail View" CssClass="MenuItemLeft" | |
| BackColor="Yellow" ForeColor="Blue"> | |
| </telerik:RadMenuItem> | |
| <telerik:RadMenuItem runat="server" Text="Summary View" ForeColor="Blue"> | |
| </telerik:RadMenuItem> | |
| <telerik:RadMenuItem runat="server" Text="Print View" NavigateUrl="~/mybodyscience/MBS_Reports/iqReport_Display.aspx" | |
| ForeColor="Blue" BackColor="Yellow" Target="_blank"> | |
| </telerik:RadMenuItem> | |
| </Items> | |
| </telerik:RadMenuItem> | |
| <telerik:RadMenuItem runat="server" Text="Add Equipment" commandName="MAddCommand" | |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" > | |
| </telerik:RadMenuItem> | |
| <telerik:RadMenuItem runat="server" Text="Refresh" | |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" > | |
| </telerik:RadMenuItem> | |
| <telerik:RadMenuItem runat="server" id="Mhelp" Text="Help" commandName="MhelpCommand" | |
| BackColor="Yellow" ForeColor="Brown" Font-Bold="true" Value="88"> | |
| </telerik:RadMenuItem> | |
| </Items> | |
| </telerik:RadMenu> | |
| </div> | |
| </CommandItemTemplate> | |
| <%--090814g00--%> <ItemStyle Font-Size="Small" ForeColor="#4E026E" BackColor="#FFE140" /> | |
| <%--090814g00--%> <AlternatingItemStyle Font-Size="Small" BackColor="#FFE973" ForeColor="Black" /> | |
| <Columns> | |
| <telerik:GridBoundColumn DataField="equMemberNo" HeaderText="MemberNo" ReadOnly="true" | |
| UniqueName="equMemberNo" Visible="false" DataType="System.String"> | |
| </telerik:GridBoundColumn> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentNo" HeaderText="No." HeaderStyle-Width="25px" | |
| HeaderStyle-CssClass="rgHeader NoBorder" | |
| SortExpression="equEquipmentNo" | |
| ItemStyle-CssClass="NoBorder" Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequEquipmentNo" ToolTip="The ID for this Equipment" runat="server" | |
| Text='<%#Eval("equEquipmentNo")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| <FooterTemplate> | |
| </FooterTemplate> | |
| </telerik:GridTemplateColumn> | |
| <%-- TTP Start--%> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentName" HeaderText="Name & Detail" | |
| HeaderStyle-Width="135px" SortExpression="equEquipmentName" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label Font-Underline="true" ID="lblequEquipmentName" runat="server" Text='<%#Eval("equEquipmentName")%>'></asp:Label> | |
| </div> | |
| <telerik:RadToolTip ID="RadToolTip1" runat="server" ManualClose="false" TargetControlID="lblequEquipmentName" | |
| RelativeTo="Mouse" Skin="Outlook" Animation="None" Sticky="true" AutoCloseDelay="3000" | |
| Position="MiddleRight" ToolTip="Name of this Eqip" Height="285" Width="325"> | |
| <div style="background-color: Yellow; font-size: medium; color: Blue; font-weight: bolder"> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="Label7" Text="Equipment Information"> </asp:Label> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="Label6" Text="Name ..:"> </asp:Label> | |
| <asp:TextBox ID="eName" runat="server" TextMode="MultiLine" Width="200px" Rows="1" | |
| Wrap="true" ReadOnly="true" /> | |
| <%-- Equipment .: | |
| <%# DataBinder.Eval(Container, "DataItem.equEquipmentName")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="Label9" Text="Locat ..:"> </asp:Label> | |
| <asp:TextBox ID="eLocation" runat="server" Width="200px" ReadOnly="true" /> | |
| <%-- Equipment .: | |
| <%# DataBinder.Eval(Container, "DataItem.equLocationName")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="Label10" Text="Type ...:"> </asp:Label> | |
| <asp:TextBox ID="eType" runat="server" Width="200px" ReadOnly="true" /> | |
| <%-- Equipment .: | |
| <%# DataBinder.Eval(Container, "DataItem.equTypeName")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow; overflow: hidden; text-overflow: ellipsis; | |
| white-space: nowrap;" ID="labell" Text="Make ...:"> </asp:Label> | |
| <asp:TextBox ID="eMake" runat="server" Width="200px" ReadOnly="true" /> | |
| <%-- Make ......: | |
| <%# DataBinder.Eval(Container, "DataItem.equEquipmentMake")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="lbla" Text="Model .:"> </asp:Label> | |
| <asp:TextBox ID="eModel" runat="server" Width="200px" ReadOnly="true" /> | |
| <%-- Model .....: | |
| <%# DataBinder.Eval(Container, "DataItem.equEquipmentModel")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="Label8" Text="GymID :"> </asp:Label> | |
| <asp:TextBox ID="eGymID" runat="server" Width="200px" ReadOnly="true" /> | |
| <%-- Gym id ....: | |
| <%# DataBinder.Eval(Container, "DataItem.equEquipmentGymID")%>--%> | |
| <br> | |
| <asp:Label runat="server" Style="background-color: Yellow" ID="lblNotes" Text="Notes ..:"> </asp:Label> | |
| <asp:TextBox ID="enotes" runat="server" TextMode="MultiLine" Width="200px" Rows="3" | |
| ReadOnly="true" /> | |
| <br> | |
| <%-- <%# DataBinder.Eval(Container, "DataItem.equEquipmentNotes")%> --%> | |
| Created ...: | |
| <%# DataBinder.Eval(Container, "DataItem.equDateCreated")%> | |
| <br> | |
| Changed .: | |
| <%# DataBinder.Eval(Container, "DataItem.equDateUpdated")%> | |
| <br> | |
| </div> | |
| </telerik:RadToolTip> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <%-- TTP End--%> | |
| <telerik:GridTemplateColumn UniqueName="equLocationName" | |
| HeaderText="Location" HeaderStyle-Width="100px" | |
| SortExpression="equLocationName" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequLocationName" runat="server" ToolTip="The Location of this Equipment" | |
| Text='<%#Eval("equLocationName")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="equTypeName" HeaderText="Type" HeaderStyle-Width="92px" | |
| SortExpression="equTypeName" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequTypeName" runat="server" ToolTip="The Type of this Equipment" | |
| Text='<%#Eval("equTypeName")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentMake" HeaderText="Make" HeaderStyle-Width="92px" | |
| SortExpression="equEquipmentMake" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequEquipmentMake" runat="server" ToolTip="The Make of this Equipment" | |
| Text='<%#Eval("equEquipmentMake")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentModel" HeaderText="Model" HeaderStyle-Width="60px" | |
| SortExpression="equEquipmentModel" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequEquipmentModel" runat="server" ToolTip="The Model of this Equipment" | |
| Text='<%#Eval("equEquipmentModel")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentGymID" HeaderText="GymID" HeaderStyle-Width="60px" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequEquipmentGymID" runat="server" ToolTip="This Facilities ID for this Equipment" | |
| Text='<%#Eval("equEquipmentGymID")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="equEquipmentNotes" HeaderText="Notes" HeaderStyle-Width="60px" | |
| Resizable="true"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="lblequEquipmentNotes" runat="server" ToolTip="Notes about this Equipment" | |
| Text='<%#Eval("equEquipmentNotes")%>'></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridButtonColumn CommandName="Delete" ButtonType="ImageButton" ImageUrl="~/mybodyscience/iqimages/iqimage$/DeleteCan3.gif" | |
| HeaderStyle-Width="25px" Resizable="false" UniqueName="DeleteColumn" ItemStyle-HorizontalAlign="Center"> | |
| <ItemStyle HorizontalAlign="Center" /> | |
| </telerik:GridButtonColumn> | |
| <telerik:GridButtonColumn CommandName="Edit" ButtonType="ImageButton" | |
| ImageUrl="~/mybodyscience/iqimages/iqimage$/Edit2.gif" | |
| HeaderStyle-Width="25px" Resizable="false" UniqueName="iqEditColumn" ItemStyle-HorizontalAlign="Center"> | |
| <ItemStyle HorizontalAlign="Center" /> | |
| </telerik:GridButtonColumn> | |
| <%--090818a LAST COLUMN --%> | |
| <telerik:GridTemplateColumn UniqueName="iqEndOfRecord" HeaderStyle-Width="150px" | |
| Resizable="false"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="n1" runat="server"></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <telerik:GridTemplateColumn UniqueName="iqEndOfRecord2" HeaderStyle-Width="150px" | |
| Resizable="false"> | |
| <ItemTemplate> | |
| <div style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;"> | |
| <asp:Label ID="n2" runat="server"></asp:Label> | |
| </div> | |
| </ItemTemplate> | |
| </telerik:GridTemplateColumn> | |
| <%--090818a LAST COLUMN --%> | |
| </Columns> | |
| <EditFormSettings | |
| UserControlName="~/DesktopModules/MBS/iqEquipmentMaintCT.ascx" | |
| EditFormType="WebUserControl" > | |
| </EditFormSettings> | |
| </MasterTableView> | |
| </telerik:RadGrid> | |
| </table> | |
| <telerik:RadToolTip runat="server" ID="RadToolTip2" Position="Center" HideEvent="LeaveTargetAndToolTip" | |
| Skin="WebBlue" IsClientID="true" Width="300px" OnClientBeforeShow="CheckIfShow" | |
| TargetControlID="btnUpdate"> | |
| <asp:ValidationSummary ID="ValidationSummary1" runat="server" /> | |
| </telerik:RadToolTip> | |
| <telerik:RadToolTip ID="RadToolTipGeneralHelp" runat="server" MouseTrailing="false" | |
| Skin="Outlook" Animation="None" Width="200px" Height="300px" Position="MiddleRight" | |
| OnClientHide="iqclearTooltip" OnAjaxUpdate="onAjaxThen"> | |
| <p style="text-align: center"> | |
| <b> My Body Science </b> <br /> | |
| <b>Exercise Equipment Help </b> | |
| </p> | |
| <p style="text-align: left"> | |
| <b>Select View</b> - Move the mouse here to change what screen you need to view.<br /> | |
| <b><em>Detail View</em></b> - Shows all data for all rows.<br /> | |
| <b><em>Summary View</em></b> - Shows Primary data for each row.<br /> | |
| <b><em>Print View</em></b> - Runs a report that can be printed and/or translated to other formats including excel. | |
| </p> | |
| <p style="text-align: left"> | |
| <b>Add New Equipment</b> - Click here to add additional Equipment that you use for | |
| Exercise. | |
| </p> | |
| <p style="text-align: left"> | |
| <b>Refresh List</b> - Click here to view the list of Equipment from the beginning. | |
| </p> | |
| <p style="text-align: left"> | |
| <img style="border: 0px" alt="" src="../iqimages/iqimage$/DeleteCan3.gif" /> | |
| - Click here to permanently Delete this piece of Equipment from your list. | |
| </p> | |
| <p style="text-align: left"> | |
| <img style="border: 0px" alt="" src="../iqimages/iqimage$/Edit2.gif" /> | |
| - Click here to change the information about this piece of Equipment. | |
| </p> | |
| <p style="text-align: left"> | |
| <b>Name & Detail</b> - Position your mouse over the Name of the Equipment to see | |
| its<br> | |
| Detail Information. | |
| </p> | |
| <p style="text-align: left"> | |
| <b>Sorting</b> - Click the heading for either No, Name & Description, | |
| LocationName, Type, Make or Model. Click Refresh to reset.<br> | |
| </p> | |
| <p style="text-align: left"> | |
| <img style="border: 0px" alt="" src="../iqimages/iqimage$/Help.gif" /> | |
| - This is the <b>HELP link</b>. Click here to see additional help topics when available.<br> | |
| </p> | |
| </telerik:RadToolTip> | |
| </body> | |
| </html> | |
Error: Sys.InvalidOperationException: Two components with the same id 'xxx' can't be added to the application.
This is a conceptual problem in RadDock. You can reproduce it by creating a simple page, containing the following markup:
<asp:updatepanel runat="server" id="UpdatePanel1">
<contenttemplate>
<telerik:raddockzone id="RadDockZone1" runat="server">
<telerik:raddock id="RadDock1" runat="server" autopostback="true" dockmode="docked">
<telerik:raddock>
<telerik:raddock id="RadDock2" runat="server" autopostback="true" dockmode="docked">
<telerik:raddock>
</telerik:raddockzone>
</contenttemplate>
</asp:updatepanel>
Now, grab one of the RadDock controls and drag it. When you are dropping it, if you are fast enough and you succeed to grab the other RadDock control without dropping, you will be able to get the exception. On localhost this is quite hard to be fast enough, but on production sites it should be relatively easy for the fastclickers.
The problem is related to the fact, that when you grab a RadDock control its HTML element is detached from its parent. When you drop a dock, it initiates a postback because of the AutoPostBack property (converted to AJAX call by the UpdatePanel), the UpdatePanel is updated and since on the server it contains the grabbed RadDock control, it adds it to its HTML. On the client it does not contain HTML element for the grabbed dock, its client-side object is not disposed and newly added dock generates the exception.
Workaround: use UpdatePanel controls with UpdateMode=Conditional. When you are adding/removing RadDock controls from the zone call the UpdatePanel's Update() method to force it to refresh its content. When you are just moving the docks don't call the Update() method and you will avoid the exception.
This is the only way we were able to reproduce this problem until now. If you can reproduce using different steps, please, open a new support ticket and send us a simple application. I will try to find a workaround or a solution ASAP.
Valeri Hristov
| function updateGridCred(result) { |
| var masterTable = $find("<%= gridCred.ClientID %>").get_masterTableView(); |
| masterTable.set_virtualItemCount(result); |
| masterTable.clearSelectedItems(); |
| masterTable.set_dataSource(result); |
| masterTable.dataBind(); |
| $('#divCred').show(); |
| } |
| <telerik:RadGrid ID="gridCred" runat="server" |
| AllowSorting="true" |
| AutoGenerateColumns="false" |
| Width="381" |
| > |
| <ItemStyle Wrap="false" /> |
| <MasterTableView |
| TableLayout="Fixed" |
| AllowAutomaticDeletes="true" |
| EnableColumnsViewState="false" |
| ClientDataKeyNames="CredentialOrganizationId" |
| DataKeyNames="CredentialOrganizationId" |
| > |
| <Columns> |
| <telerik:GridBoundColumn DataField="OrganizationType" UniqueName="OrganizationType" HeaderText="Type"> |
| <HeaderStyle Width="25px" HorizontalAlign="Center" /> |
| <ItemStyle Width="25px" HorizontalAlign="Center" /> |
| </telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="OrganizationName" UniqueName="OrganizationName" HeaderText="Organization Name" /> |
| <telerik:GridBoundColumn DataField="DistrictName" UniqueName="DistrictName" HeaderText="District" /> |
| <telerik:GridClientDeleteColumn ConfirmText="Are you sure you want to delete the selected row?" HeaderStyle-Width="35px" ButtonType="ImageButton" /> |
| </Columns> |
| </MasterTableView> |
| <ClientSettings> |
| <DataBinding |
| EnableCaching="false" |
| Location="UserAdmin.aspx" |
| SelectMethod="GetCredentialsAndCount" |
| CountPropertyName="Count" |
| DataPropertyName="Data" |
| StartRowIndexParameterName="startRowIndex" |
| MaximumRowsParameterName="maximumRows" |
| FilterParameterType="Linq" |
| FilterParameterName="filterExpression" |
| SortParameterType="Linq" |
| SortParameterName="sortExpression" |
| /> |
| <Selecting AllowRowSelect="true" /> |
| <ClientEvents OnCommand="gridCred_OnCommand" OnRowSelected="gridCred_CredSelected" /> |
| </ClientSettings> |
| </telerik:RadGrid> |
| [WebMethod] |
| public static Dictionary<string, Object> GetCredentialsAndCount(int startRowIndex, int maximumRows, string sortExpression, string filterExpression, string CredentialId) |
| { |
| var page = new Apps_UserAdmin(); |
| var dc = page.PageCachedContext.DC; |
| var filter = !String.IsNullOrEmpty(filterExpression); |
| var sort = !String.IsNullOrEmpty(sortExpression); |
| var credId = CredentialId; |
| // have to instantiate the object because static |
| var query = (from co in dc.CredentialOrganizations |
| join tsch in dc.Schools on co.OrganizationId equals tsch.OrganizationId |
| into tschs |
| from s in tschs.DefaultIfEmpty() |
| where co.CredentialId == Convert.ToInt64(credId) |
| orderby co.Organization.Type, s.District.Organization.Name, co.Organization.Name |
| select new |
| { |
| DistrictName = s.District.Organization.Name, |
| OrganizationType = co.Organization.Type, |
| CredentialId = co.CredentialId, |
| CredentialOrganizationId = co.CredentialOrganizationId, |
| OrganizationName = co.Organization.Name, |
| ImageType = ((PinnacleEnums.OrganizationType)Enum.ToObject(typeof(PinnacleEnums.OrganizationType), Convert.ToInt32(co.Organization.Type))).ToString(), |
| }); |
| if (filter) |
| { |
| query = query.Where(filterExpression); |
| } |
| if (sort) |
| { |
| query = query.OrderBy(sortExpression); |
| } |
| var count = query.Count(); |
| var finalItems = query.Skip(startRowIndex).Take(maximumRows); |
| return new Dictionary<string, object> { { "Data", finalItems }, { "Count", count } }; |
| } |
protected override void CreateChildControls()
{
base.CreateChildControls();
editor =
new RadEditor();
editor.Editable =
true;
//editor.StripFormattingOnPaste = EditorStripFormattingOptions.MSWordRemoveAll;// "All";
editor.ToolsFile =
"/radcontrols/editor/ToolsDataFile.xml";
editor.RadControlsDir =
"/radcontrols/";
//UseFixedToolbar=false;
editor.ShowPreviewMode =
false;
editor.ShowSubmitCancelButtons =
false;
editor.SaveInFile =
false;
editor.ImagesFilters =
new string[] { "*.gif", "*.jpg", "*.png" };
editor.MaxDocumentSize = 5120000;
editor.ShowHtmlMode =
false;
editor.EnableContextMenus =
true;
editor.ConvertToXhtml =
false;
editor.Width =
new Unit(100, UnitType.Pixel);
editor.Height =
new Unit(200, UnitType.Pixel);
editor.ShowHtmlMode =
true;
editor.ID =
string.Concat(ID, "_Editor");
//editor.ClientID = this.ClientID + "_Editor";
editor.StripFormattingOnPaste =
EditorStripFormattingOptions.All;
//editor.ContextMenus.
//editor.OnClientLoad = "onEditorload";
Controls.Add(editor);
limiter =
new CharLimitValidator();
limiter.ID =
string.Concat(ID, "_Limiter");
limiter.ControlToValidate = editor.ID;
Controls.Add(limiter);
I need to give get_html value outside this control.
I try to following :
HtmlGenericControl js = new HtmlGenericControl("script");
js.Attributes.Add(
"language", "javascript");
js.InnerHtml +=
"var editor" + ClientID + " = $find('" + editor.ClientID + "');";
js.InnerHtml +=
this.ClientID + ".get_html = function () { return editor" + ClientID + ".get_text(); }";
//js.InnerHtml = this.ClientID + ".get_html = function () { return 'fff'; }";
Controls.Add(js);
but this code can't find this editor. Why? Please, help me
