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: 11/22/2003 2:25:55 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 4 Views: 21 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
5 Items, 1 Pages 1 |< << Go >> >|
guam-aspdev
Asp.Net User
Unable to change WebPartDisplayMode when WebForm uses Master Page11/22/2003 2:25:55 PM

0/0

Hi everyone,

I?ve run into a little snag?I?m hoping it might just be an alpha thing. I?ve been trying to do an integrated example for an article on developing WebParts I?m working on, so I wanted to combine several Whidbey technologies at the same time, to demonstrate 2.0?s ease of migration and also to show how easy it is to actually build and manage something quickly.

I?m for some reason unable to modify the WebPartDisplayMode of a page when a .ASPX page is using a Master Page. I wrote the code for it, but it won?t seem to take, and on post back, just says in the default Normal mode, instead of going into Design mode or one of the other choices from the WebPartDisplayMode enumeration.

Here's scenario: I've got a series of user controls contained in a number of WebParts in a Content control on a WebForm. The page has a main header, footer and navigation bar on the left, all 3 of which are served from a Master page to define layout. Without the Content control, it works perfectly, allowing me to toggle between Normal and Design modes. But when I apply the Master Page, it won't change on post back.


Anyone else run into this?

Jas


guam-aspdev
Asp.Net User
Re: Unable to change WebPartDisplayMode when WebForm uses Master Page11/23/2003 12:34:15 AM

0/0

Check that...I was able to get the WebParts to get into Design mode, but only by setting the WebPartsDisplayMode enumeration to "Display" in Page_Load. It's probably something with my code, but if anyone has run into this problem, please chime in.

Jas
Fredrik N
Asp.Net User
Re: Unable to change WebPartDisplayMode when WebForm uses Master Page11/23/2003 8:40:26 AM

0/0

It works fine for me.

I also have some small problem from the beginning. Here is what I have done to make it work;

I?ve added the WebPartManager into the MasterPage it self.
I also put the code that changes the mode of the WebPartManager into the MasterPage:


WebPartManager.Current.SetDisplayMode(WebPartDisplayMode.Edit);


<asp:linkbutton runat="Server" id="perzonalizeWorkspace" onclick="personalize_Click">Personalize this page</asp:linkbutton>


void personalize_Click(object sender, System.EventArgs e)
{
WebPartManager.Current.SetDisplayMode(WebPartDisplayMode.Edit);
}

Maybe you wonder why I put it into the MasterPage. It?s because I will use WebParts in all of my pages and it?s a good place to add it.


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

Cornerstone

My Blog, ASP.Net 2.0 etc
guam-aspdev
Asp.Net User
Re: Unable to change WebPartDisplayMode when WebForm uses Master Page11/23/2003 8:53:19 AM

0/0

Good idea. I considered that, but I only need WebParts in some of my pages, and my Master Page layouts are more universal. I'll keep that in mind.
Fredrik N
Asp.Net User
Re: Unable to change WebPartDisplayMode when WebForm uses Master Page11/23/2003 9:34:04 AM

0/0

Here is a code that works fine. I have a WebPartZone in a content control. Is your code similar to this?

<%@ page language="C#" master="~/default.master"%>
<%@ register tagprefix="uc1" tagname="myControl" src="~/myControl.ascx" %>

<script runat="server">

void edit(object s, EventArgs e)
{
WebPartManager.Current.SetDisplayMode(WebPartDisplayMode.Design);
}

</script>

<asp:content contentplaceholderid="content" runat="Server">


<asp:webpartmanager id="WebPartManager1" runat="server"></asp:webpartmanager>

<asp:linkbutton onclick="edit" runat="Server">Edit</asp:linkbutton><br />

<asp:webpartzone id="WebPartZone1" runat="server">
<zonetemplate>
<asp:contentwebpart id="ContentWebPart1" runat="server">
<contenttemplate>
Test....
</contenttemplate>
</asp:contentwebpart>
</zonetemplate>
</asp:webpartzone>
<asp:webpartzone id="WebPartZone2" runat="server">
<zonetemplate>
<uc1:mycontrol id="MyControl1" runat="server"></uc1:mycontrol>
</zonetemplate>
</asp:webpartzone>
</asp:content>

