Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
510
Setting ValueChanged flag.
posted

I have a page with that is presented in sections.  Each section contains multiple Akido editor controls.  I want to flag value changes from any of these controls by writing a value to a hidden field.  This way on postback, I will know which section has changed and which database update to call.

A js sample would be appreciated.

Thanks

Parents
No Data
Reply
  • 24497
    Suggested Answer
    posted

    Hi,

    You may process ClientEvent.ValueChanged and write id of modified editor into a hidden field. On server you may process value of that hidden field and check ids of modified editors. Below is example.
    If editors are located in UserControls or similar, then to find reference to modified editor on server from its UniqueID, you should use something better than simple this.FindControl(id).

    <script type="text/javascript">
    function editorValueChanged(editor, args)
    {
     var flagElem = $get('myHiddenFlagInput');
     var id = editor.get_uniqueID();
     var flags = '|' + flagElem.value;
     // here you should use a better search (it will fail for edit1-edit12)
     if(flags.indexOf(id) < 0)
      flagElem.value += id;
    }
    </script>

        <ig:WebTextEditor ID="WebTextEditor3" runat="server">
         <ClientEvents ValueChanged="editorValueChanged" />
        </ig:WebTextEditor>
        <ig:WebTextEditor ID="WebTextEditor2" runat="server">
         <ClientEvents ValueChanged="editorValueChanged" />
        </ig:WebTextEditor>
        <ig:WebTextEditor ID="WebTextEditor1" runat="server">
         <ClientEvents ValueChanged="editorValueChanged" />
        </ig:WebTextEditor>
        <input type="hidden" id="myHiddenFlagInput" runat="server" />

     protected void Page_Load(object sender, EventArgs e)
     {
      if(!this.IsPostBack)
       return;
      string flags = this.Request.Form["myHiddenFlagInput"];
      if(flags == null || flags.Length < 2)
       return;
      string[] uniqueIDs = flags.Split('|');
      int iLen = uniqueIDs.Length;
      while(iLen-- > 0)
      {
       string id = uniqueIDs[iLen];
       if(id.Length > 0)
       {
        Control editor = this.FindControl(id);
        ...
       }
      }
      
     }

Children
No Data