Home | Forums | Contact | Search | Syndication  
 
 [login] [create account]   Friday, July 4, 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: Accessing TabWorkSpace at Load
David Lumm
Posts: 87
 
Accessing TabWorkSpace at LoadYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Oct 09 6:25 AM
Help!

I'm trying to format phone controls, so that only numbers can be entered into them - it's the easiest way to ensure that all phone numbers are in the same format!! Unfortunately UK telephone formats aren't as uniform as US ones...

On Base.Master I've stuck a javascript function to only allow entering numerical characters and I can loop through all the controls in the maincontent in the Page_Load event using:
foreach (Control c in MainContent.Controls[0].Controls)
{
if (c.GetType() == typeof(Phone))
{
Phone phone = c as Phone;
phone.Attributes.Add("onkeypress", "forceNumOnly()");
}
}


For some reason I can't seem to do the same with the tabworkspace. I've tried:
foreach (Control c in TabControl.Controls[0].Controls)
{
if (c.GetType() == typeof(Phone))
{
Phone phone = c as Phone;
phone.Attributes.Add("onkeypress", "forceNumOnly()");
}
}


As far as I can make out, at Page_Load there isn't anything in the TabWorkSpace, so I need some way of triggering the loop when the current tab is loaded. Does anyone know when this happens?

BTW. I don't think Controls[0] is the right one, but it's hard to investigate when there's nothing loaded.

Hope you can help!
[Reply][Quote]
David Lumm
Posts: 87
 
Re: Accessing TabWorkSpace at LoadYour last visit to this thread was on 1/1/1970 12:00:00 AM
Posted: 28 Oct 09 7:19 AM
Bit of a numpty moment! I realised that the tab would probably loaded at the point of PreRender, so I had a bit of a play with that - I also realised that I wasn't catering for the DialogWorkspace.

I've added the below, which seems to be working. However, it's a bit messy and I'm worried that some controls may not load in exactly the same order, therefore stopping this from working :-S

protected void Page_PreRender(object sender, EventArgs e)
{
foreach (Control t in TabControl.Controls)
{
if (t.GetType() == typeof(TabElement))
{
foreach (Control c in t.Controls[0].Controls[0].Controls[0].Controls[1].Controls)
{
if (c.GetType() == typeof(Phone))
{
Phone phone = c as Phone;
phone.Attributes.Add("onkeypress", "forceNumOnly()");
}
}
}
}

foreach (Control c in DialogWorkspace.Controls[0].Controls[0].Controls[0].Controls)
{
if (c.GetType() == typeof(Phone))
{
Phone phone = c as Phone;
phone.Attributes.Add("onkeypress", "forceNumOnly()");
}
}
}


If anyone can help me tidy this up a little bit I'd be grateful!
[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): 7/4/2025 4:47:41 AM