/// <summary>
 /// Post an event when a client script has been generated
 /// </summary>
 /// <param name="e">Question's invalid answers args</param>
 protected virtual void OnClientScriptGeneration(QuestionItemClientScriptEventArgs e)
 {
     if (this.ClientScriptGenerated != null)
     {
         this.ClientScriptGenerated(this, e);
     }
 }
 /// <summary>
 /// Post an event when a client script has been generated
 /// </summary>
 /// <param name="e">Question's invalid answers args</param>
 protected virtual void OnClientScriptGeneration(QuestionItemClientScriptEventArgs e)
 {
     if (this.ClientScriptGenerated != null)
     {
         this.ClientScriptGenerated(this, e);
     }
 }
 protected override void OnPreRender(EventArgs e)
 {
     base.OnPreRender(e);
     string str = this.GenerateClientSideValidationCode();
     if (str != null)
     {
         QuestionItemClientScriptEventArgs args = new QuestionItemClientScriptEventArgs();
         args.ClientScript = str;
         args.Section = this;
         this.OnClientScriptGeneration(args);
         this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(),"__ValidateQuestion" + this.UniqueID, args.ClientScript);
     }
 }
Пример #4
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
            string str = this.GenerateClientSideValidationCode();

            if (str != null)
            {
                QuestionItemClientScriptEventArgs args = new QuestionItemClientScriptEventArgs();
                args.ClientScript = str;
                args.Section      = this;
                this.OnClientScriptGeneration(args);
                this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "__ValidateQuestion" + this.UniqueID, args.ClientScript);
            }
        }
 /// <summary>
 /// Build the client side calls to the questions
 /// that requires client script validation
 /// </summary>
 protected virtual void OnClientScriptGeneration(object sender, QuestionItemClientScriptEventArgs e)
 {
     ActiveQuestion question = sender as ActiveQuestion;
     if (question != null)
     {
         if (e.Section != null)
         {
             this._questionClientValidationCalls.Append(string.Format("if (typeof({0}{1}) == 'function' && !{0}{1}()){{return false;}}", GlobalConfig.QuestionValidationFunction, e.Section.UniqueID.Replace(":", "_")));
         }
         else
         {
             this._questionClientValidationCalls.Append(string.Format("if (typeof({0}{1}) == 'function' && !{0}{1}()){{return false;}}", GlobalConfig.QuestionValidationFunction, question.UniqueID.Replace(":", "_")));
         }
     }
 }
Пример #6
0
 /// <summary>
 /// Notify subscriber that a script has been generated
 /// for the given section
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Section_ClientScriptGenerated(object sender, QuestionItemClientScriptEventArgs e)
 {
     OnClientScriptGeneration(e);
 }
 /// <summary>
 /// Notify subscriber that a script has been generated
 /// for the given section
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected void Section_ClientScriptGenerated(object sender, QuestionItemClientScriptEventArgs e)
 {
     OnClientScriptGeneration(e);
 }