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: 8/11/2006 3:31:31 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 6 Views: 38 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
7 Items, 1 Pages 1 |< << Go >> >|
Zalihe
Asp.Net User
Disable Verbs8/11/2006 3:31:31 PM

0/0

    Hi,

im very desperate here, my hair is comingo uti n chunks

ive looked everyehere, and on these forums are as well but its not making sense,  im very dippy.

any way the problem:

I have a aspx page where the outline of my webpartmanger control sits.

also on the paghe i have one webpartzone as well as an editor zone

within this one webpartzone, i have a zone template and within this tempalte i have two usercontrols.
one usercontrol is my webpart called useful links, and the other usercontrol is called my forums. 
on my forums user control i have three panels doc formuns, ad forums and latestest posts formuns,  in my editor i have three checkboxes which when ticked can personal the page according to user.

the problem is i do not want the Edit verb to appear on the useful links web part but it is.  How do i disable this?
Maybe some of my code can make things clearer!

<!--DEFAULT.aspx-->
                            <asp:WebPartZone ID="WPRightPanel" runat="server" HeaderText="Your Sections" EmptyZoneText="" EditVerb-Visible="true" CloseVerb-Text="X" MinimizeVerb-Text="Min" RestoreVerb-Text="Max" Padding="2" >
                            <MenuLabelStyle ForeColor="White" />
                                <PartChromeStyle Font-Names="Verdana" ForeColor="White" />
                                <MenuLabelHoverStyle ForeColor="#E2DED6" />
                                <EmptyZoneTextStyle Font-Size="0.8em" />
                                <MenuVerbHoverStyle BackColor="#F7F6F3" BorderColor="#CCCCCC" BorderStyle="Solid"
                                     BorderWidth="1px" ForeColor="#333333" />
                                <HeaderStyle Font-Size="0.7em" ForeColor="#CCCCCC" HorizontalAlign="Center" />
                                <MenuVerbStyle BorderColor="#5D7B9D" BorderStyle="Solid" BorderWidth="1px" ForeColor="White" />
                                <PartStyle Font-Size="0.8em" ForeColor="#333333" />
                                <TitleBarVerbStyle Font-Size="0.6em" Font-Underline="False" ForeColor="Black" />
                                <MenuPopupStyle BackColor="#5D7B9D" BorderColor="#CCCCCC" BorderWidth="1px" Font-Names="Verdana"
                                     Font-Size="0.6em" />
                                <PartTitleStyle BackColor="Gray" Font-Bold="True" Font-Size="0.8em" ForeColor="Black" />
                               
       
                                <ZoneTemplate>
                                    <ucUsefulLinks:UsefulLinks ID="UsefulLinks1" runat="server" />
                                    <ucForums:Forums ID="Forumns1" runat="server" />
                                </ZoneTemplate>
                               
                            </asp:WebPartZone>
<!--USefullinks.ascx-->
<!--I tried the code in the prerender to see if it worked but nothing-->
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls


Partial Class usefulLinks1
    Inherits System.Web.UI.UserControl
    Implements System.Web.UI.WebControls.WebParts.IWebPart

    Private _catalogImageUrl As String = String.Empty
    Private _description As String = String.Empty
    Private _subTitle As String = "[0]"
    Private _title As String = "Useful Links"

    Public Property CatalogIconImageUrl() As String Implements IWebPart.CatalogIconImageUrl
---

    Public Property Description() As String Implements IWebPart.Description
---

    Public ReadOnly Property Subtitle() As String Implements IWebPart.Subtitle
---

    Public Property Title() As String Implements IWebPart.Title
---
    Public Property TitleIconImageUrl() As String Implements IWebPart.TitleIconImageUrl
---
    Public Property TitleUrl() As String Implements IWebPart.TitleUrl
---
    Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
---
        Dim a As New System.Web.UI.WebControls.WebParts.WebPartZone
        a.EditVerb.Visible = False
        a.EditVerb.Enabled = False
        a.EditVerb.Text = ""
    End Sub    'OnPreRender
End Class
<!--Forumns.ascx-->
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Collections
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls


Partial Class forums1
    Inherits System.Web.UI.UserControl
    Implements System.Web.UI.WebControls.WebParts.IWebPart


    Protected _Forums As Boolean = True

    Protected _Posts As Boolean = True

    Protected _Ads As Boolean = True

    Private _catalogImageUrl As String = String.Empty
    Private _description As String = String.Empty
    Private _subTitle As String = "[0]"
    Private _title As String = "Forums"

    <Personalizable(PersonalizationScope.User), _
    WebBrowsable(), _
    WebDisplayName("Show Most Active Forums"), _
    WebDescription("Use this property to show/hide Most Active Forums")> _
    Public Property Forumns() As Boolean
