Export from Custom Entity List to Excel using ASP

Help! Hoping someone can help me with this. I have a list from a custom entity that is attached to the company table. I want to be able to export this list to an Excel file. I saw some posts on how to do this for a custom entity that seem to indicate that it would just take the following code...

myContainer.AddButton(CRM.Button("Export", "list.gif","javascript:document.EntryForm.TargetAction.value = 'ExportToFile'; document.EntryForm.submit();"));

However, it is not working. The button is there, but when I click the button---nothing happens. Below is the code that I have in my page... Any assistance would be greatly appreciated. Thank you!

<%

try

{

// Declare Variables

var listBlockName = "CHStransactionList";

var strCompanyField = "trans_companyid";

// Get Context

var strKeyID= "T";

var Id = new String(Request.Querystring(strKeyID));

var strTabName = "";

if (Id.indexOf(",") > 0)

{

var Idarr = Id.split(",");

strTabName = Idarr[0];

}

else if (Id != "")

{

strTabName = Id;

}

strTabName = strTabName.toString();

switch (strTabName)

{

case "Company":

Arg = strCompanyField+ "=" + CRM.GetContextInfo("company","comp_companyid");

break;

default:

Arg = strUserField+"=" + CRM.GetContextInfo("company","comp_companyid");

}

// Create List

var myBlock = CRM.GetBlock(listBlockName);

//Create Buttons

myBlock.AddButton(CRM.Button("Export", "list.gif","javascript:document.EntryForm.TargetAction.value = 'ExportToFile'; document.EntryForm.submit();"));

var strURL=new String( Request.ServerVariables("URL")() + "?" + Request.QueryString );

myBlock.prevURL=strURL;

CRM.AddContent(myBlock.Execute(Arg));

Response.Write(CRM.GetPage());

}

catch(exception)

{