Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Sunday, June 29, 2025 
 
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: Modifying a Form on-the-fly (i.e. visibility)
David Lumm
Posts: 87
 
Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Jan 09 5:17 AM
Hi

Another quick question for all your super developers !

I'm trying to use a combo box to modify the appearance of the form, such that the selected value of that combobox will determine which elements to show on the form. I can get this to work pretty easily by using a combination of a switch statement and the controlid.visible = [true | false] statement.

However, whilst the control appears or disappears the caption remains. How can I force the caption to go invisible too? Alternatively, is there a way of making the whole "cell" in the form structure to become visible/invisible?

One more question, is there any way to redraw the form and move the controls around in code? Am I right in thinking that the controls position is used in the code, and can't be changed on-the-fly?

Thanks for the help

David
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 12 Jan 09 9:56 AM
Managed to work out how to set a control's caption to visible/invisible...

The caption has it's own controlid taking the format control_lbl. This does not include autocomplete, so it's difficult to know what options are available, but the visible property definitely exists and works.

However, I'm still interested to know whether I can rearrange the layout of the controls without mullering the code in the form.

Cheers
[Reply][Quote]
John H. Hedges
Posts: 62
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jan 09 2:16 AM
"Mullering"?
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jan 09 11:23 AM
Muller: (pronounced like the yoghurt) To completely destroy something and make it not work etc.
"When Bob accidently removed all the semi-colons from his code it mullered the whole program"
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 13 Jan 09 11:23 PM
Quote:
Originally posted by David Lumm

Muller: (pronounced like the yoghurt) To completely destroy something and make it not work etc.
"When Bob accidently removed all the semi-colons from his code it mullered the whole program"


Haha - I use another word (and way too frequently)
[Reply][Quote]
Mark B
Posts: 6
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Feb 09 8:22 AM
David, did you ever get a method to do this?

I've a similar issue now and it's doing my nut. The show/hide is easy, but looks like crap as the various controls are spread around. I've come up with a handful of bad ideas on this, none of which have worked out particularly well.

Cheers,
Mark
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 27 Feb 09 9:41 AM
Unfortunately not. There are a couple of options:

1. SalesLogix renders a Control Container as a asp:Panel, which may allow you to do some slightly cleverer stuff - e.g. create an empty container and then add controls to it on the fly:
TextBox text = new TextBox();
text.Text = "something";
panel.Controls.Add(text);

Code adapted from http://forums.asp.net/p/1371106/2870791.aspx
Clearly the example I've given is pretty simple, but hopefully you get the idea.

2. Transfer the form into a custom smartpart, then you can give the DIVs IDs and start showing/hiding whole divs...

Sorry I can't help you more!
[Reply][Quote]
Mark B
Posts: 6
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Mar 09 9:21 AM
Thanks David. These were two of idea's I'd already looked at.

The first one was the first thing I tried myself, but I rejected it due to being unable to attach an OnChange script to the field I was creating manually (Which would be a requirement for me in this case).

Has anyone had any luck adding an onchange script to a field manually created and added to a smart part in this manner?

Cheers,
Mark
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Mar 09 9:52 AM
I've not had any experience of doing it, or it working, but surely it would just be a case of replicating the way that SalesLogix does it itself?


protected override void OnWireEventHandlers()
{
base.OnWireEventHandlers();
combobox.TextChanged += new EventHandler(SomeAction);
Button.Click += new ImageClickEventHandler(Button_ClickAction);
Lookup.LookupResultValueChanged += new EventHandler(Lookup_ChangeAction);
Picklist.PickListValueChanged += new EventHandler(Picklist_ChangeAction);
}

Where it takes the format control.SomethingChanged += new EventHandler(XXYour functionXX);

It probably isn't necessary to stick this in the "protected override void OnWireEventHandlers()" function either, especially since this may not be called in a custom smartpart. It should be sufficient to set the event you want on the Page_Load or similar.

Out of interest, if you get this working, let me know!
[Reply][Quote]
Mark B
Posts: 6
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Mar 09 10:10 AM
Already had a crack at that one last week. The only way I could get it to work was to hack the += new EventHandler directly into the page from within visual studio AFTER I had built in SLX. Obviously not ideal as every time I rebuild, this change gets wiped out. If I was gonna go down this route I would probably try to build an entirely custom smart part from scratch so that I had total control over layout and functionality, but this is a hassle Im trying to avoid. (Adding SLX lookups and picklists into a total custom smartpart made my brain hurt )
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 02 Mar 09 10:58 AM
It depends where you're "hacking" it on.

You could always lie to SLX and add an Load action like below:
}

protected void newAction()
{
actions...


Whatever you do, don't close the new function, as SLX will do that automatically for you, because it assumes it is closing off the load action.

This way you can add a Page_Load event onto the page.

Alternatively, the best way I have found is to do as much as you can in AA and then modify the code in Visual Studio and re-import as a custom, that way most of the hard stuff is done for you.
[Reply][Quote]
Mark B
Posts: 6
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 03 Mar 09 8:29 AM
Well I've found a way to do this in 7.2 App Architect which works, for me at least.

Instead of putting the 7 controls I need to show/hide on the form directly, I added in 7 seperate control containers, and put one of my 7 controls into each control container. Then I set the control container visble/invisible as needed, instead of playing with the actual controls themselves. This does relocate the controls when they are made visible.

Hopefully that may be of some use to you...
Cheers,
Mark
[Reply][Quote]
Phil Parkin
Posts: 819
Top 10 forum poster: 819 posts
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 06 Nov 10 10:56 AM

I know that this thread is quite old now, but what I am doing is directly relevant, so I thought I'd tag something on the end.


I'm having fun trying to hide form controls too - in an external C# assembly.


Hiding the control works well enough, but not the label, for reasons already mentioned. However, if I try to hide the label using something like the following



form.fieldname_lbl.Visible = false;


I get an error in Visual Studio:



'Sage.Form.Interfaces.IAccountDetails' does not contain a definition for 'fieldname_lbl' and no extension method 'fieldname_lbl' accepting a first argument of type 'Sage.Form.Interfaces.IAccountDetails' could be found (are you missing a using directive or an assembly reference?)



Is there any way round this, other than putting the control in some sort of container and hiding that (this stuffs up my control's alignment, so I'd rather not)?


Thanks.

[Reply][Quote]
Dave Purnell
Posts: 7
 
Re: Modifying a Form on-the-fly (i.e. visibility)Your last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 10 Dec 10 3:16 PM
fiogf49gjkf0d

The alignments will not get stuffed if you set the label's text property to an empty string.


D

[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 © 2025 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): 6/29/2025 8:59:51 AM