Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, November 22, 2024 
 
slxdeveloper.com Community Forums  
   
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
 Web Forums - SalesLogix Web Platform & Application Architect
Forum to discuss the use of the SalesLogix Web Platform, Client and Customer Portals, and the Application Architect (For version 7.2 and higher only). View the code of conduct for posting guidelines.
Forums RSS Feed


 Back to Forum List | Back to SalesLogix Web Platform & Application Architect | New ThreadView:  Search:  
 Author  Thread: Adding Toolbar Buttons
Lee Owen
Posts: 46
 
Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Oct 07 2:16 PM
I need to add a button on a toolbar to save a record and then upon action completion, send the page back to the Contact.aspx. All attempts to do this give me this error.

error CS1519: Invalid token '(' in class, struct, or interface member declaration

Any ideas?
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 5:07 AM
Which toolbar? Is it on the contact page? Can you post the code / steps you have tried to get the above?
[Reply][Quote]
Lee Owen
Posts: 46
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 11:39 AM
I'm trying to add toolbar buttons on a custom page that i created following the MagicCarpet example in the help section.
I navigate to Entity Model>Sales Logix Application Entities> MagicCarpet> Forms> MagicCarpetDetails which is the form page I created. The help example had me create a button on the page to Associate the MagicCarpet record to a contact record. It did so through a C#CodeSnippet and i've added code to that snippet (that i found on this site...see below) to also save that record and redirect the user back to the main contact page. I say redirect back to the Contact page because that page has a custom tab that i created with a grid showing all the MagicCarpet records. So i click one record in that grid which takes me to my MagicCarpetDetails form where i can add/or edit. Then i'd like buttons on that tool bar that allow me to save and redirect back to that contacts page. And a button to delete (if it's not a new record) and redirect me back to the contacts page.

So here are my steps.
On MagicCarpetDetails i click a blank spot on the form. Then i go to TOOLBAR in the properties window and click the ellipse button which brings up the toolbar editor.
Then i select RIGHT and choose ADD and BUTTON.
I set ButtonType to ICON nad choose my image for the button.
I go to the bottom and expand the OnClickAction.
In ActionName, i hit the ellipse button and bring up the Action Item Designer.
From this i choose Business Rule.
I set the Business Rule value to DELETE and my Object Name to MagicCarpet. (have to set ObjName first, then i get the option for Bus Rule)
I then choose the OnCompleteActionItem section and hit the ellipse button to bring up another Action Item Designer page. I choose REDIRECT. I set the MainView Entitiy Name to Contact since this is the view i'd like to be redirected back to.
I hit OK to close the Action Item Designer #2 and another OK to close the first Action Item Designer.
This brings me back to the toolbar editor.
I hit OK on it and close it.
Then i save, build and deploy.

I go login and navigate to my specific contact that i'm testing with. I see all the MagicCarpets down in my grid in the Tabs section. I can click one of the records in the grid to then leave the contact page and get to my MagicCarpetDetails page.
I see all the form filled in with the details of that record. If I hit the delete button that i created, it DOES delete the record, but i don't get redirected back to the contact page. I end up on an exception.aspx page with this error:

Quote:
We apologize for the inconvenience, but your request cannot be completed. Object reference not set to an instance of an object.


My issue seems to be the step of redirection back to the contact page. In other words, i've tried buttons to add recs or delete recs. In both cases, the data is added or deleted to the database, but i do not get sent back to my contact record after the transaction.

Now... since the example had me create a button on the form to associate the MagicCarpet record with my contact record, i added more code to save the record and response.redirect. That works and i get it done. But this button has several issues. One, it's in the form and i'd like the button to be a delete icon or a save icon on the toolbar like all the other built in forms. Second, in my attempt to code the redirect i say:
Quote:

if (this.BindingSource != null)
{
Sage.Entity.Interfaces.IMagicCarpet mCarpet =
this.BindingSource.Current as Sage.Entity.Interfaces.IMagicCarpet;
Sage.Entity.Interfaces.IContact contact = GetParentEntity() as Sage.Entity.Interfaces.IContact;
if (contact != null)
{
mCarpet.Contact = contact;
}
mCarpet.Save();

Response.Redirect("Contact.aspx?entityID=" + mCarpet.ContactID );
}


well the problem is that mCarpet.ContactID that i'm passing to the querystring exists only when i'm updating an existing record. So when editing, this works. When creating a new record, that value doesn't exist so i land on that Exception.aspx page instead of getting redirected. Make sense? So i'm beginning to understand that my issue on the toolbar buttons is likely sending me to the exception.aspx on the redirect because it isn't successfully passing entityID=???? in the querystring.

Fun stuff!! Confused yet???
So ultimately, i just want buttons on my form to save or delete and redirect me back to the page i came from. Contact.aspx.

Any ideas on what step i've screwed up?

THANKS THANKS THANKS for the help.

Lee




[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 12:53 PM
Hey Lee,

Im going to have to check out these magic carpet tutorials! If im right in thinking, I would say your Save c# snippet action should be simialr to the following:

if (this.BindingSource != null)
{
Sage.Entity.Interfaces.IMagicCarpet eco = this.BindingSource.Current as Sage.Entity.Interfaces.MagicCarpet;
Sage.Entity.Interfaces.IContact con = GetParentEntity() as Sage.Entity.Interfaces.IContact;


if (con != null)
{
eco.Contact = con;
con.MagicCarpet.Add(eco);
}
eco.Save();
}

This is from a custom tab of mine so you may have to use your imagination to get it fitting exactly with contact and magic carpet entities (I have roughly converted some of the fields to give you an idea.

This c# snippet action should be set to dialogcloseevent = true. This will effectively close your form thats popped up and I guess in a way simulate a response.redirect, but a response.redirect is not really what you need - you just need to refresh the grid, which is what the

eco.Contact = con;
con.MagicCarpet.Add(eco);

part does...

Make sense??! sorry im rushing a bit as late in the day here!

Cheers
Nick
[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 12:54 PM
Oh and for the delete, just have the delete button on the toolbar call the business rule of delete for the magic carpet entity, and make sure you set it to dialog close event..., will take care of everything else for you...
[Reply][Quote]
Lee Owen
Posts: 46
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 2:00 PM
Nick,
Thanks for the info, however, this behaves exactly as my code. After editing your code to match my info, there was really only one difference.
You added
Quote:
con.MagicCarpet.Add(eco);

It still takes me to the exception page when i hit the save button using your method.

[Reply][Quote]
Nick Hollis
Posts: 549
Top 10 forum poster: 549 posts
 
Re: Adding Toolbar ButtonsYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 11 Oct 07 2:46 PM
My code doesnt have a reponse.redirect either - also have you set the dialogcloseevent to true?
[Reply][Quote]
 Page 1 of 1 
  You can subscribe to receive a daily forum digest in your user profile. View the site code of conduct for posting guidelines.

   Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
 

 
 slxdeveloper.com is brought to you courtesy of Ryan Farley & Customer FX Corporation.
 This site, and all contents herein, are Copyright © 2024 Customer FX Corporation. The information and opinions expressed here are not endorsed by Sage Software.

code of conduct | Subscribe to the slxdeveloper.com Latest Article RSS feed
   
 
page cache (param): 11/22/2024 8:31:00 PM