User Control to Control Other User Control

Has anyone here created a control that controlled the content of other 
controls?

I have my own custom ad control (for displaying space ads). I may have 
several on a page. What I'd like it to create another control that could 
determine how many instances of the first control existed on the current 
page, build a list of ads, and then set each control to show a particular 
ad.

Is this practical? Suggestions?

Thanks.

Jonathan
 

0
Jonathan
1/24/2010 4:58:10 PM
dotnet.framework.aspnet 1425 articles. 0 followers. Follow

4 Replies
788 Views

Similar Articles

[PageSpeed] 17


"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:uQ5stZRnKHA.1552@TK2MSFTNGP05.phx.gbl...
> Has anyone here created a control that controlled the content of other 
> controls?
>
> I have my own custom ad control (for displaying space ads). I may have 
> several on a page. What I'd like it to create another control that could 
> determine how many instances of the first control existed on the current 
> page, build a list of ads, and then set each control to show a particular 
> ad.

Step back from the problem for a second. Here is what it sounds like you are 
saying.

1. I have randomly created ads, so I have no clue how many are on a page
2. I want a control to find these random controls and then make a list of 
their ads
3. I then want this control to fill these ads

Now, unless you are refilling controls on the client side, you will know 
what is in the controls. If so, you might create some JavaScript to flip 
them out, but you should still output (emit) this client script from the 
server, where you still have control.

As such, I see no reason to have a control to monitor other controls. 
Instead, I see a control you send a full list to as you fill the individual 
controls. Perhaps you also have some emited script to change the ads and 
update the controller control. But since this is merely JavaScript, I see no 
reason to have a "control" per se. Make sense?

-- 
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
|    Think outside the box!                        |
************************************************ 

0
Gregory
1/24/2010 7:46:17 PM
Gregory A. Beamer wrote:

> Step back from the problem for a second. Here is what it sounds like you 
> are saying.
>
> 1. I have randomly created ads, so I have no clue how many are on a page
> 2. I want a control to find these random controls and then make a list of 
> their ads
> 3. I then want this control to fill these ads

1. I know how many ads are on a page; however, control instances do not know 
how many other instances there are.
2+3. Something like that.

> As such, I see no reason to have a control to monitor other controls. 
> Instead, I see a control you send a full list to as you fill the 
> individual controls.

I'm not sure how that would work. Just to clarify, I don't know if I used 
the term "a control to monitor other controls" but all I really mean is a 
separate control to coordinate things. Exactly how that is accomplished is 
what I'm asking.

> Perhaps you also have some emited script to change the ads and update the 
> controller control. But since this is merely JavaScript, I see no reason 
> to have a "control" per se. Make sense?

The ads are coming from my database so really there's no no client-script 
involved.

For me the, issues are A) I suspect it is less efficient to have multiple 
controls hit the database than to hit the database once for all controls on 
a page, and B) when separate controls hit the database separately, I can get 
duplicate ads on different controls.

Thanks.

Jonathan
 

0
Jonathan
1/25/2010 4:40:36 PM

"Jonathan Wood" <jwood@softcircuits.com> wrote in message 
news:uYAPk0dnKHA.1548@TK2MSFTNGP02.phx.gbl...
> Gregory A. Beamer wrote:
>
>> Step back from the problem for a second. Here is what it sounds like you 
>> are saying.
>>
>> 1. I have randomly created ads, so I have no clue how many are on a page
>> 2. I want a control to find these random controls and then make a list of 
>> their ads
>> 3. I then want this control to fill these ads
>
> 1. I know how many ads are on a page; however, control instances do not 
> know how many other instances there are.
> 2+3. Something like that.
>
>> As such, I see no reason to have a control to monitor other controls. 
>> Instead, I see a control you send a full list to as you fill the 
>> individual controls.
>
> I'm not sure how that would work. Just to clarify, I don't know if I used 
> the term "a control to monitor other controls" but all I really mean is a 
> separate control to coordinate things. Exactly how that is accomplished is 
> what I'm asking.
>
>> Perhaps you also have some emited script to change the ads and update the 
>> controller control. But since this is merely JavaScript, I see no reason 
>> to have a "control" per se. Make sense?
>
> The ads are coming from my database so really there's no no client-script 
> involved.
>
> For me the, issues are A) I suspect it is less efficient to have multiple 
> controls hit the database than to hit the database once for all controls 
> on a page, and B) when separate controls hit the database separately, I 
> can get duplicate ads on different controls.

