You are here:   Blogs
Register   |  Login

Search

Minimize

PPG&A Blogs

Minimize
Dec 14

Written by: Phil Porter
12/14/2009 1:11 PM 

    When using IS quick add links a popup window will display with the associated page for adding the context.  This works well but there are a few issues with the theme buttons of the page.  The issue is that the new page will have the same buttons as a standard add page which can be counter intuitive.  Changing the Save button to Save and Return and setting the visibility of the Save and New button to false helps eliminate some confussion.

    To accomplish this I’ve added the following code to the LoadData event in the \Sharged\ThemeButton.ascx.(cs/vb) control.
    
    Use the FindControlRecursively to locate the theme button since the level of the theme button might be different on each page.  I also use the resource file to get and set the title of the buttons, something for multilingual applications.

    You’ll also have to add the Btn:SaveNReturn to your applications resource file.

C#
[CODE]
if (BaseClasses.Utils.NetUtils.GetUrlParam(this, "Target", false) != null && BaseClasses.Utils.NetUtils.GetUrlParam(this, "DFKA", false) != null)
{
  string strSaveButtonTitle = GetResourceValue("Btn:Save");
  string strSaveAndNewButtonTitle = GetResourceValue("Btn:SaveNNew");
  ThemeButton btnSave = (ThemeButton)MiscUtils.FindControlRecursively(this.Page, "SaveButton");
  ThemeButton btnSaveAndNew = (ThemeButton)MiscUtils.FindControlRecursively(this.Page, "SaveAndNewButton");
  if (btnSaveAndNew != null && btnSaveAndNew.Visible && btnSaveAndNew.Button.Text == strSaveAndNewButtonTitle)
    btnSaveAndNew.Visible = false;
  if (btnSave != null && btnSave.Button.Text == strSaveButtonTitle)
    btnSave.Button.Text = GetResourceValue("Btn:SaveNReturn");
}
[/CODE]

VB
[CODE]
If BaseClasses.Utils.NetUtils.GetUrlParam(Me, "Target", False) <> Nothing AndAlso BaseClasses.Utils.NetUtils.GetUrlParam(Me, "DFKA", False) <> Nothing Then
    Dim strSaveButtonTitle As String = GetResourceValue("Btn:Save")
    Dim strSaveAndNewButtonTitle As String = GetResourceValue("Btn:SaveNNew")
    Dim btnSave As ThemeButton = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "SaveButton"), ThemeButton)
    Dim btnSaveAndNew As ThemeButton = DirectCast(MiscUtils.FindControlRecursively(Me.Page, "SaveAndNewButton"), ThemeButton)
    If btnSaveAndNew <> Nothing AndAlso btnSaveAndNew.Visible AndAlso btnSaveAndNew.Button.Text = strSaveAndNewButtonTitle Then
        btnSaveAndNew.Visible = False
    End If
    If btnSave <> Nothing AndAlso btnSave.Button.Text = strSaveButtonTitle Then
        btnSave.Button.Text = GetResourceValue("Btn:SaveNReturn")
    End If
End If
[/CODE]

 

Need some help with your ASP.NET application contact me at pporter@ppgainc.com

Phil

 

Tags:

Archive

Minimize

WARRANTIES

Minimize

SOURCE CODE SAMPLES MAY BE INCLUDED IN SOME BLOGS. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Other marks and trade names used in this publication are the property of their respective owners.