気づかなかったので自分を蹴るという簡単な答えを認めてほしいという小さな質問です。
したがって、RegisterStartupScriptの次のオーバーロードがある場合
public static void RegisterStartupScript(
Control control,
Type type,
string key,
string script,
bool addScriptTags
)
タイプとコントロールを提供する必要があります。これで、コントロールを指定するポイントがわかります。コントロールが部分的なページレンダリングの一部である場合に備えて、スクリプトがプッシュされます。しかし、Typeパラメーターのポイントは何ですか?通常は、コントロールのタイプに設定するだけです。そしてこれは実際にMSDNによってなされた提案です:
control
Type: System.Web.UI..::.Control
The control that is registering the client script block.
type
Type: System..::.Type
The type of the client script block. This parameter is usually specified by using the typeof operator (C#) or the GetType operator (Visual Basic) to retrieve the type of the control that is registering the script.
では、なぜそれを指定する必要があるのでしょうか。おそらく、.Net Frameworkを節約するだけでなく、ランタイムタイプ自体を取得する手間を省くことができます。