[CLOSED] BeforeClientInit event not firing

  1. #1

    [CLOSED] BeforeClientInit event not firing

    What can cause the BeforeClientInit event not to fire for a triggerfield during a DirectEvent or DirectMethod? Is that event guaranteed to fire always?
    Last edited by Daniil; Apr 09, 2011 at 12:50 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Do you render the widget during DirectEvent (explicitly, by Render calling)?
  3. #3
    The triggerfield is dynamically added during Page_Init. Do I have to explicitly call render on it every time during an DirectEvent? The control has already been rendered though during initial page load.

    Example Call Stack for Initial Page Load:

    Page Init
    Add TriggerField
    Page Load
    Page Prerender
    TriggerField.BeforeClientInit to output some script

    Example Call Stack for DirectEvent
    Page init
    Add TriggerField
    Page Load
    Modify TriggerField
    Page Prerender
    MISSING call to TriggerField.BeforeClientInit
  4. #4
    Hi,

    BeforeClientInit is executed before building init config script.
    During ajax request, a control doesn't generate own init script because such script is not sent to the client (only explicitly rendered controls generate and send back own init script). Therefore BeforeClientInit is not fired during DirectEvent
  5. #5
    Thank you for the explanation. So where's a good place for me to inject scripts during DirectEvents? I have a custom property on a class derived from TriggerField. Depending on the value of the custom property, I output certain scripts to the page. Should I just do it during control's PreRender?
  6. #6
    Hi,

    Do you have to produce the script for each direct event (even if the direct event is not generated by this control)?
    You can use the same approach as Ext.Net, when property (marked as ConfigOption) is changed during direct event then predefined method is called for script generation (DirectEventUpdate attribute is used for that, you can find many usages of that attribute in the Ext.Net sources). Does custom property is marked as ConfigOption? If no then use page events (like PreRender) to generate required script
  7. #7
    yes, that's exactly my use case. i will look into DirectEventUpdate. thanks!

Similar Threads

  1. [CLOSED] Button event firing twice?
    By geodan in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Aug 18, 2010, 7:03 PM
  2. [CLOSED] KeyDown Event Not Firing
    By JonG in forum 1.x Legacy Premium Help
    Replies: 11
    Last Post: Jun 04, 2010, 1:57 PM
  3. [CLOSED] Ajax Event Not Firing with AjaxMethodProxyIDMode set
    By CMA in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Oct 27, 2009, 9:02 AM
  4. [CLOSED] DateField OnSelectionChanged Event is not firing?
    By Etisbew in forum 1.x Legacy Premium Help
    Replies: 6
    Last Post: Oct 09, 2009, 7:20 AM
  5. [CLOSED] setting value without firing event handler
    By maras54 in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Jun 21, 2009, 6:34 PM

Posting Permissions