---

    <Personalizable(PersonalizationScope.User), _
     WebBrowsable(), _
     WebDisplayName("Show Latest Posts"), _
     WebDescription("Use this property to show/hide Latest Posts")> _
    Public Property Posts() As Boolean
---

    <Personalizable(PersonalizationScope.User), _
     WebBrowsable(), _
     WebDisplayName("Show Personal Ad's"), _
     WebDescription("Use this property to show/hide Personal Ad's")> _
    Public Property Ads() As Boolean
---

    Public Property CatalogIconImageUrl() As String Implements IWebPart.CatalogIconImageUrl
---

    Public Property Description() As String Implements IWebPart.Description
---

    Public ReadOnly Property Subtitle() As String Implements IWebPart.Subtitle
---

    Public Property Title() As String Implements IWebPart.Title
 ---

    Public Property TitleIconImageUrl() As String Implements IWebPart.TitleIconImageUrl
---

    Public Property TitleUrl() As String Implements IWebPart.TitleUrl
---

    Protected Overrides Sub OnPreRender(ByVal e As EventArgs)

        If Forumns = True Then
            pnlActiveForum.visible = True
        Else
            pnlActiveForum.visible = False
        End If

        If Posts = True Then
            pnlPost.visible = True
        Else
            pnlPost.visible = False
        End If

        If Ads = True Then
            pnlAd.visible = True
        Else
            pnlAd.visible = False
        End If

    End Sub    'OnPreRender
End Class


I do hope soemone can help me soon.

Many thanxz in advance.

Zal


TeunD
Asp.Net User
Re: Disable Verbs8/14/2006 11:20:59 AM

0/0

This is typically one of those things that you can modify in a web server control that derives from System.Web.UI.WebParts.WebPart, but not from a UserControl.

However, there are some possible workarounds:

1. Implement the IWebActionable interface on the user controls code behind, return WebPartVerbCollection.Empty from it, but keep a reference. At PreRender, Disable the Edit Verb in the collection (which will be added by the Zone)

2. Make a custom Zone, that recognizes your control and sets AllowEdit to false on the GenericWebPart wrapper

3. Create a derived version of GenericWebPart that knows your control and create a custom webPartManager that reurns your wrapper instead of GenericWebPart from CreateWebPart()... nope, don't go there

Advice: go for option 1.

Zalihe
Asp.Net User
Re: Disable Verbs8/14/2006 3:05:16 PM

0/0

TeunD,
Thanxz for your advise, i opted for option 1, but im stil stuck maybe you can further help me or maybe someone else out there can shed some light.

I have disabled the edit-enable attribute from the webpart.
i then went into my user control for foerumns and further added a readonly property called verbs as the webpartverbscollection and created a new verb and on the address of directed to a protected sub called EditClicks.  the problem now that i dont know exactly what to write in this sub.

ive tried declareing an instance of the currentwebpartmanager and also declaring a varible set ot the editdisplaymode, but it doestn like the editMode.IsEnabled = true or my me.allowEdit = true

HELP!!!!!!!!

Zal

I am trying very hard but these wb parts are not my thing, and the silly thing is i dsuggested them. :)
TeunD
Asp.Net User
Re: Disable Verbs8/15/2006 7:22:26 AM

0/0

Zal,

My apologies; thisturns out to be a lot harder than I initially thought.

Setting the AllowEdit property of your part to False will prevent your part from being edited. You can just set the AllowEdit="False" property on your user control (VS.NET will put squigglies under it, but never mind). When you try to edit this part, the Edit zone will show, but will have no ToolParts loaded.

This is not what you want: you want the verb to disappear. This turns out to be hard. Adding custom verbs to a part is easy, but removing them is not. The snippet below gives you an example of how to create acustom zone with acustom WebPartChrome that will make your verbs disabled where Editing is not allowed. Setting Visible to false will turn of the verb for other web parts in the same zone as well (or rather: all parts after the one with AllowEdit=false).

    public class HideEditZone : WebPartZone
    {
        public HideEditZone()
        {

        }
        protected override WebPartChrome CreateWebPartChrome()
        {
            return new MyChrome(this, this.WebPartManager);
        }

    }
    public class MyChrome : WebPartChrome
    {
        public MyChrome(WebPartZoneBase zone, WebPartManager mgr)
            :
            base(zone, mgr)
        { }

        protected override WebPartVerbCollection FilterWebPartVerbs(WebPartVerbCollection verbs, WebPart webPart)
        {
            WebPartVerbCollection defaultResult = base.FilterWebPartVerbs(verbs, webPart);
            foreach (WebPartVerb verb in defaultResult)
            {
                if (verb == this.Zone.EditVerb)
                {
                    verb.Enabled = webPart.AllowEdit;
                }
            }
            return defaultResult;
        }
    }

Zalihe
Asp.Net User
Re: Disable Verbs8/15/2006 4:01:54 PM

