Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / February 2006

Tip: Looking for answers? Try searching our database.

Web User Controls

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jonathan Wood - 16 Feb 2006 18:28 GMT
Okay, as evidenced by other questions, I am an experienced programmer very
new to ASP.NET.

I have a vertical navigation bar. It is all one color with several panels
inside it with a different color. It looks okay but I'm wondering if each of
these several panels should be Web User Controls themselves.

I think this would make sense, and I can figure out how to add a property
that specifies the image that appears at the top of each of these panels.
However, what I'm not sure about is how to handle the fact that each panel
can have any number of hyperlinks in it.

Is there a straight forward way to have a user control accept a list of
items (preferrably, within the IDE)?

Thanks!

Signature

Jonathan Wood
SoftCircuits
http://www.softcircuits.com
Available for consulting: http://www.softcircuits.com/jwood/resume.htm

Hans Baumann - 16 Feb 2006 22:45 GMT
> Okay, as evidenced by other questions, I am an experienced programmer very
> new to ASP.NET.
>
> I have a vertical navigation bar. It is all one color with several panels
> inside it with a different color. It looks okay but I'm wondering if each
> of these several panels should be Web User Controls themselves.

Yes you can. Actually I've done that, you can see in www.selered.com the
left vertical navigation bar is a web user control

> I think this would make sense, and I can figure out how to add a property
> that specifies the image that appears at the top of each of these panels.
> However, what I'm not sure about is how to handle the fact that each panel
> can have any number of hyperlinks in it.

I guess your control has two levels of navigation hieracy

You can seek this steps:
1 You can create a web control, inside you can put a repeater will all the
features you need, but make sure your repeater is populated by a dataset
public property (the second navigation level that reads the content from a
first level navigation field/id) in your web control. Also the image on the
top or your web control is referenced by another public property.
2 On your web form, you populate a repeater, datagrid, datalist, etc with a
dataset (or similar), containing the first navigation level. Make sure that
dataset has the field that is needed to get the second dependant level
3. Declare a public function in your web control, that recieves the first
navigation field value and return the dataset containing the whole second
level navigation.
4. In the item template of your repeater/datagrid/etc, insert the custom
control tag of your web user control, and declare the dataset public
property like this:

<myns:uxtag id="mywebusercontrol" runat="server"
MyDataSetProperty='<%#MyPublicFunction(DataBinder.Eval(Container.DataItem,
"myfield")%>'  />

this will resolve the dataset at "render-time"

5. Fill your repeater/datagrid and "DataBind" it...

Another more simple way to acomplish this is using xml/xslt in a
LiteralControl... he he... choose the one you like most.... I've done both
of them, the xsl is only when I don't need to generate postbacks, the web
user control solution is more in a extense web app with reusable components
that generates events... etc.

> Is there a straight forward way to have a user control accept a list of
> items (preferrably, within the IDE)?

If you want that you have to create a custom control, which is more
complicated but more user-friendly at design time.

> Thanks!

Hope I have been clear enough, enjoy!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.