A customer had a requirement to add additional buttons to a custom ASP page.  These buttons had to be displayed at the bottom of the screen in a way similar to the buttons in the marketing area.

But you can have the buttons appear anywhere you like in an ASP (or .NET) page.

If you have only one set of custom buttons that you want to appear in a different location other than the default you can use the  ButtonLocation and ButtonAlignment properties.

In the image below the custom buttons are have been displayed at the bottom of the page with horizontal alignment.

The code for this example looks like


<!-- #include file ="sagecrm.js"-->
<%
var intRecordId = CRM.GetContextInfo("user","user_userid");
var oppolistBlock = CRM.GetBlock("opportunitylist");
var strCallASPButton1 = CRM.Button("ASP1","save.gif", CRM.Url("myPage.asp"));
var strCallASPButton2 = CRM.Button("ASP2","save.gif", CRM.Url("myPage.asp"));
oppolistBlock.AddButton(strCallASPButton1);
oppolistBlock.AddButton(strCallASPButton2);
oppolistBlock.ButtonLocation = Bottom;
oppolistBlock.ButtonAlignment = Right;
 
Arg = "oppo_assigneduserid="+intRecordId;
CRM.AddContent(myBlockContainer.Execute(Arg));
Response.Write(CRM.GetPage());
%>
 

But what if I want buttons both in the default location and at the bottom of the page like in the example from the campaigns screen?

For this example I have used a container and a content block to allow me to position the buttons where I want them.  You will see that I have turn off the default button that the container adds in automatically and I have kept the buttons on the list, but they could have been added to the container rather than the list.

I could also add in HTML to further control the buttons.  It is important to realise that the CRM.Button() method just returns HTML so this can be processed in anyway you want.


<!-- #include file ="sagecrm.js"-->
<%
var intRecordId = CRM.GetContextInfo("user","user_userid");
var oppolistBlock = CRM.GetBlock("opportunitylist");
var strCallASPButton1 = CRM.Button("ASP1","save.gif", CRM.Url("myPage.asp"));
var strCallASPButton2 = CRM.Button("ASP2","save.gif", CRM.Url("myPage.asp"));
oppolistBlock.AddButton(strCallASPButton1);
oppolistBlock.AddButton(strCallASPButton2);
 
var contentBlock = CRM.GetBlock("content");
contentBlock.contents = CRM.Button("ASP1","save.gif", CRM.Url("myPage.asp"));
contentBlock.contents += CRM.Button("ASP2","save.gif", CRM.Url("myPage.asp"));
 
var myBlockContainer = CRM.GetBlock("Container");
with (myBlockContainer)
{
  AddBlock(oppolistBlock);
  AddBlock(contentBlock);
  DisplayButton(Button_Default) = false;
 
}
 
oppolistBlock.ArgObj = "oppo_assigneduserid="+intRecordId;
CRM.AddContent(myBlockContainer.Execute());
Response.Write(CRM.GetPage());
%>