protected void hdnButton_Click(object sender, EventArgs e)
    {
        Hashtable properties = GetSelectedItem();
        string    script;

        if (Config.OutputFormat == OutputFormatEnum.URL)
        {
            properties[DialogParameters.URL_URL]          = txtUrl.Text.Trim();
            properties[DialogParameters.EDITOR_CLIENTID]  = Config.EditorClientID;
            properties[DialogParameters.IMG_ALT]          = txtAlt.Text.Trim();
            properties[DialogParameters.IMG_ALT_CLIENTID] = QueryHelper.GetString(DialogParameters.IMG_ALT_CLIENTID, String.Empty);
            script = CMSDialogHelper.GetUrlItem(properties);
        }
        else
        {
            switch (drpMediaType.SelectedValue)
            {
            case "image":
                script = CMSDialogHelper.GetImageItem(properties);
                break;

            case "av":
                script = CMSDialogHelper.GetAVItem(properties);
                break;

            case "flash":
                script = CMSDialogHelper.GetFlashItem(properties);
                break;

            default:
                script = CMSDialogHelper.GetUrlItem(properties);
                break;
            }
        }
        if (!String.IsNullOrEmpty(script))
        {
            ScriptHelper.RegisterStartupScript(Page, typeof(Page), "insertItemScript", ScriptHelper.GetScript(script));
        }
    }