Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

cuteeditor not support the codebehind to set value of AjaxMethod? I thought cuteeditor should provide the refresh or reload function?

Last post 07-21-2009, 9:00 AM by GeoffreyRen. 7 replies.
Sort Posts: Previous Next
  •  07-20-2009, 11:13 AM 54103

    cuteeditor not support the codebehind to set value of AjaxMethod? I thought cuteeditor should provide the refresh or reload function?

         I have a code save the cuteeditor.Text to sql database. I need to retrive the context from DB to show in the cuteeditor(for modify the context) when I opened the details window. I implement the function by codebehind mode and not javascript(setHtml()).  But the context not show at all. For example:
                   [AjaxMethod]
                  public void showDetail()
                   {
                              this.editor1.Text = article.Context;  //article was a object
                   }
     
         I need your help!
     
         Thanks!
  •  07-20-2009, 11:46 AM 54106 in reply to 54103

    Re: cuteeditor not support the codebehind to set value?

    GeoffreyRen,
     
    Cute Editor supports the codebehind to set value.
     
    Please post more code or check the following example:
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  07-20-2009, 12:10 PM 54113 in reply to 54106

    Re: cuteeditor not support the codebehind to set value?

    Sorry! the code logic was complicated.  I don't know how to show it.
     
    1. parent window include a grid to show the article list;
    2. Client click one record(call AjaxMethod ), Pop up details window to show the record infomation.
    3. I wrote the code in AjaxMethod set the value for each controller(including the cuteEditor).
     
     
    How to refresh the cuteeditor context if I used AjaxMethod to set value.
    For example:
            the cuteeditor included similar this.Editor1.reload() method? 
     
     
    Thanks!
  •  07-20-2009, 12:30 PM 54117 in reply to 54106

    The following was the parent window code:

    <%@ Page Language="C#" MasterPageFile="~/Manager/MasterPage/PageTemplate.Master" AutoEventWireup="true" CodeBehind="Render.aspx.cs" Inherits="FrameWork.web.Manager.Module.Information.InfoUp.Render" %>

    <%@ Import Namespace="System.Collections.Generic" %>

    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register Src="~/Manager/controls/WindowEditor.ascx" TagName="WindowEditor" TagPrefix="uc1" %>

    <asp:Content ID="Content1" ContentPlaceHolderID="PageBody" runat="server">
        <script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Manager/inc/FineMessBox/js/common.js"></script>
        <script type="text/javascript" src="<%=Page.ResolveUrl("~/") %>Manager/inc/FineMessBox/js/subModal.js"></script>
       
        <script type="text/javascript">
            var InfoDetailsRender = function() {
                return '<img class="imgEdit" ext:qtip="Click to view/edit additional details" style="cursor:pointer;" src="vcard_edit.png" />';
            }

            var cellClick = function(grid, rowIndex, columnIndex, e) {
                var t = e.getTarget();
                var record = grid.getStore().getAt(rowIndex);  // Get the Record
                var columnId = grid.getColumnModel().getColumnId(columnIndex); // Get column id

                if (t.className == 'imgEdit' && columnId == 'Context') {
                    //the ajax event allowed
                    //openInfoDetails(record, t);
                    return true;
                }

                //forbidden
                return false;
            }
            
        </script>
        <ext:ScriptManager ID="ScriptManager1" runat="server" />       
           
        <ext:Store ID="Store1" runat="server">
           
            <Reader>
                <ext:JsonReader ReaderID="ArticleID">
                    <Fields>
                        <ext:RecordField Name="ArticleID" Type="Int"/>
                        <ext:RecordField Name="Title" />
                        <ext:RecordField Name="Author" />
                        <ext:RecordField Name="Context" />
                        <ext:RecordField Name="Run_Date" Type="Date" />
                        <ext:RecordField Name="Up_GroupID" Type="Int" />
                        <ext:RecordField Name="LabelID" Type="Int" />
                        <ext:RecordField Name="Up_GroupName" />
                        <ext:RecordField Name="ShowDate" Type="Date" />
                        <ext:RecordField Name="Modify_Date" Type="Date" />
                        <ext:RecordField Name="Context" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
        </ext:Store>
       
        <ext:ViewPort ID="ViewPort1" runat="server">
            <Body>
                <ext:FitLayout ID="FitLayout1" runat="server">
                    <ext:GridPanel
                        ID="ArticleList"
                        runat="server"
                        StoreID="Store1"
                        StripeRows="true"
                        Header="false"
                        Border="false"
                        AutoExpandColumn="Title" AutoWidth="true" Height="600">
                        <LoadMask ShowMask="false" />
                                           
                        <SelectionModel>
                            <ext:CheckboxSelectionModel HideCheckAll="true" ID="CheckboxSelectionModel1" runat="server" MoveEditorOnEnter="true" />
                        </SelectionModel>       
                        <ColumnModel ID="ColumnModel1" runat="server">
                            <Columns>
                                <ext:Column
                                    ColumnID="Title"
                                    Header="信息标题" 
                                    Width="300" 
                                    Sortable="true"
                                    DataIndex="Title"
                                    />
                                   
                                <ext:Column
                                    ColumnID="Up_GroupName"
                                    Header="报送部门"
                                    Width="120"
                                    Sortable="true"
                                    DataIndex="Name"
                                    />
                                <ext:Column
                                    ColumnID="ShowDate"
                                    Header="上报时间"
                                    Width="120"
                                    Sortable="true"
                                    DataIndex="ShowDate">
                                    <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
                                </ext:Column>
                                <ext:Column
                                    ColumnID="Modify_Date"
                                    Header="修改时间"
                                    Width="80"
                                    Sortable="true"
                                    DataIndex="Modify_Date">
                                    <Renderer Fn="Ext.util.Format.dateRenderer('Y-m-d')" />
                                </ext:Column>
                               
                                <ext:Column
                                    ColumnID="Context"
                                    Header="详细信息" 
                                    Width="50" 
                                    Sortable="true"
                                    DataIndex="Context"
                                    >
                                    <Renderer Fn="InfoDetailsRender" />
                                    </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <Plugins>
                            <ext:GridFilters runat="server" ID="GridFilters1" Local="true">
                                <Filters>
                                    <ext:StringFilter DataIndex="Title" />
                                    <ext:StringFilter DataIndex="Up_GroupName" />
                                    <ext:DateFilter DataIndex="Show_Date">
                                        <DatePickerOptions runat="server" TodayText="Now" />
                                    </ext:DateFilter>
                                    <ext:DateFilter DataIndex="Modify_Date">
                                        <DatePickerOptions runat="server" TodayText="Now" />
                                    </ext:DateFilter>                       
                                </Filters>
                            </ext:GridFilters>
                        </Plugins>
                        <BottomBar>
                            <ext:PagingToolBar
                                ID="PagingToolBar1"
                                runat="server"
                                StoreID="Store1"
                                PageSize="10"
                                DisplayInfo="true"
                                DisplayMsg="草案箱 {0} - {1} of {2}"
                                />
                        </BottomBar>
                        <Listeners>
                            <CellClick Fn="cellClick" />
                        </Listeners> 
                        <AjaxEvents>
                            <CellClick OnEvent="ShowDetails" Failure="Ext.MessageBox.alert('Load failed', 'Error during ajax event!');">
                                <EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{ArticleList}.body}" />
                                <ExtraParams>
                                    <ext:Parameter Name="id" Value="params[0].getStore().getAt(params[1]).id" Mode="Raw" />
                                </ExtraParams>
                            </CellClick>
                        </AjaxEvents>   
                    </ext:GridPanel>
                   
                </ext:FitLayout>
                <uc1:WindowEditor ID="WindowEditor1" runat="server" />
            </Body>
        </ext:ViewPort>
       
    </asp:Content>
     
     
     
     

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections.Generic;
    using System.Collections;
    using System.Web.SessionState;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;

    using FrameWork;
    using FrameWork.Components;
    using FrameWork.WebControls;

    using com.tsingdai.Model;
    using com.tsingdai.Common;
    using com.tsingdai.Service;

    using Coolite.Ext.Web;

    namespace FrameWork.web.Manager.Module.Information.InfoUp
    {
        public partial class Render : PageBase
        {
            private static readonly ArticleService _articleService = ArticleService.GetInstance();

            private static readonly LabelService _labelService = LabelService.GetInstance();

            int groupID = (int)Common.sink("GroupID", MethodType.Get, 50, 0, DataType.Int);
            int labelID = (int)Common.sink("LabelID", MethodType.Get, 50, 0, DataType.Int);
            string status = Common.sink("status", MethodType.Get, 50, 0, DataType.Str).ToString();

            protected void Page_Load(object sender, EventArgs e)
            {
                InitPage();

                if (!Ext.IsAjaxRequest)
                {
                    BindData();
                }
            }

            protected void BindData()
            {
                IList labelList = null;
                if (labelID == 0)
                {
                    labelList = _labelService.GetLabelListByGroupID(groupID);

                    if (labelList.Count > 0)
                    {
                        foreach (com.tsingdai.Model.Label lab in labelList)
                        {
                            //ShowData(label);
                        }
                    }
                }
                else
                {
                    labelList = _labelService.GetLabelListByGroupID(groupID);
                }
                Article article = new Article();
                com.tsingdai.Model.Label label = _labelService.GetLabel(labelID);

                article.InitArticle(groupID, label);

                IList draftList = null;
                switch (status)
                {
                    case "Draft":
                        draftList = _articleService.GetDraftListByLabelID(article);
                        break;
                    case "Report":
                        draftList = _articleService.GetReportListByLabelID(article);
                        break;
                    case "Adopt":
                        draftList = _articleService.GetAdoptListByLabelID(article);
                        break;
                    case "Publish":
                        draftList = _articleService.GetPublishListByLabelID(article);
                        break;
                    default:
                        draftList = _articleService.GetDraftListByLabelID(article);
                        break;
                }
               

                Store1.DataSource = draftList;
                Store1.DataBind();
            }

            # region AjaxMethod

            protected void ShowDetails(object sender, AjaxEventArgs e)
            {
                string id = e.ExtraParams["id"];

                ((WindowEditor)WindowEditor1).SetInfo(_articleService.GetArticle(Int32.Parse(id)));
                ((WindowEditor)WindowEditor1).Show();
            }

            # endregion
        }
    }

  •  07-20-2009, 12:32 PM 54118 in reply to 54106

    The following was the child window code:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WindowEditor.ascx.cs" Inherits="WindowEditor" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register assembly="CuteEditor" namespace="CuteEditor" tagprefix="CE" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %>
    <%@ Register TagPrefix="radU" Namespace="Telerik.WebControls" Assembly="RadUpload.Net2" %>

    <%@ Import Namespace="FrameWork" %>
    <%@ Import Namespace="FrameWork.Components" %>
    <%@ Import Namespace="FrameWork.WebControls" %>
    <%@ Import Namespace="Telerik.WebControls" %>
    <%@ Import Namespace="com.tsingdai.Model" %>
    <%@ Import Namespace="com.tsingdai.Common" %>
    <%@ Import Namespace="com.tsingdai.Service" %>

    <script type="text/javascript">  
        var openInfoDetails = function (context, animTrg) {
            var editor = document.getElementById('<%=Editor1.ClientID %>');    //JavaScript方法
            if (context != null)
            {
                   editor.setHTML(context);
            }
           
            window.show(animTrg);
        }   
       
        rnd.today = new Date();

        rnd.seed = rnd.today.getTime();

        function rnd() {
            rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
            return rnd.seed / (233280.0);

        };

        function rand(number) {
            return Math.ceil(rnd() * number);

        };
        function AlertMessageBox(file_name)
        {
            if (file_name!=undefined){
                var ShValues = file_name.split('||');
                if (ShValues[1]!=0)
                {
                    document.all.<%=this.U_GroupID.ClientID %>.value=ShValues[1];
                    document.all.<%=this.Publisher.ClientID %>.value=ShValues[0];
                }           
            }    
        }
        function ShowDepartID() {
           showPopWin('选择部门', '../../FrameWork/SystemApp/UserManager/SelectGroup.aspx?' + rand(10000000), 215, 255, AlertMessageBox, true, true)
        }
    </script>
    <ext:TextField ID="U_GroupID" DataIndex="U_GroupID" runat="server" Hidden="true" />
    <ext:TextField ID="ArticleID" DataIndex="ArticleID" runat="server" Hidden="true" />
    <ext:Store runat="server" ID="LabelStore" AutoLoad="false" OnRefreshData="LabelRefresh">
        <Reader>
            <ext:JsonReader>
               <Fields>
                    <ext:RecordField Name="ID" Type="Int" />
                    <ext:RecordField Name="GroupID" Type="Int" />
                    <ext:RecordField Name="Label_Name" />
                    <ext:RecordField Name="G_CName" />
                    <ext:RecordField Name="SeqNo" Type="Int" />
                    <ext:RecordField Name="Description" />
                    <ext:RecordField Name="Extend_Field1" />
                    <ext:RecordField Name="Extend_Field2" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Listeners>
            <Load Handler="if (#{LabelName}.store.getAt(0).get('ID')){#{LabelName}.setValue(#{LabelName}.store.getAt(0).get('ID'));}" />
        </Listeners> 
    </ext:Store>

    <ext:Window ID="InfoDetailsWindow" runat="server" Icon="Group" Title="信息明细"
        Width="800" Height="480" AutoShow="false" Modal="true" ShowOnLoad="false" AutoScroll="true">
        <Body>
            <ext:FitLayout ID="FitLayout1" runat="server">
                <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Border="false">
                    <Tabs>
                        <ext:Tab
                            ID="InfoTab"
                            runat="server"
                            Title="基本信息"
                            Icon="ChartOrganisation"
                            BodyStyle="padding:5px;">
                            <Body>
                                <ext:FormLayout ID="FormLayout1" runat="server">
                                    <ext:Anchor>
                                        <ext:TextField
                                            ID="Title"
                                            runat="server"
                                            FieldLabel="信息标题"
                                            AllowBlank="false"
                                            Width="500"
                                            BlankText="信息标题必须输入!"
                                             />
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:TextField
                                            ID="Author"
                                            runat="server"
                                            AllowBlank="false"
                                            FieldLabel="撰稿人员"
                                            Width="200"
                                            BlankText="撰稿人员必须输入!"/>
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:DateField
                                            ID="RunDate"
                                            AllowBlank="false"
                                            runat="server"
                                            FieldLabel="活动日期"
                                            BlankText="活动日期必须输入!"
                                            />
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:TriggerField
                                            ID="Publisher"
                                            runat="server"
                                            Width="200"
                                            AllowBlank="false"
                                            EmptyText="请点击选择发布单位 -->" FieldLabel="发布单位" ReadOnly="true" BlankText="发布单位必需选择!">
                                            <Triggers>
                                                <ext:FieldTrigger IconCls="custom-trigger" />
                                            </Triggers>
                                            <Listeners>
                                                <TriggerClick Handler="ShowDepartID();#{LabelName}.clearValue();" />
                                            </Listeners>
                                        </ext:TriggerField>
                                           
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:ComboBox ID="LabelName" FieldLabel="标签名称" runat="server" StoreID="LabelStore" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All"  DisplayField="Label_Name"
                                            ValueField="ID"
                                            EmptyText="请查询后选择标签名称 -->"
                                            ValueNotFoundText="该单位没有标签,重新选择单位 -->" StyleSpec="text-align:left;" Hidden="false" Width="200" ReadOnly="true" AllowBlank="false" BlankText="标签名称必需选择!">
                                            <Triggers>       
                                                <ext:FieldTrigger Icon="Search"  />   
                                            </Triggers>   
                                            <Listeners>       
                                                <TriggerClick Handler="#{LabelName}.clearValue();#{LabelStore}.reload();" />   
                                            </Listeners>
                                         </ext:ComboBox>
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:Panel ID="Panel7" runat="server" Title="正文内容:" BodyBorder="true" Width="800" Height="260" AutoScroll="true">
                                            <Body>
                                                <CE:Editor
                                                    ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/Sample.config"
                                                    ID="Editor1"
                                                    runat="server"
                                                    Width="780"
                                                    ResizeMode="AutoAdjust"
                                                    UseStandardDialog="true"
                                                    Height="210"
                                                    />
                                            </Body>
                                        </ext:Panel>
                                    </ext:Anchor>
                                </ext:FormLayout>
                            </Body>
                        </ext:Tab>
                        <ext:Tab
                            ID="AttachementTab"
                            runat="server"
                            Title="附件列表"
                            Icon="User"
                            BodyStyle="padding:5px;">
                            <Body>
                                <ext:FormLayout ID="FormLayout2" runat="server">
                                    <ext:Anchor>
                                        <ext:Panel ID="Panel8" runat="server" Title="" Header="false" BodyBorder="true" Height="350" AutoScroll="true">
                                            <Body>
                                                <radu:radprogressmanager id="Radprogressmanager1" Width="100%" runat="server" />
                                                <radu:radprogressarea id="progressArea1" Width="100%" runat="server" Height="100" Language="zh-cn" />
                                                <radU:RadUpload ID="upload1" runat="server" OverwriteExistingFiles="true" Language="zh-cn" Skin="Vista"/>
                                            </Body>
                                        </ext:Panel>   
                                    </ext:Anchor>
                                </ext:FormLayout>                           
                            </Body>
                        </ext:Tab>
                    </Tabs>               
                </ext:TabPanel>
            </ext:FitLayout>
        </Body>
        <Buttons>
            <ext:Button ID="SaveButton" runat="server" Text="保存" Icon="Disk">
               <Listeners>
                    <Click Handler="saveEmployee();" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="CancelButton" runat="server" Text="返回" Icon="Cancel">
                <Listeners>
                    <Click Handler="#{InfoDetailsWindow}.hide(null);" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>

     
     

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections.Generic;
    using System.Collections;
    using System.Web.SessionState;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;

    using FrameWork;
    using FrameWork.Components;
    using FrameWork.WebControls;

    using com.tsingdai.Model;
    using com.tsingdai.Common;
    using com.tsingdai.Service;

    using Coolite.Ext.Web;

    public partial class WindowEditor : System.Web.UI.UserControl
    {
        private static readonly ArticleService _articleService = ArticleService.GetInstance();

        private static readonly LabelService _labelService = LabelService.GetInstance();

        public string context = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                InitCuteEditor();
            }
        }

        public void Show()
        {
            this.InfoDetailsWindow.Show();
        }

        # region cuteditor文本编辑控件初始化

        protected void InitCuteEditor()
        {
            Editor1.Setting["CuteEditorFileStorageType"] = typeof(SqlFileStorage).AssemblyQualifiedName;
            Editor1.Setting["DownFile"] = ResolveUrl("DownFile.Aspx");
            Editor1.SetSecurityGalleryPath("/");
            //Editor1. = "type here";
        }

        # endregion

        # region 根据选择的单位,刷新标签名称列表

        protected void LabelRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            int groupID = Int32.Parse(this.U_GroupID.Text);
            IList labelList = _labelService.GetLabelListByGroupID(groupID);
            LabelStore.DataSource = labelList;
            LabelStore.DataBind();
        }

        # endregion

        public void SetInfo(Article article)
        {
            this.ArticleID.Text = article.ArticleID.ToString();
            this.Title.Text = article.Title;

            this.Author.Text = article.Author;
            this.RunDate.Value = article.Run_Date;

            sys_GroupTable groupObj = BusinessFacade.sys_GroupDisp(article.GroupID);
            this.U_GroupID.Text = article.GroupID.ToString();
            this.Publisher.SetValue(groupObj.G_CName);
            IList labelList = _labelService.GetLabelListByGroupID(article.GroupID);
            this.LabelStore.DataSource = labelList;
            this.LabelStore.DataBind();
            this.LabelName.SetValue(article.Label.ID);

            this.Editor1.Text = article.Context;
        }
    }

  •  07-20-2009, 12:32 PM 54119 in reply to 54106

    The following was the child window code:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WindowEditor.ascx.cs" Inherits="WindowEditor" %>
    <%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
    <%@ Register assembly="CuteEditor" namespace="CuteEditor" tagprefix="CE" %>
    <%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" Assembly="Telerik.QuickStart" %>
    <%@ Register TagPrefix="radU" Namespace="Telerik.WebControls" Assembly="RadUpload.Net2" %>

    <%@ Import Namespace="FrameWork" %>
    <%@ Import Namespace="FrameWork.Components" %>
    <%@ Import Namespace="FrameWork.WebControls" %>
    <%@ Import Namespace="Telerik.WebControls" %>
    <%@ Import Namespace="com.tsingdai.Model" %>
    <%@ Import Namespace="com.tsingdai.Common" %>
    <%@ Import Namespace="com.tsingdai.Service" %>

    <script type="text/javascript">  
        var openInfoDetails = function (context, animTrg) {
            var editor = document.getElementById('<%=Editor1.ClientID %>');    //JavaScript方法
            if (context != null)
            {
                   editor.setHTML(context);
            }
           
            window.show(animTrg);
        }   
       
        rnd.today = new Date();

        rnd.seed = rnd.today.getTime();

        function rnd() {
            rnd.seed = (rnd.seed * 9301 + 49297) % 233280;
            return rnd.seed / (233280.0);

        };

        function rand(number) {
            return Math.ceil(rnd() * number);

        };
        function AlertMessageBox(file_name)
        {
            if (file_name!=undefined){
                var ShValues = file_name.split('||');
                if (ShValues[1]!=0)
                {
                    document.all.<%=this.U_GroupID.ClientID %>.value=ShValues[1];
                    document.all.<%=this.Publisher.ClientID %>.value=ShValues[0];
                }           
            }    
        }
        function ShowDepartID() {
           showPopWin('选择部门', '../../FrameWork/SystemApp/UserManager/SelectGroup.aspx?' + rand(10000000), 215, 255, AlertMessageBox, true, true)
        }
    </script>
    <ext:TextField ID="U_GroupID" DataIndex="U_GroupID" runat="server" Hidden="true" />
    <ext:TextField ID="ArticleID" DataIndex="ArticleID" runat="server" Hidden="true" />
    <ext:Store runat="server" ID="LabelStore" AutoLoad="false" OnRefreshData="LabelRefresh">
        <Reader>
            <ext:JsonReader>
               <Fields>
                    <ext:RecordField Name="ID" Type="Int" />
                    <ext:RecordField Name="GroupID" Type="Int" />
                    <ext:RecordField Name="Label_Name" />
                    <ext:RecordField Name="G_CName" />
                    <ext:RecordField Name="SeqNo" Type="Int" />
                    <ext:RecordField Name="Description" />
                    <ext:RecordField Name="Extend_Field1" />
                    <ext:RecordField Name="Extend_Field2" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <Listeners>
            <Load Handler="if (#{LabelName}.store.getAt(0).get('ID')){#{LabelName}.setValue(#{LabelName}.store.getAt(0).get('ID'));}" />
        </Listeners> 
    </ext:Store>

    <ext:Window ID="InfoDetailsWindow" runat="server" Icon="Group" Title="信息明细"
        Width="800" Height="480" AutoShow="false" Modal="true" ShowOnLoad="false" AutoScroll="true">
        <Body>
            <ext:FitLayout ID="FitLayout1" runat="server">
                <ext:TabPanel ID="TabPanel1" runat="server" ActiveTabIndex="0" Border="false">
                    <Tabs>
                        <ext:Tab
                            ID="InfoTab"
                            runat="server"
                            Title="基本信息"
                            Icon="ChartOrganisation"
                            BodyStyle="padding:5px;">
                            <Body>
                                <ext:FormLayout ID="FormLayout1" runat="server">
                                    <ext:Anchor>
                                        <ext:TextField
                                            ID="Title"
                                            runat="server"
                                            FieldLabel="信息标题"
                                            AllowBlank="false"
                                            Width="500"
                                            BlankText="信息标题必须输入!"
                                             />
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:TextField
                                            ID="Author"
                                            runat="server"
                                            AllowBlank="false"
                                            FieldLabel="撰稿人员"
                                            Width="200"
                                            BlankText="撰稿人员必须输入!"/>
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:DateField
                                            ID="RunDate"
                                            AllowBlank="false"
                                            runat="server"
                                            FieldLabel="活动日期"
                                            BlankText="活动日期必须输入!"
                                            />
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:TriggerField
                                            ID="Publisher"
                                            runat="server"
                                            Width="200"
                                            AllowBlank="false"
                                            EmptyText="请点击选择发布单位 -->" FieldLabel="发布单位" ReadOnly="true" BlankText="发布单位必需选择!">
                                            <Triggers>
                                                <ext:FieldTrigger IconCls="custom-trigger" />
                                            </Triggers>
                                            <Listeners>
                                                <TriggerClick Handler="ShowDepartID();#{LabelName}.clearValue();" />
                                            </Listeners>
                                        </ext:TriggerField>
                                           
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:ComboBox ID="LabelName" FieldLabel="标签名称" runat="server" StoreID="LabelStore" TypeAhead="true" Mode="Local" ForceSelection="true" TriggerAction="All"  DisplayField="Label_Name"
                                            ValueField="ID"
                                            EmptyText="请查询后选择标签名称 -->"
                                            ValueNotFoundText="该单位没有标签,重新选择单位 -->" StyleSpec="text-align:left;" Hidden="false" Width="200" ReadOnly="true" AllowBlank="false" BlankText="标签名称必需选择!">
                                            <Triggers>       
                                                <ext:FieldTrigger Icon="Search"  />   
                                            </Triggers>   
                                            <Listeners>       
                                                <TriggerClick Handler="#{LabelName}.clearValue();#{LabelStore}.reload();" />   
                                            </Listeners>
                                         </ext:ComboBox>
                                    </ext:Anchor>
                                   
                                    <ext:Anchor>
                                        <ext:Panel ID="Panel7" runat="server" Title="正文内容:" BodyBorder="true" Width="800" Height="260" AutoScroll="true">
                                            <Body>
                                                <CE:Editor
                                                    ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/AutoConfigure/Sample.config"
                                                    ID="Editor1"
                                                    runat="server"
                                                    Width="780"
                                                    ResizeMode="AutoAdjust"
                                                    UseStandardDialog="true"
                                                    Height="210"
                                                    />
                                            </Body>
                                        </ext:Panel>
                                    </ext:Anchor>
                                </ext:FormLayout>
                            </Body>
                        </ext:Tab>
                        <ext:Tab
                            ID="AttachementTab"
                            runat="server"
                            Title="附件列表"
                            Icon="User"
                            BodyStyle="padding:5px;">
                            <Body>
                                <ext:FormLayout ID="FormLayout2" runat="server">
                                    <ext:Anchor>
                                        <ext:Panel ID="Panel8" runat="server" Title="" Header="false" BodyBorder="true" Height="350" AutoScroll="true">
                                            <Body>
                                                <radu:radprogressmanager id="Radprogressmanager1" Width="100%" runat="server" />
                                                <radu:radprogressarea id="progressArea1" Width="100%" runat="server" Height="100" Language="zh-cn" />
                                                <radU:RadUpload ID="upload1" runat="server" OverwriteExistingFiles="true" Language="zh-cn" Skin="Vista"/>
                                            </Body>
                                        </ext:Panel>   
                                    </ext:Anchor>
                                </ext:FormLayout>                           
                            </Body>
                        </ext:Tab>
                    </Tabs>               
                </ext:TabPanel>
            </ext:FitLayout>
        </Body>
        <Buttons>
            <ext:Button ID="SaveButton" runat="server" Text="保存" Icon="Disk">
               <Listeners>
                    <Click Handler="saveEmployee();" />
                </Listeners>
            </ext:Button>
            <ext:Button ID="CancelButton" runat="server" Text="返回" Icon="Cancel">
                <Listeners>
                    <Click Handler="#{InfoDetailsWindow}.hide(null);" />
                </Listeners>
            </ext:Button>
        </Buttons>
    </ext:Window>

     
     

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections.Generic;
    using System.Collections;
    using System.Web.SessionState;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;

    using FrameWork;
    using FrameWork.Components;
    using FrameWork.WebControls;

    using com.tsingdai.Model;
    using com.tsingdai.Common;
    using com.tsingdai.Service;

    using Coolite.Ext.Web;

    public partial class WindowEditor : System.Web.UI.UserControl
    {
        private static readonly ArticleService _articleService = ArticleService.GetInstance();

        private static readonly LabelService _labelService = LabelService.GetInstance();

        public string context = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Ext.IsAjaxRequest)
            {
                InitCuteEditor();
            }
        }

        public void Show()
        {
            this.InfoDetailsWindow.Show();
        }

        # region cuteditor文本编辑控件初始化

        protected void InitCuteEditor()
        {
            Editor1.Setting["CuteEditorFileStorageType"] = typeof(SqlFileStorage).AssemblyQualifiedName;
            Editor1.Setting["DownFile"] = ResolveUrl("DownFile.Aspx");
            Editor1.SetSecurityGalleryPath("/");
            //Editor1. = "type here";
        }

        # endregion

        # region 根据选择的单位,刷新标签名称列表

        protected void LabelRefresh(object sender, StoreRefreshDataEventArgs e)
        {
            int groupID = Int32.Parse(this.U_GroupID.Text);
            IList labelList = _labelService.GetLabelListByGroupID(groupID);
            LabelStore.DataSource = labelList;
            LabelStore.DataBind();
        }

        # endregion

        public void SetInfo(Article article)
        {
            this.ArticleID.Text = article.ArticleID.ToString();
            this.Title.Text = article.Title;

            this.Author.Text = article.Author;
            this.RunDate.Value = article.Run_Date;

            sys_GroupTable groupObj = BusinessFacade.sys_GroupDisp(article.GroupID);
            this.U_GroupID.Text = article.GroupID.ToString();
            this.Publisher.SetValue(groupObj.G_CName);
            IList labelList = _labelService.GetLabelListByGroupID(article.GroupID);
            this.LabelStore.DataSource = labelList;
            this.LabelStore.DataBind();
            this.LabelName.SetValue(article.Label.ID);

            this.Editor1.Text = article.Context;
        }
    }

  •  07-20-2009, 1:42 PM 54126 in reply to 54106

    Re: cuteeditor not support the codebehind to set value?

    It was strange that the child window was not showed. But the source code show that the cuteeditor had been created.
  •  07-21-2009, 9:00 AM 54156 in reply to 54106

    Re: cuteeditor not support the codebehind to set value?

    I am really very exigence and need your help.
     
    thanks!
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.