Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Disappearing Web Part Trick

Reply
Thread Tools

Disappearing Web Part Trick

 
 
AL
Guest
Posts: n/a
 
      08-21-2006
Hello, I'm pretty new to web part development. On playing around with this,
pretty much for the first time, I noticed that when I ran the page and closed
the web part, on subsequent runs of the page, the web part remains resolutely
closed.

I also noticed that resetting the controls ID property at design time, and
re-running the page caused them to reappear. Is this normal behaviour for web
parts or am I cracking up? Is there a more elegant way to get your part to
reappear after inadvertantly closing it during testing?
--
Intrigued,

Al
 
Reply With Quote
 
 
 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      08-22-2006
Hi Al,

I hear ya! I ran into that same issue when I was working on the Web part
chapter of

ASP.NET 2.0 All-In-One Desk Reference For Dummies
http://www.wiley.com/WileyCDA/WileyT...471785989.html

I added a button to the page and a little code to reset (ResetAllState) the
state whenever I lost the parts. Here's the code from the book:

<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Button1_Click _
(ByVal sender As Object, _
ByVal e As System.EventArgs)
Dim intCount As Integer
intCount = _
PersonalizationAdministration.ResetAllState _
(PersonalizationScope.User)
Response.Redirect("starterpart.aspx")
End Sub
</script>

<html>
<head runat="server">
<title>Reset Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:button id="Button1" runat="server"
onclick="Button1_Click" text="Reset" />
</div>
</form>
</body>
</html>

Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]


"AL" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello, I'm pretty new to web part development. On playing around with
> this,
> pretty much for the first time, I noticed that when I ran the page and
> closed
> the web part, on subsequent runs of the page, the web part remains
> resolutely
> closed.
>
> I also noticed that resetting the controls ID property at design time, and
> re-running the page caused them to reappear. Is this normal behaviour for
> web
> parts or am I cracking up? Is there a more elegant way to get your part
> to
> reappear after inadvertantly closing it during testing?
> --
> Intrigued,
>
> Al



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web Service with disappearing Web Methods Peter Cook ASP .Net Web Services 0 09-12-2005 12:45 PM
Variable displays at one part while does not in another part in a Jack ASP General 8 05-10-2005 07:26 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
Easy part done, now the hard part!! jollyjimpoppy A+ Certification 0 09-10-2003 10:37 AM



Advertisments