Since everything is coming from the database, grab the list of ads and make 
sure they are filtered to the number you want on the page. Then dynamically 
instantiate the proper number of controls.

If this does not work, I would suggest iterating through the controls and 
finding all ad controls. If you truly have an "ad" control, it will be easy. 
If it is merely an image link type of object, you will need naming 
convention on top to ensure you only grab ad images. If you want a count 
before grabbing ads, you can either

a) iterate back through when you are adding ads (since the number is low, 
iterating is fine)
b) store in a collection and then iterate through the collection (this is 
only a benefit if the number of ads on a single page is ridiculous or there 
are huge numbers of images, as the cost of instantiating the collection will 
be heavier than iteration through images again). It is conceptually cleaner, 
however, to go through only once, so it is not a bad pattern, but understand 
you may negatively impact performance (in the milliseconds range) for the 
added "beauty" in the code.

Once you know your objects and ads, just start feeding. If you are using 
postbacks, you can update on a postback. If you want to use AJAX to reset 
the list, you can do that as well, although you have to think through the 
problem a bit more.

If you need to rotate the ads, set up the JavaScript to swap out images and 
HREFS from a list or lists before sending to the client. This is a bit more 
complex, but there are libraries out there that can help you if you google 
for JavaScript image libraries. I tend to look at JQuery first, but I am not 
sure if it has any functionality for anything like this. My reason is 
twofold:

1. I use it a lot and it has a lot of bang for the buck
2. Microsoft is putting full support for JQuery in the 4.0 timeframe.

-- 
Peace and Grace,
Greg

Twitter: @gbworld
Blog: http://gregorybeamer.spaces.live.com

************************************************
|    Think outside the box!                        |
************************************************ 

0
Gregory
2/1/2010 5:27:16 PM
Gregory A. Beamer wrote:

> Since everything is coming from the database, grab the list of ads and 
> make sure they are filtered to the number you want on the page. Then 
> dynamically instantiate the proper number of controls.

The number of controls is fixed.

> If this does not work, I would suggest iterating through the controls and 
> finding all ad controls. If you truly have an "ad" control, it will be 
> easy.

Right, this is where I've been looking. (I do truly have an "ad" control.)

I guess I was wondering if this was the most efficient way to locate the 
other controls. So I was thinking about maybe adding a property that 
contains a list of the other control IDs. But perhaps I should do as you 
suggest and not worry about performance.

> b) store in a collection and then iterate through the collection (this is 
> only a benefit if the number of ads on a single page is ridiculous or 
> there are huge numbers of images, as the cost of instantiating the 
> collection will be heavier than iteration through images again). It is 
> conceptually cleaner, however, to go through only once, so it is not a bad 
> pattern, but understand you may negatively impact performance (in the 
> milliseconds range) for the added "beauty" in the code.

Okay, I would've thought it would've been faster to create a collection that 
scanning the page for controls multiple times. That's helpful if I was 
backwards on that. Perhaps I should even do a bit of profiling of this.

> If you need to rotate the ads, set up the JavaScript to swap out images 
> and HREFS from a list or lists before sending to the client. This is a bit 
> more complex, but there are libraries out there that can help you if you 
> google for JavaScript image libraries.

I'm not certain what sort of rotating you had in mind. I'm pulling the ads 
from a database in a somewhat random fashion. If the page reloads, I would 
just do it again. I guess I could look at just having the "ad" controls keep 
their ad markup in viewstate and then not access the database again for 
postbacks.

> I tend to look at JQuery first, but I am not sure if it has any 
> functionality for anything like this. My reason is twofold:
>
> 1. I use it a lot and it has a lot of bang for the buck
> 2. Microsoft is putting full support for JQuery in the 4.0 timeframe.

I haven't looked into that. Is that in the current VS 2010 beta?

Thanks.

Jonathan
 

0
Jonathan
2/2/2010 3:41:10 PM
Reply:

Similar Artilces:

