質問

私はエクステンダを制御することを、テキストボックスの OnTextChanged イベント500ms後のユーザ終了文字を入力すのこ OnTextChanged 取得し上げたときのテキストボックスがフォーカスを失っ原因となる問題(その可).

う思いが、エクステンダの制御に独自のサーバーサイドイベントとな OnDelayedSubmit いに応じて微調整を行なっていきます。このイベントには、太陽起源のものではなく、本装制御の挙動スクリプトは500ms遅延)を __doPostBackonchanged という選択肢はないと思います。

誰でもできるので光をどのように行くのか。

役に立ちましたか?

解決

後にたっぷりの読み上げるエクステンダの制御には、JavaScriptという石畳を一緒に解決するように働いています。

主なかったのに必要な可ーコードからサーバ側のクライアント側の行動を記述します。かったことによる ExtenderControlProperty することができるコントロールの OnPreRender 機能、<エバール>いの挙動を記述します。ったのですが基本的なイベント-取り扱います。

今までの私のコントロールのエクステンダ .cs ファイルするとどうなるのかわかりません

public class DelayedSubmitExtender : ExtenderControlBase, IPostBackEventHandler
{
    // This is where we'll give the behavior script the necessary code for the 
    // postback event
    protected override void OnPreRender(EventArgs e)
    {
        string postback = Page.ClientScript.GetPostBackEventReference(this, "DelayedSubmit") + ";";
        PostBackEvent = postback;
    }

    // This property matches up with a pair of get & set functions in the behavior script
    [ExtenderControlProperty]
    public string PostBackEvent
    {
        get
        {
            return GetPropertyValue<string>("PostBackEvent", "");
        }
        set
        {
            SetPropertyValue<string>("PostBackEvent", value);
        }
    }

    // The event handling stuff
    public event EventHandler Submit;  // Our event

    protected void OnSubmit(EventArgs e)  // Called to raise the event
    {
        if (Submit != null)
        {
            Submit(this, e);
        }
    }

    public void RaisePostBackEvent(string eventArgument)  // From IPostBackEventHandler
    {
        if (eventArgument == "DelayedSubmit")
        {
            OnSubmit(new EventArgs());
        }
    }

}

自動スクリプトするとどうなるのかわかりません

DelayedSubmitBehavior = function(element) {
    DelayedSubmitBehavior.initializeBase(this, [element]);

    this._postBackEvent = null; // Stores the script required for the postback
}

DelayedSubmitBehavior.prototype = {
    // Delayed submit code removed for brevity, but normally this would be where 
    // initialize, dispose, and client-side event handlers would go

    // This is the client-side part of the PostBackEvent property
    get_PostBackEvent: function() {
        return this._postBackEvent;
    },
    set_PostBackEvent: function(value) {
        this._postBackEvent = value;
    }

    // This is the client-side event handler where the postback is initiated from
    _onTimerTick: function(sender, eventArgs) {
        // The following line evaluates the string var as javascript,
        // which will cause the desired postback
        eval(this._postBackEvent);
    }
}

現在のサーバーサイドイベントの扱うことができるなどを行うのはもちろん、色々な思いを扱うイベントその他。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top