Resolves redundant BaseTreePicker script initialization (U4-192)

This commit is contained in:
funka@WETWIRED
2012-10-17 05:36:22 +07:00
parent 7bc2375a77
commit c72ab927a6

View File

@@ -141,13 +141,14 @@ namespace umbraco.uicontrols.TreePicker
/// </summary>
protected virtual void RenderJSComponents()
{
const string scriptKey = "BaseTreePickerScripts";
if (ScriptManager.GetCurrent(Page).IsInAsyncPostBack)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), this.GetType().ToString(), BaseTreePickerScripts.BaseTreePicker, true);
ScriptManager.RegisterStartupScript(this, this.GetType(), scriptKey, BaseTreePickerScripts.BaseTreePicker, true);
}
else
{
Page.ClientScript.RegisterClientScriptBlock(typeof(BaseTreePicker), this.GetType().ToString(), BaseTreePickerScripts.BaseTreePicker, true);
Page.ClientScript.RegisterClientScriptBlock(typeof(BaseTreePicker), scriptKey, BaseTreePickerScripts.BaseTreePicker, true);
}
}