Want to change from Admin to User easily
Hi all, I usually run my PC as Administrator which I now know is dangerous, as it can let malware in and play with the system more easily. So I want to create a limited User account instead, but all my settings are under the Admin profile (eg. Quick Launch icons, file associations, and so on). Is there an easy way to migrate these to the User account, so that when I log in as User, my desktop is the same, icons are the same, etc? Thanks for any advice. a wrote: > Hi all, > > I usually run my PC as Administrator which I now know is dangerous, > as it can...

New to User Forms
When I first found this site I was a crazy woman and just about read everthing. Thanks to all you folks who take the time to answer our qurestions. The one thing I cannot get to is a video/tutoraial on forms, the link was provided by somebody as an assist to another question. I loved the videos but was unable to complete the 3 or 4 part series and forgot to make it a favorite. Can anybody point me in the right direction or provide links to other training for starting forms? Thanks! Might have been Debra Dalgleish's site. http://www.contextures.on.ca/xlUserForm01.html Gord...

Users Shared Folders
Hi guys Can someone please put me out of my misery, and save me from spending another day or so wasting my time trying to find the answer. I just took delivery of new server with SBS 2003. Another company installed it for us. They set it up so that when you create a new user it automatically sets up a user folder in "c:\Users Shared Folders" I do not want that to happen there. I NEED it to happen in the D directory. I have read about moving existing folders etc etc. But I dont need to do that cause I have yet to set up the users, but will be shortly. All I want to...

Fetch user login information using JScript
Hi.. I am new to MS CRM. I am trying add custom HTML pages to the CRM which requires the user login information. I would like to know how to go about this and solve my problem Any help regarding this would be appreciated NN, I am not 100% sure of this but could you not just have the page use integrated authentication? Jeff Loucks 888-474-2237 MVP "NN" <NN@discussions.microsoft.com> wrote in message news:0E6BA8D5-2F2D-492B-8CB8-84284D04FF59@microsoft.com... > Hi.. > > I am new to MS CRM. I am trying add custom HTML pages to the CRM which > requires the user...

Users not showing up All Users
Exchange 2k3 on a SBS 2k3 box. I went in through AD Users+Computers, and created mailboxes for users. Two days later, the mailboxes still don't show up in Exchange System Admin-Recipients-All Addresses-All Users. As a matter of fact, the mailboxes aren't showing anywhere, and we're not able to send mail internally(external isn't a factor yet, as the box hasn't gone live). Strange part is, is that if I right click on All Users-Properties, then click on the Preview button under the General tab, all of the users+mailboxes show up. Is this normal? And on a second note...wha...

Determining size of "autosized" user control
Given a user control that contains some kind of dynamic content (content I do not know the dimensions of at compilation time). This user control is then dropped into a Window, without specifying size. I am trying to determine the size of the content at runtime once it is defined. Take the following sample code: /// <summary> /// Interaction logic for Window1.xaml /// </summary> public partial class Window1 : Window { public Window1() { InitializeComponent(); MyUserControl ctrl = new MyUserControl(); ...

user breakpoint
I use malloc in a thread,before the thread quit,I use free,cause pop up "user breakpoint called from code at 0x77f7f570" error. Debug output: HEAP[DownTradetrek.exe]: Heap block at 0037B1C8 modified at 0037DA00 past requested size of 2830 I don't know what happen.Thank for your help. "msg_du" <dch1237@msn.com> wrote in message news:uzRWBIO7DHA.1804@TK2MSFTNGP12.phx.gbl... > I use malloc in a thread,before the thread quit,I use free,cause pop up > "user breakpoint called from code at 0x77f7f570" error. > > Debug output: > HEAP[DownTrad...

User shows up 17x under logons under Mailbox
We have an office where all the users are displaying from 12-17 times under logons while everyone else displays only 3 or 4 times. What does this indicate? Does this indicate connections, being dropped then reconnected? TIA Are they running PDA synchronization software? -- Ed Crowley MVP - Exchange "Protecting the world from PSTs and brick backups!" "Greg" <Greg@discussions.microsoft.com> wrote in message news:F194F160-CC25-4068-A213-1D13FE73DD8E@microsoft.com... > We have an office where all the users are displaying from 12-17 times > under > logons w...