This is something that doesn?t belong to your question and maybe you already knew this: You can create nested master pages, so you can create a main master page that two other master pages inherit. In this way you can create two sub master pages, one that has web part support and one that doesn?t. Like you I have also built a demonstration site that should have pages that doesn?t use web parts and some pages that will use web parts. The purpose is to demonstrate all the new features, including nested master pages.
/Fredrik Norm?n NSQUARED2
Microsoft MVP, MCSD, MCAD, MCT

Cornerstone

My Blog, ASP.Net 2.0 etc
5 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Unable to change WebPartDisplayMode when WebForm uses Master Page ... Unable to change WebPartDisplayMode when WebForm uses Master Page. Last post 11- 23-2003 4:35 AM by Fredrik N. 4 replies. Sort Posts: ...
ng.asp-net-forum.web_parts_and_personalization/58 - Asp Net Unable to change WebPartDisplayMode when WebForm uses Master Page, 4, 4, 11/23/ 2003 9:34:04 AM. Is a WebPart = IBS Module? 1, 7, 11/14/2003 5:22:55 PM ...
Portals with Web Part Pages footer (which you can create easily with master pages). ..... erty, which is a collection of WebPartDisplayMode items, and verify whether the mode is ...
Chapter Chapter 14.5) uses roughly the same master page-based theme selection mechanism used in ...... Retrieve the WebPartDisplayMode object for this mode ...
Unable to change WebPartDisplayMode when WebForm uses Master Page ... Unable to change WebPartDisplayMode when WebForm uses Master Page. Last post 11- 23-2003 4:35 AM by Fredrik N. 4 replies. Sort Posts: ...
ng.asp-net-forum.web_parts_and_personalization/58 - Asp Net Unable to change WebPartDisplayMode when WebForm uses Master Page, 4, 4, 11/23/ 2003 9:34:04 AM. Is a WebPart = IBS Module? 1, 7, 11/14/2003 5:22:55 PM ...
Portals with Web Part Pages footer (which you can create easily with master pages). ..... erty, which is a collection of WebPartDisplayMode items, and verify whether the mode is ...
Chapter Chapter 14.5) uses roughly the same master page-based theme selection mechanism used in ...... Retrieve the WebPartDisplayMode object for this mode ...
Unable to change WebPartDisplayMode when WebForm uses Master Page ... Unable to change WebPartDisplayMode when WebForm uses Master Page. Last post 11- 23-2003 4:35 AM by Fredrik N. 4 replies. Sort Posts: ...
ng.asp-net-forum.web_parts_and_personalization/58 - Asp Net Unable to change WebPartDisplayMode when WebForm uses Master Page, 4, 4, 11/23/ 2003 9:34:04 AM. Is a WebPart = IBS Module? 1, 7, 11/14/2003 5:22:55 PM ...




Search This Site:










get id of record you just inserted

question about how trap events

catalook module

datagrid help

using web.config from a windows service

using form authentication, but validating against domain accounts

trim string to fit in fixed width table cell [edited by adec, moderator]

validating client machines

error installing gallery in dnn3.0.12

personalized url

smtp error

creating dynamic pages

after hosting files, problems accessing folders/global.asax.cs file session variables / external classes please help

publishing asp .net project on a local web server (iis)

testing 3.0.8 upgrade reflection problem

caching code that binds a drop down

drilldown using a datalist

capturing button_click event from master page

crl checking

is it possible to use email instead of username?

impersonation/uploading to a network location

database name

using vs .net to write your asp.net application

a new question!

read in id's of all instances of a custom control within cached user control

file upload classes

new line in constant error

custom controls and vs.net designer ...

dnn user and asp net membership

tree view functionality

 
All Times Are GMT