Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X
This is the forum to discuss the Wrox book Professional Web Parts and Custom Controls with ASP.NET 2.0 by Peter Vogel; ISBN: 9780764578601
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Web Parts and Custom Controls ASP.NET ISBN: 0-7645-7860-X section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 16th, 2006, 04:56 PM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Page.Unload Personalization Saving

Great book Peter.

On p360 between steps 5 and 6 identifies that "the user performs some personalization activities" and "the page's data is posted back to the server".

My question is how can I trigger this (it already saves when I logout, just not when I change pages)? I was hoping I could do it via a line or two of code on the Page.Unload or similar.

Walter

(I've included the simple class code in case that helps)

_________

Imports System
Imports System.Web
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts

Partial Class Controls_CountyState_Zip
    Inherits System.Web.UI.UserControl
    Private ZipCodeSave As String
    <Personalizable(), WebBrowsable()> _
    Property ZipCodeSave1() As String
        Get
            Return ZipCode.Text
        End Get
        Set(ByVal value As String)
            ZipCode.Text = value
        End Set
    End Property

    Protected Overrides Sub CreateChildControls()
        Dim Textbox1 As New TextBox()
        Textbox1.Text = ZipCode.Text
        Controls.Add(Textbox1)
    End Sub
End Class

  #2 (permalink)  
Old January 16th, 2006, 08:36 PM
Authorized User
 
Join Date: Dec 2005
Location: Goderich, Ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmmmmm.... I'm not sure that I understand what you're trying to do (which pretty much ensures that I won't provide a useful answer).

It is true that because you perform the personalization actions in the browser, your latest changes can't be saved until you post your data back to the server where ASP.NET can process your changes. Talking about logging out: If you use the ASP.NET logout option through the LoginStatus control you will get your page posted back to the server for processing and give ASP.NET's personalization code a chance to run.
   However, and I may be out to lunch here, as soon as you finish any WebPart personalization action that I can think of, the page automatically posts back to the server. This is why I suspect that I'm missing your point.

Are you asking if there's any way to trigger a postback to the server from client-side code? If so, the answer is yes--the question is just what client-side event you want to attach the client-side code to. But because I'm tied up thinking that the page will postback anyway, I'm not sure why you'd want to add the client-side code.

When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

- Sherlock Holmes, as recorded by Sir A. C. Doyle in "The Blanched Soldier"
  #3 (permalink)  
Old January 17th, 2006, 09:15 AM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry Peter, here's some clarity.

I built a custom control that has a text box. When I change that text, it does not trigger a post-back. So, when I change the text and leave that page (unless I leave by hitting "logout" which uses the .Net 2.0 login/logout control) the text is not saved.



  #4 (permalink)  
Old January 17th, 2006, 10:38 AM
Authorized User
 
Join Date: Dec 2005
Location: Goderich, Ontario, Canada.
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I get it. Thanks for the clarification.

Would inserting the autopostback code described on page 88 (and on) do the job for you? It should enable you to add the JavaScript code to trigger a postback on a client-side event (in this case, the onblur event of your textbox sounds like the right choice).

If you are going this route, I'd recommend implementing the AutoPostback property so that a developer using your control can turn this option on or off.

When you have eliminated all which is impossible, then whatever remains, however improbable, must be the truth.

- Sherlock Holmes, as recorded by Sir A. C. Doyle in "The Blanched Soldier"
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving personalization properties w/CreateUser k8277 ASP.NET 2.0 Basics 0 April 5th, 2007 01:47 PM
Saving a Web Page riggs Excel VBA 7 November 30th, 2006 04:59 AM
alternative to multi sessions - personalization? a3321889495 BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 July 27th, 2006 05:12 AM
Personalization Providers AGS BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 December 3rd, 2005 08:44 AM
Saving web page to file treasacrowe Classic ASP Databases 4 October 21st, 2004 09:59 AM



All times are GMT -4. The time now is 08:49 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.