Esempio n. 1
0
    /// <summary>
    /// Page load.
    /// </summary>
    protected void Page_Load(object sender, EventArgs e)
    {
        // Register Javascripts
        ScriptHelper.RegisterDialogScript(Page);
        ScriptHelper.RegisterClientScriptBlock(this, typeof(string), "DeleteEditView", ScriptHelper.GetScript(
                                                   "var deleteConfirmation = ''; " +
                                                   "function DeleteConfirm() { return confirm(deleteConfirmation); } " +
                                                   "function EditItem(customtableid, itemId) { " +
                                                   "  document.location.replace('" + ResolveUrl(EditItemPage) + "?" +
                                                   (String.IsNullOrEmpty(mEditItemPageAdditionalParams) ? String.Empty : mEditItemPageAdditionalParams + "&") + "customtableid=' + customtableid + '&itemId=' + itemId); } " +
                                                   "function ViewItem(customtableid, itemId) { " +
                                                   "  modalDialog('" + ResolveUrl(ViewItemPage) + "?" +
                                                   (String.IsNullOrEmpty(mViewItemPageAdditionalParams) ? String.Empty : mViewItemPageAdditionalParams + "&") + "customtableid=' + customtableid + '&itemId=' + itemId,'ViewItem',600,600); } "));

        // Buttons' tooltips
        editToolTip   = GetString("general.edit");
        deleteToolTip = GetString("general.delete");
        viewToolTip   = GetString("general.view");
        upToolTip     = GetString("general.up");
        downToolTip   = GetString("general.down");

        // Delete confirmation
        ltlScript.Text = ScriptHelper.GetScript("deleteConfirmation = '" + GetString("customtable.data.DeleteConfirmation") + "';");

        gridData.ObjectType           = CustomTableItemProvider.GetObjectType(CustomTableClassInfo.ClassName);
        gridData.OnLoadColumns       += gridData_OnLoadColumns;
        gridData.OnExternalDataBound += gridData_OnExternalDataBound;
        gridData.OnAction            += gridData_OnAction;

        ti = CustomTableItemProvider.GetTypeInfo(CustomTableClassInfo.ClassName);

        if (HasItemOrderField)
        {
            if (CustomTableClassInfo.ClassName == "customtable.carz")
            {
                gridData.OrderBy = "Year DESC";
            }
            else
            {
                gridData.OrderBy = "ItemOrder ASC";
            }
        }
        else
        {
            gridData.OrderBy = ti.IDColumn;
        }
    }