473,388 Members | 1,327 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Passing An object to a UserControl

In ASPX, is it possible to pass an object , for example an arraylist to a
public property? something like this....

<uc1:test id="myUserControl" runat="server"
List='<%=_myArrayList%>'></uc1:test>

I know I can use:
myUserControl.List = _myArrayList;

But I just want to see if it is possible to shorten the code. Thanks


Nov 19 '05 #1
1 1475
I do not do it personally, but the answer is yes. You will likely want to
expose it through a property or a method, however.

Be careful when bouncing from programatic control of the page to declarative
control. It is easy to make a mistake when you are mixing metaphors.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
"Zean Smith" wrote:
In ASPX, is it possible to pass an object , for example an arraylist to a
public property? something like this....

<uc1:test id="myUserControl" runat="server"
List='<%=_myArrayList%>'></uc1:test>

I know I can use:
myUserControl.List = _myArrayList;

But I just want to see if it is possible to shorten the code. Thanks


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Curtis Justus | last post by:
Hi, I currently have a control that is on a form and I want to pass that exact instance of the control to another form (a child form that appears on a button click). The control has state,...
2
by: Dave Veeneman | last post by:
Is there a simple way to pass drag-and-drop events to a child control in a UserControl? Here's an example: I have created a UserControl which contains a treeview and some text boxes. I want to...
4
by: Stijn Goris | last post by:
Hi all, I place a usercontrol (2) on another usercontrol (1). The second usercontrol has a button. Is there a way usercontrol (1) can know when the button is clicked on usercontrol (2) without...
0
by: Neelima Godugu | last post by:
Hi All, I have developed a windows forms user control, which I am going to host in Internet Explorer.. I am familiar with the security settings requirement inorder to do the above. I have...
9
by: Peter | last post by:
I have an Usercontrol on a WebForm, on this Usercontrol is a button, I want to save data that's residing on the WebForm when user clicks on the button that's on the UserControl. How do I call a...
3
by: Dan Nash | last post by:
Hi I'm new to C#, moving from ASP, and slightly confused so bear with me! Basically I've got 4 pages, each of which runs the same user control (some header information). I want to be able to...
2
by: Just Me | last post by:
A control on a UserControl has it's mouseup event raised. I want the usercontrol to pass it on. That is , I want the form containing the UserControl to receive a MouseUp event from the...
4
by: Tarun Mistry | last post by:
Hi, i have a page with a user control on it, the uc is a form with a submit button. On submitting, how do I make the call get picked up by the webform the user control is in? Alteratively, is...
5
by: Tarun Mistry | last post by:
Hi all, is it possible to update a usercontrol before it is rendered? In my scenario I have a Page with a usercontrol on it. When a button is clicked on the Page, I want to update the...
9
by: Chris | last post by:
Ok, so I have this sub I wrote, and I create a new instance of a UserControl: ctrlAPs tempctrl = new ctrlAPs(); Now, I would like to be able to use this sub I wrote for more than one...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.