CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.web_parts_and_personalization Tags:
Item Type: Date Entered: 3/26/2006 3:16:42 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 2 Views: 47 Favorited: 0 Favorite
3 Items, 1 Pages 1 |< << Go >> >|
"vindicator" <>
NewsGroup User
CreateWebPart w/ Editable Properties3/26/2006 3:16:42 PM

0

I've been looking to override the WebPartManager's CreateWebPart to return a customized WebPart that contains properties that will appear when the part is edited.

I have created a Class that Inherits from WebPart and added some Personalizable, WebBrowsable Properties.

Now, I want those Properties to be available to Controls that were placed in the ZoneTemplate of a WebPartZone.

In the overridden CreateWebPart function, I try to return my own customized WebPart Class where I pass in the control and it gets added in the CreateChildControls, but it pukes because it isn't of type GenericWebPart.

I tried creating a Class that Inherits from GenericWebPart and just copying those properties from the customized WebPart Class into it, but I'm afraid they wouldn't apply since it is a GenericWebPart.

My Q: What needs to happen to have complete control over the CreateWebPart method?

Thanks,
Nathan

"mharder" <>
NewsGroup User
Re: CreateWebPart w/ Editable Properties3/28/2006 6:17:49 PM

0

The issue is that GenericWebPart.WebBrowsableObject returns the ChildControl, not the GenericWebPart itself.  This means the PropertyGridEditorPart will show the properties on the ChildControl, not on the GenericWebPart.

The best solution is probably to write a custom EditorPart for your custom GenericWebPart, then return this from the CreateEditorParts() method.

-Mike

http://blogs.msdn.com/mharder

This posting is provided "AS IS" with no warranties, and confers no rights.
"DWS400" <>
NewsGroup User
Re: CreateWebPart w/ Editable Properties4/1/2006 2:01:50 PM

0

This is more clear.  Property grid editor shows webbrowsable attributes

You add the webbrowsable attribute to the personalized property.

This will automatically show up in the property grid editor when edit is selected on the webpart.  Make sure you have an editorzone with a propertygrid editor part.

<WebBrowsable(

True)> <Personalizable()> _

Public Property Feed() As String

Get

Return _feed

End Get

Set(ByVal value As String)

_feed = value

End Set

End Property

Private _feed As String

Caution never ever absolutely do not put webbrowsable attribute on an enumeration, trust me on this one.  You'll loose all of your personalization on null attribute error.

Good Luck

DWS

Just in case I added the code from my control webpart base class IWebeditable region.  I add a custom editor right on to the webpart.  then I add a button to the editorparts collection.

#

Region "Iwebeditable"

Public Overridable Function CreateEditorParts() As System.Web.UI.WebControls.WebParts.EditorPartCollection Implements System.Web.UI.WebControls.WebParts.IWebEditable.CreateEditorParts

Me.EnsureChildControls()

'Add the IWebpart Editor

Dim panel As Panel

panel =

Me.getpnlWebPart

If Not panel Is Nothing Then

panel.Controls.Add(

New DWS.Web.Editors.IWebpart(Me.WebPart, panel.ClientID))

End If

'Add the simple button to the editorpart collection

Dim EditorArray As New ArrayList

Dim xx As New DWS.Web.Editors.EShowWebpart

xx.ID =

Me.ID & "_simpleeditbutton"

EditorArray.Add(xx)

Dim editorParts As New EditorPartCollection(EditorArray)

Return editorParts

End Function

Public ReadOnly Property WebBrowsableObject() As Object Implements System.Web.UI.WebControls.WebParts.IWebEditable.WebBrowsableObject

Get

Return Me

End Get

End Property

#

End Region

visit www.dws400.com for more webpart inspiration

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:













force ssl

how to encrypt a connection string

impersonation problem in iis

“accessfile is not valid:” error when attempting to access a virtual directory app_data folder with an app using membership.

my ie6.0 will not save my windows login....

environment.username returns different values at different times

webrequest.preauthenticate() method

how to programatically grant permission for role based authorisation

anonymousidentification for shopping cart question

allow users to edit profile

how come are ie and firefox different on windows authentication

asp.net website administration tool

i'll describe you how i care about security and you'll tell me what's wrong

login control - onloggedin problem

authentication timeout expiring early

seperate membership database and application database? is ok?

dsa vs rsa.

win authentication and forms

jumble a string...simple really

help with redirection after session timeout

problem with access rights on web pages.

checking for poison null byte

getprofile for other users sets them online

two applications being created when running asp.new configuration

login won't complete when opera browser is used.

formauthentication problem.

context.user.identity.name returning empty string

accessing user.provideruserkey through page.user

aspnet.mdf using custom forms to manage

security using sessions?

forms authentication and writing to a xml file

authentiction requirements and adviced method

hybrid logins - i don't see this mode covered

c# sharp login in asp.net (validating againast a database)with session

help setting up multiple asp.net sites and security

[soap - certificatepolicy] system.net.webexception

using profilecommon

simple membership

xmlsitemapprovider not returning roles for web.sitemap

how do i redirect the user base on role

http header error!

forms authentication with active directory in multiple domains in asp.net 2.0 fails if one domain credential is incorrect

help..security gates

asp.net 2.0 access rules storage place

active directory membership provider operations

check which role...

make an assembly (not a web project) run as a specific user

redirect users to the main page through web.config

help: unsuccessful getting windows login name

checking user credential in asp.net page

   
  Privacy | Contact Us
All Times Are GMT