Solved

UserControl Argument Array

Posted on 2014-04-01
2
308 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 500 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

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
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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