Controlling sent mail folders with two pst files
I use two personal pst files, one for personal mail and another for business mail. I am using Outlook 2003. The business pst file is set as my default, but when I send an email it is saved in my personal pst sent folder and not the business pst sent folder. When I send personal mail it is correctly saved in my personal pst send folder. How can I control which sent folder messages are saved in for my different business and personal pop accounts? I would like to save my business mail in my business pst sent folder and not in my personal pst sent folder. Thanks, Kelly You might tr...

Need User Name and Password
Hello Everyone, I am reinstalling RMS 1.3 in a customer that their server crashed and need to reinstall everything from scratch... I do not remember the default user name and password for RMS 1.3.; I remember that is a number 1 or 2 (I think) but do not remember the password! Thanks for your Help in Advance Rommel J Jimenez try Password or password if that doesn't work, look it up with the sql statement: select * from cashier "Rommel J. Jimenez" wrote: > Hello Everyone, > > I am reinstalling RMS 1.3 in a customer that their server crashed and need > to r...

Domain Controller 01-17-06
May i know how can i solve this problem. When i run Microsoft CRM Environment Diagnostics Wizard some of this message appear : Some of the domain controllers do not appear to be running. The following list of servers should be checked. PrivUserGroup ReportingGroup SQLAccessGroup UserGroup May i know how can i start these controller? Thanks. ...

Best method to allow two users to make edits to the same Excel File
I am trying to determine what is the best method to allow two users to simultaneously make edits to the same Excel file. It is VERY rare that we will ever be typing in the same Cell as the other person, but we both need to work out of the same workbook at the same time. We are working in two separate locations, by the way. Is using Dropbox along with "Tools > Share Workbook" the way to go? Or should I use Google Docs? Or possibly Sharepoint? Or Excel 2010 Web Aps? The main question I am trying to answer is "what actually works" and is generally hassle free. Thanks fo...

Random Users Calendars not viewable
We recently moved our Exchange 2003 server to another machine. Since doing so, we have random users whose calendar will only apear as \\\\\\ when we try to invite them to a meeting. I have tried to replicate the Schedule+ Free Busy folder but this has not worked either. Any suggestions? On Tue, 12 Sep 2006 04:32:01 -0700, Kevin <Kevin@discussions.microsoft.com> wrote: >We recently moved our Exchange 2003 server to another machine. Since doing >so, we have random users whose calendar will only apear as \\\\\\ when we >try to invite them to a meeting. I have tried to...

Manager grayed out on user setup
After adding a user, I want to change the manager (which is blank at the moment) but the manager field is grayed out, as a result, I can't change this field. Any suggestions? On the users detail form, go to the Actions menu. There will be an option there to change the manager. Matt Parks MVP - Microsoft CRM ---------------------------------------- ---------------------------------------- On Thu, 13 Jan 2005 07:37:07 -0800, idtpes <idtpes@discussions.microsoft.com> wrote: After adding a user, I want to change the manager (which is blank at the moment) but the manager field ...

A Way for saving control with all of it's components and properties to a file or stream.
Hello. Is there any way to save a control + all of it's components to a file (or give it some representation as a long string). Thanks :) Mr. X. wrote: > Hello. > Is there any way to save a control + all of it's components to a file > (or give it some representation as a long string). > > Thanks :) A control is an object with properties. You save the properties of the object to a XML file manually. You instantiate the control/object (new), and you populate the control/object from the XML file that represents the controls properties. XML is stri...

Controlled Mailbox access via EXchange server
Quick one here, apart from using the Outlook client method, is it possible on EXCHANGE SERVER 2003 to give users (not domain/ exchange administrators) read, edit & write permissions to, for example someone's else's calender without giving the usual full mailbox access rights? Abiola Sonubi wrote: > Quick one here, apart from using the Outlook client method, is it > possible on EXCHANGE SERVER 2003 to give users (not domain/ exchange > administrators) read, edit & write permissions to, for example > someone's else's calender without giving the usual full ...

Lotus user to Outlook user Attachments missing
Hi everyone, I have a strange problem that hopefully someone can help with or maybe point me in the right direction. Infrastructure info: All our clients are running Office 2007 SP2 and we have Exchange 2007 SP1 as our backend. We have a client that has Lotus Notes and sends us many emails per day and almost always they have attachments but usually PDF's, JPG's and DOC's. We have just discovered that they occasionally send us scanned docs in MDI format. The problem is that it appears as though when the client running Lotus attached an MDI file and sends the ema...

