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: 4/10/2004 12:10:08 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 7 Views: 31 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
8 Items, 1 Pages 1 |< << Go >> >|
horatio05
Asp.Net User
ZoneIndex4/10/2004 12:10:08 AM

0/0

I see that they removed the ZoneIndex property from the WebParts in VS2005. My question is how are we supposed to get this ZoneIndex if we want to use the WebPartManager's MoveWebPart() function? I guess I could just cycle through a Zone's webParts until I find it, but that seems terribly inefficient. Are there any plans to address this? Thanks.
Fredrik N
Asp.Net User
Re: ZoneIndex4/10/2004 7:24:53 AM

0/0

The zoneIndex in the MoveWebPart() method will be used to specify where in the zone the webpart should be placed. For example, if you have 3 webparts in one zone, and you want to change the order of the webparts, you use the ZoneIndex.

For example the following code will move the first webparts in the first zone, and place it after the second webpart in the zone:

Webpartmanager1.MoveWebPart(Webpartmanager1.WebParts[0], Webpartmanager1.Zones.Item[0], 2)

If you want the webpart to be at the top of the zone, you will change the zone index to 0.

So there is no need to iterate through all of the zones to move a webpart to a specific zone.

/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
horatio05
Asp.Net User
Re: ZoneIndex4/12/2004 11:52:25 PM

0/0

But I want to move the webpart within its own zone, up or down, so I need to either increment or decrement that webpart's current ZoneIndex. In the scenario you are using I would have to know before hand where in the zone the webpart resides and where I want to move the webpart, but that is not always the case, especially if the user has the ability to drag and move the webparts around. I think they should keep the zoneindex property in the webparts or have some way of reaching it.
Fredrik N
Asp.Net User
Re: ZoneIndex4/13/2004 4:43:29 AM

0/0

Here is an example where you can get the zoneindex, maybe it's not so nice, but it will work:


Int index = Webpartmanager1.Zones.Item[0].WebParts.IndexOf((Webpartmanager1.WebParts.Item[0]));

index = index + 1;

Webpartmanager1.MoveWebPart(Webpartmanager1.WebParts.Item[0], Webpartmanager1.Zones.Item[0], index);



/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
Fredrik N
Asp.Net User
Re: ZoneIndex4/13/2004 5:55:57 AM

0/0

Here is a better example:


WebPartZoneBase myZone = Webpartmanager1.Zones["myZone"];
WebPart myWebPart = myZone.WebParts["myWebpart"];

int zoneIndex = myZone.WebParts.IndexOf(myWebPart);

zoneIndex++;

Webpartmanager1.MoveWebPart(myWebPart, myZone, zoneIndex);

/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
horatio05
Asp.Net User
Re: ZoneIndex4/13/2004 5:56:07 AM

0/0

It's not the prettiest solution I've ever used, but it's certainly not the ugliest :)
Thanks!
Fredrik N
Asp.Net User
Re: ZoneIndex4/28/2004 5:48:36 PM

0/0

In the Beta, Microsoft will probably add a public ZoneIndex property to the WebPart class.
/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
mharder
Asp.Net User
Re: ZoneIndex5/14/2004 5:56:18 PM

0/0

Yes, I can confirm that there will be a get-only WebPart.ZoneIndex property in the Beta. You still need to call WebPartManager.MoveWebPart() to change the ZoneIndex.
http://blogs.msdn.com/mharder

This posting is provided "AS IS" with no warranties, and confers no rights.
8 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Professional Web Parts and Custom Controls with ASP.NET 2.0 Authors: Peter Vogel, Pages: 449, Published: 2005
Mastering JavaBeans Authors: Laurence Vanhelsuwé, Pages: 799, Published: 1997
Professional ASP.NET 2.0 Server Control and Component Development Authors: Shahram Khosravi, Pages: 1186, Published: 2006
SharePoint 2007 Development Recipes: A Problem-Solution Approach Authors: Mark Gerow, Pages: 560, Published: 2008
MVS Systems Programming Authors: David Elder-Vass, Pages: 530, Published: 1993
Pro ASP.NET 2.0 in C# 2005 Authors: Matthew MacDonald, Mario Szpuszta, Pages: 1255, Published: 2005
Pro ASP.NET 2.0 Website Programming Authors: Damon Armstrong, Pages: 641, Published: 2005
今日からつかえるASP.NET2.0サンプル集 Authors: 山田/祥寛, Pages: 615, Published: 2007
ASP.NET 2.0 Web Parts in Action: Building Dynamic Web Portals Authors: Darren Neimke, Pages: 324, Published: 2007

Web:
WebPart.ZoneIndex Property (System.Web.UI.WebControls.WebParts) Gets the index position of a WebPart control within its zone.
WebPartMovingEventArgs.ZoneIndex Property (System.Web.UI ... Gets or sets the index position of a Web Parts control within its zone.
ZoneIndex - ASP.NET Forums I see that they removed the ZoneIndex property from the WebParts in VS2005. My question is how are we supposed to get this ZoneIndex if we ...
SharePoint: Web part import - zoneIndex doesn't work Unfortunately it turns out that zoneIndex only works if web parts are imported in sequence - so you'll need to make certain import is done in the proper ...
ISOTime xref -1) { 124 // no decimal seconds 125 endIndex = zoneIndex; 126 } else if( zoneIndex - s. ... + 4; 128 } else { 129 endIndex = zoneIndex; 130 } 131 String out ...
Customized MySite - SharePoint University 0 Microsoft.SharePoint.Portal.WebControls. RSSAggregatorWebPart Move ...
Adding a Web Part on My Site using Staplee Feature : Microsoft ... PageViewerWebPart TopZone 1 Add ...
Community Kit for SharePoint - Discussions Delete ... Microsoft.SharePoint.Portal . ...
FoodCandy: WebPartManager Class Reference void, AddWebPartPanel (WebPartPanel panel, WebPartZone zone, int zoneIndex). Programmatically adds a webpart panel to a zone at the specified index. ...
STSADM Custom Extensions: Move a Web Part on a Page Oct 2, 2007 ... stsadm -o gl-movewebpart -url "http://intranet/hr/pages/default.aspx" -title " Grouped Listings" -zone MiddleLeftZone -zoneindex 1 -publish ...




Search This Site:










skins, asp and html

free e-commrece module

dates, params, server times + local

how many web.config files

if textbox1.text = "" then

http 403.4 - forbidden: ssl required

new 1.1 installation on w2k & "server application error"

a problem when added btnname.attributes.add("onclick","return validate()");

2.x training videos

remote instal prob

calendar days only selectable from today

dnn we.config not allowing other virtual directories to work

treeview callback, populateondemand problem....

checking int value for checkbox

inline aspx page include

accessing fields from a class under the app_code folder.

which starter kit?

good wysiwyg editor for mac/pc

any suggestions?

how to play media file from dynamic sql url, possible paid work

how do i add a windows user to the aspnet_users table?

user.isinrole not showing as true?

getting user info from ldap

problem adding users to selected role - (always adds to first role)

can logging application block listen to and log system.diagnostics.trace.write*() statements

recover password by giving email address.

wcf & json response

sql database

search engine

web application deploy

 
All Times Are GMT