Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

UserControl Argument Array

Posted on 2014-04-01
2
Medium Priority
?
338 Views
Last Modified: 2014-04-02
Hi all,

I have an usercontrol class whereby I bubble click methods back to the parent ASPX page to dynamically load other usercontrols (much like a wizard).

As the moment I simply call OnBubbleClick(nextUserControlName); which is caught back on the aspx and loads the next control to the updatepanel

Now a couple of my usercontrols now require different variables to be set. For example I have a Page.ascx where I want to pass across a ID field to pull the relevant text from a database and also and Error.ascx where I will pass an error message and error dump to be displayed.

I have been thinking of the best way about this and thought about changing the OnBubbleClick(nextUserControlName) to be;

OnBubbleClick(string nextUserControlToLoad, string[,] args)

Open in new window


so in this situation i would just pass string['ID', '2'] and in the page load for the page.ascx test for the ID field being present

in the error case string['message', 'error message',  'dump', 'error dump']

does this sound the best way of going about things?

Also, in this case how would I 'search' the array on the page load? and would this have any impact on performance from say, creating types and test for these?
0
Comment
Question by:flynny
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 36

Accepted Solution

by:
Miguel Oz earned 2000 total points
ID: 39970538
I would use a dictionary so it is easier to identify/get the keys you are using:
OnBubbleClick(string nextUserControlToLoad, Dictionary<string, string> args)

Open in new window


Note: Another option (if you found yourself repeating the same name value constructs) is to create a class with Id, Message and Dump as public properties.
0
 

Author Closing Comment

by:flynny
ID: 39971533
thanks I was thinking this may be the bast way to go about but just wanted a second opnion
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question