users sending messages to themselves
Hello all, I'm running a Exchange 2000 server w SP3 on W2K box w SP4. I have some users who have this old habit of sending a copy of out going message to themselves when they compose a new message by cc or bcc or even To field. I ask them not to do but they are still doing it. Is there a way (may be a script or rule or anything in Exchange or third party software) to stop this. I was told by someone that there is nothing of that nature but I'm still not convinced. There's gotta be a way. Thanks Raj Bambrah Why not let them do whatever they damn well please? Raj Bambrah wro...

IMF and remote users.
I need a bit of hand holding on this. We are about to start hosting our own email. There are branch offices that will pick up their email with POP3 from our server running SBS 2003. I want to filter for spam, but also want all the users to have the ability to review emails caught by the filter. If I use the IMF filter, am I correct in assuming that the remote office users will never see those emails in that they will have been moved out of their inbox to the spam folder? Is there a built-in method of tagging, not moving emails identified as spam on a RBL? Thank you. - Are you going to use ...

Limit user access on customer/vendor?
is it possible to control user access on certain customer/vendors? something like account level security, but on customer/vendor. Hi HFLo, No you cannot have Customer/Vendor Control Access as account security, since no module in GP has this feature, this is one of the drawbacks of GP no ROW LEVEL SECURITY at all, we are using the third party product for this security setup, it also works for Inventory and items just like account security. In short GP dosent have this feature. AXAPTA has this feature to restrict access to customers, vendors, inventory items at site level etc....... w...

Preventing a user from seing other users opportunities
Hi, I have a case in which 2 CRM users (A) & (B) shouldn't see each other's opportunities and this is indeed the case. However, when a user (A) creates an opportunity for which the account is owned by user (B), user (B) is then able to see this user (A) opportunity. I understand that this might be logical business wise, however, is there any way to prevent user (B) from seing these opportunities of user (A) even though he is the owner of the opportunity account ?? Thanks in advance I don't believe this is possible but I could be wrong. Darren Liu, Microsoft CRM MVP...

Sending a copy of each email that a user sends
We have a security issue from HR requiring them to review all email sent from a user Is there a way to cc: an HR account with all email sent without the user being aware of the cc:? Have a look at this software www.exclaimer2000.com On Mon, 23 Feb 2004 13:41:08 -0800, Rod <anonymous@discussions.microsoft.com> wrote: >We have a security issue from HR requiring them to review all email sent from a user. >Is there a way to cc: an HR account with all email sent without the user being aware of the cc:? This is very easy with Exchange 5.5. What version do you have? Rafael "...

security- users
hi all can anyone tell me this.. i want when someone opens the data base to asked for a user name and password. if the user name is for example "admin" (thats me) to have full access, can create,delete tables,create report etc. if the user name is "user1" to be able only for read, write ,add record ?? i prefered to do this by using the User and Group Permissions but any other suggestions are welcome.. thanks On Sun, 10 Feb 2008 22:54:01 -0800, Osyris <Osyris@discussions.microsoft.com> wrote: Workgroup Security is an advanced topic. Do not attempt to use it un...

User in more than one user class?
Is it possible to add a user to more than one user class? We have a user who will temporarily need the accesses of another user class while retaining her current accesses. The only method I saw for adding the accesses is to do them individually for the user. Is there a better way to do this? Perhaps adding the user to the second user class temporarily or create a new user class with the accesses of the two classes in question? Thank you. For versions 9.0 and prior a user can only be in 1 security class at a time. -- Victoria Yudin Dynamics GP MVP Flexible Solutions, Inc. "d...

Custom User Forms
Hello All: I know.... "the only 'stupid' question, is the one that's not asked..... Hopefully, I won't look like "too" much of a novice. Here goes, I have a elderly user, who is not overly comfortable with using Excel, and is used to the "dumb terminal" approach of data entry. Not that I don't want her to learn, she is just extremely hesitant. Anyway, I would like to create a custom form for her to enter information into, which then populates a "hidden" worksheet. Would need to have a couple of Validation fields, i.e. o...