I am using kentico 12. I have a unigrid(object list).Upon cliking on edit on a row,I will show a General tab(1st vertical tab) which has UIForm then in the next vertical tab I have a button. When I click this button I want to open a uniselector modal dialog showing a object listing based on the edited object Id. From this uniselector list, I will select what's needed and click save. So finally only selected data will be shown in the second vertical tab. 
I have below code called during override OnInit() 
    var dialogUrl = ApplicationUrlHelper.GetElementDialogUrl("ModuleName", "ElementName");
    dialogUrl = URLHelper.GetAbsoluteUrl(dialogUrl);
    var dialogScript = ScriptHelper.GetModalDialogScript(dialogUrl , "Detail", "500", "500");
    var page = (CMSUIPage)Control.Page;
    var buttonHeaderAction = new HeaderAction()
    {
        Text = ResHelper.GetString(Text),
        ButtonStyle = ButtonStyle,
        OpenInDialog = true,
        DialogHeight = "500",
        DialogWidth = "500",
        OnClientClick = dialogScript,
        CommandName = Text.Replace(" ", string.Empty)
    };
    page.AddHeaderAction(buttonHeaderAction);
I am getting error in browser console as modalDialog('dialogUrl value inside') is not defined upon button click. Kindly help
I referred this link( https://devnet.kentico.com/articles/module-development-ui-extenders ).