0/0

Hey TeunD,

Thanxz for all your help.  ive come to the conclusion that i dont like sweb parts. :(

havent really got time to customize my own classes.  so instead i have assigned the editable verb to all the web parts and they all are able to update the title of the web part in the menu section. 

isnt wonderful, but is ok as a user can now call it my forums rather han forums.

Zal

if anyone reading this does manage to come up wityh some sort of soultion please post it, as im pretty sure that i am not the only person in the world who wishes to do this.

"A man who asks a question is a fool for five minutes a man who never asks a question is a fool forever" - Chinese Proverb.


TeunD
Asp.Net User
Re: Disable Verbs8/17/2006 10:19:25 AM

0/0

I did a short write-up of my attempts to achieve what Zal asked for (which sounded perfectly reasonable to me). I would really appreciate it when someone from the ASP.NET team (Mike?) could respond to this.

Maybe I tried to solve this the wrong way, maybe there is a perfectly good reason for the observed behavior. I would really like to know.

 

Thanks,

Teun
http://www.teuntostring.net/blog/

Arjun Tiwari
Asp.Net User
Re: Disable Verbs3/9/2007 11:47:33 AM

0/0

Hi,

 

I was just trying to find out some help but I didn't find anything to disable verbs.

I did some rnd at my own end and got the result. Please find the below js that will solve the problem. Please let me know your input.

 

<script type="text/javascript">

function HideWebpartLevelMenu(ctrlID,showMenu)

{

/*

Arjun Tiwari

Hide edit or delete or any webpart menu that has not permission on

LTrim, RTrim and trim function is required as supporting function to trim the spaces

09032007

*/

/*WebPart_wp786936923VerbsMenu

syntax Prefix = WebPart_

controls part.UniqueID

suffix VerbsMenu

LTrim(temp[menucounter].innerText.toString().toLowerCase())

get the webpart name, possiblity is $ sign and : sign so filter it mgr1$gwpt1

--PARAMETER INFORMATION

ctrlID is the controlID and showMenu will contain 'false,true' type string that mean

first string will be treated for edit menu and last string will be treated for delete menu

*/

if(ctrlID!=null)

{

//if there is $ sign with the controls unique id

if(ctrlID.indexOf('$')>0)

{

ctrlID=ctrlID.substring(ctrlID.indexOf(

'$')+1,ctrlID.length);

}

//if there is : sign with the controls unique id

if(ctrlID.indexOf(':')>0)

{

ctrlID=ctrlID.substring(ctrlID.indexOf(

':')+1,ctrlID.length);

}

}

var doc=document.getElementById("WebPart_" + ctrlID + "VerbsMenu");

if(doc==null || doc=="undefined")

return;

var arr_showMenu=showMenu.split(",");

var temp=doc.getElementsByTagName("a");

for(menucounter=0;menucounter<temp.length; menucounter++)

{

//var menuLinkText=trim(temp[menucounter].innerText).toString().toLowerCase();

var menuLinkText=trim(temp[menucounter].title).toString().toLowerCase();

if(menuLinkText.substring(0,4)=='edit' && !ToggleMenu(arr_showMenu[0]))

{

temp[menucounter].style.display=

"none";

}

if(menuLinkText.substring(0,6)=='delete' && !ToggleMenu(arr_showMenu[1]))

{

temp[menucounter].style.display=

"none";

}

}

}

function ToggleMenu(showMenu)

{

if(showMenu!=null)

if(showMenu=="false")

return false;

return true;

}

// Removes leading whitespaces

function LTrim( value ) {

var re = /\s*((\S+\s*)*)/;

return value.replace(re, "$1");

}

// Removes ending whitespaces

function RTrim( value ) {

var re = /((\s*\S+)*)\s*/;

return value.replace(re, "$1");

}

// Removes leading and ending whitespaces

function trim( value ) {

return LTrim(RTrim(value));

}

</script>

 

Regards,

Arjun

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


Free Download:

Books:
Microsoft Exchange Server 2003 Advanced Administration: Advanced Administration Authors: Jim McBee, Pages: 956, Published: 2006
Chambers Compact Dictionary Authors: Chambers, Pages: 960, Published: 2000
Chambers Study Dictionary Authors: Chambers Staff, Chambers, Chambers Staff, Pages: 976, Published: 2002
The ESSENTIALS of COBOL I-[COBOL II] Authors: Ruknet Cezzar, Pages: 112, Published: 1989
VLSI Design Environments Authors: George Winston Zobrist, Pages: 312, Published: 2000
Burton's Legal Thesaurus Authors: William C. Burton, Pages: 1040, Published: 2007
Professional Windows PowerShell Programming: Snapins, Cmdlets, Hosts and Providers Authors: Arul Kumaravel, Jon White, Michael Naixin Li, Scott Happell, Guohui Xie, Krishna C. Vutukuri, Pages: 336, Published: 2008

Web:
Teun.ToString(): Disable the edit verb on a web part: practically ... Aug 17, 2006 ... I guess its not completely impossible to disable edit verb. You can create a ReadOnly flag in custom webpart implementation and based on ...
Disable Verbs - ASP.NET Forums The snippet below gives you an example of how to create acustom zone with acustom WebPartChrome that will make your verbs disabled where ...
How to turn off ESMTP verbs in Exchange 2000 Server and in ... Because of compatibility issues between Microsoft Exchange 2000 Server or Microsoft Exchange Server 2003 and other Simple Mail Transfer Protocol (SMTP) mail ...
How and why to disable certain ESMTP verbs Some firewalls and network devices filter out certain Extended Simple Mail Transfer Protocol (ESMTP) commands or.
microsoft.public.inetserver.iis.security: Re: Disable trace and ... Re: Disable trace and track verbs ... His latest post shows it was another urlscan that hosted in ISA... ... for IIS 6.0, both TRACE and TRACK are logged by ...
Enable/Disable Network Connection | The Sandbox | Channel 9 This looks awesome, but I'm lost on configuring the verbs and configuring this to enable/disable specific adapters. Can I humbly request your patient ...
CodeProject: Toggle Network Connections. Free source code and ... So what this class does is navigate to the specific folder, grabs the enable or disable verb (something like a command I guess) and then calls it's . ...
How to disable custom verbs in a particular zone??? - ASP.NET Forums I have ed a custom webpartzone with custom verbs, my problem is how do i disable verbs in a particular zone? Scenario: ...
TheMSsForum.com >> Exchange Admin >> How to disable SMTP verbs in ... Or do I only need to replicate over user created public folders? Thanks Drew Tag : How to disable SMTP verbs in Exchange 2007? Tag: 691900 ...
CodeGuru Forums - [RESOLVED] Enable/Disable Wireless connection ... DisableVerbName ) { enableDisableVerb = verb; return true; } } throw new ArgumentException("No enable or disable verb found."); } ...

