CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: NewsGroup Date Entered: 6/4/2007 9:52:46 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 25 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
tAiRoN
Asp.Net User
Same ascx file different information..6/4/2007 9:52:46 PM

0/0

Is there a way to add the same webpart twice but with different variables so that they for example can display two different lists of information from a database?

 Example..
Webpart catalogue:
Newswebpart 1, news.ascx, displays sports news
Newswebpart 2, news.ascx, displays science news

Thanks in advance!

jackyang
Asp.Net User
Re: Same ascx file different information..6/4/2007 11:00:56 PM

0/0

Sure, just expose a property from your usercontrol e.g.: NewsType.


Jack Yang
.NET Developer
tAiRoN
Asp.Net User
Re: Same ascx file different information..6/5/2007 6:56:48 AM

0/0

Thanks Jack,
How do I expose propertys when adding the webparts from the web catalogue?

jackyang
Asp.Net User
Re: Same ascx file different information..6/5/2007 12:57:28 PM

0/0

Assume you have defined news types, then in your usercontrol codebehind:

// a private field
private NewsType _newstype = NewsType.World;

// property exposed
public NewsType UserControlNewsType
{
    set
    {
        _newstype = value;
    }
}

// your private method
private void displayNews()
{
    ...
    if (_newstype.Equals(NewsType.World))
    {
        // run world news code
    }
    else if (_newstype.Equals(NewsType.Sport))
    {
        // run sport news code
    }
    ...
}

When you use this usercontrol in view page mode, you will notice this UserControlNewsType can be set to different types. It will show up in IntelliSense as well in codebehind when you use it.


Jack Yang
.NET Developer
4 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional DotNetNuke 4: Open Source Web Application Framework for ASP.NET 2.0 Authors: Shaun Walker, Joe Brinkman, Bruce Hopkins, Scott McCulloch, Patrick J. Santry, Chris Paterra, Scott Willhite, Dan Caron, Pages: 517, Published: 2006
Professional C# Authors: Simon Robinson, Christian Nagel, Karli Watson, Jay Glynn, Morgan Skinner, Bill Evjen, Pages: 1224, Published: 2004
Pro ASP.NET 3.5 in C# 2008 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1498, Published: 2007
Microsoft Sharepoint: Building Office 2007 Solutions in VB 2005 Authors: Scot P. Hillier, Pages: 552, Published: 2007
Beginning DotNetNuke Skinning and Design: Skinning and Desing Authors: Andrew Hay, Nina Meiers, Shaun Walker, Pages: 432, Published: 2007
Building Websites with the ASP.NET Community Starter Kit Authors: Cristian Darie, K. Scott Allen, Pages: 284, Published: 2004
Mastering ASP.NET with C# Authors: A. Russell Jones, Pages: 816, Published: 2002
Beginning ASP.NET 1.0 with Visual Basic.NET: With Visual Basic .NET Authors: Chris Goode, John Kauffman, Rob Birdwell, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Ollie Cornes, Dave Sussman, Matt Butler, Gary Johnson, Chris Ullman, Ajoy Krishnamoorthy, Juan T. Llibre, Pages: 816, Published: 2002
Developing Web Applications with Visual Basic.NET and ASP.NET Authors: John Alexander, Billy Hollis, Pages: 400, Published: 2002
Beginning ASP.NET 2.0 Authors: Chris Hart, John Kauffman, Chris Ullman, David Sussman, Pages: 759, Published: 2005

Web:
Page-level caching, or passing data between different ascx:s And next time (when another ascx-file called from the same aspx-file requests ... and and have ascx-files make information available for other ascx-files. ...
Multiple *.ascx files with a single *.ascx.cs in VS.NET 2003 structure, but keeping the codebehind files (*.ascx.cs) at the original location (and only once, as the functionality should remain the same ...
Why both .htm and .ascx files are in skin package? - ASP.NET Forums I'm confused as why there is both .htm and .ascx file for a skin. .... would just be fixing up path information for a different portal. ...
How to: Customize Mobile Home Pages If two or more custom rendering templates have the same ID, ... Save the .ascx file and reset Internet Information Services (IIS) to effect your changes. ...
User Control definitions - .NET ASP files, I would have a different body tag than if I loaded the "ft2..." files. The problem is that if the is not in the same .ascx ...
how to call multiple .ascx files? - VB.NET but i have problem to call the Answer List. b'coz i've created different user control file (.ascx) for different type of question...for ...
.NET ASP.NET ascx is ambiguous in the namespace ASP Duplicate could also mean here that you have same ascx file in multiple ... example pages in same directory, referencing UC's from different ...
Super Easy Customization of Citrix Web Interface 4.x - JasonConger.com There are two different layout.ascx files for every Web Interface site. ... 2003 at the same time they were migrating from Citrix MetaFrame ...
bjornbats.nl - Web Interface Mar 6, 2007 ... All Server based computing news and information, Citrix Web ... There are two different layout.ascx files for every Web Interface site. ...
Multiple same ajax-enabled-web-controls with single sharing client ... Microsoft, Information Technologies. ... inside the ascx file, there will be multiple layout of same javascript blocks with functions of the same name, ...




Search This Site:










httprequestvalidationexception - why is this invalid?

questions about container

exception occured : retrieving the com class factory for component with clsid {...} failed due to the following error: 80070005.

creating the pubs database problems

asp.net application is runing very slow on windows server 2003 web edition

sample dnn3 skin?

converting html special chars?

response.redirect

web reference error???

add a picture to asp.net profile system

server problem or page problem for send email

? global resource files .resx

password protected folder rather than using roles?

user log in control

how to use regular expression validator

how do i get the contacts sample to compile?!?!

another inheritance question

error registering new module definition in dnn 3.1

detailsview help for newbee

common procedure

show off your portal!

getting started with visual studios 2003

problem to move dnn 3.0.7 to the server!

unable to open web project file via visual studio

login redirect by role or user?

background color

screencapture?

is personalization supported

2.0 app_code compile issue?

number of online members

 
All Times Are GMT