Videos:
Burying Dead Verbs Teacher Jason Lilly described a fun activity to help young writers to remove dead verbs from their writing. More lessons available at www.discoverwr...
CHERISH THE MOMENT http://www.myspace.com/linamarquez ================================== CHERISH THE MOMENT I've given more than I am able to I've sacrificed more than...
cherish the moment CHERISH THE MOMENT I've given more than I am able to I've sacrificed more than I ever have I've stretched myself more than i really can you hose me...
Obliterate (See also: Hillary Clinton, 'hail to the hawk') On April 21, 2008, Democratic Presidential candidate Hillary Clinton told 'Good Morning America' that she would "totally obliterate" Iran if it were ...
The Bloodhound Gang - I hope You Die The Bloodhound Gang - I hope You Die from hooray for boobies buy the album it's good Go here: http://www.youtube.com/watch?v=si50f2HBxJ0 ~lyrics th...
Williams field- lair of the skyspider 1."bigbird" is re-fueling the chemtrail planes. 2.are these orange and white "training jets" part of the "flyingfleas" circus http://www.youtube.co...
devil may cry 3 i hope you die I hope ya flip some guy the bird, He cuts you off and you're forced to swerve, In front of the Beatles' tour bus, A Bookmobile and a Mack truck, Haul...
Literate functional testing Google London Test Automation Conference (LTAC) Google Tech Talks September 7th, 2006 Presenters: Robert Chatley and Tom White
Bloodhound Gang - I Hope You Die Bloodhound Gang - I Hope You Die I hope ya flip some guy the bird He cuts you off and you're forced to swerve In front of the Beatles' tour bus A bo...
I Hope You Die Itachi VS Sasuke (mostly) I'M FULLY AWARE HOW I MISSPELLED CENSOR! SO PLZ DON'T REMIND ME! It was late on a school night when I made this, and because of the time change I los...




Search This Site:










site map

deploying from vs 2005 to 1.1 framework.

iis

is post never cached?

i'm looking for a module - batch uploads

using md5 hash to change a password

gf

listbox values from javascript question

free themes, skins for downloads to use in my asp.net 2.0 web application

dnn_bodyscroll()

changepassword or passwordrecovery control

layout issues in firefox

enter key / tab key

ask about impersonation ?

permissions in webapplicition

problem with dnntree control

iis 5.1 and visual studio 2003

error while deleting files.

pop up calendar

multipage cookies problem

getting values from a html form

security-related settings

improving dnn performance

stuck with sending emails

invitation system similar to e-vite

output caching & viewstate

ternary operator + string concatenation

article: load modules from your own module

best forum to use with dotnetnuke ? (1.0.10)

array problem

 
All Times Are GMT