Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 5th, 2007, 10:00 PM
Registered User
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default How are the Update/Cancel links wired?

I've spent quite a bit of time pouring over the code and looking in the book and I am at a loss to figure out where the markup for the Update and Cancel links are in the code and how their events are wired up.

For example on the Article editing page (AddEditArticle.aspx) is a content page associated with the Master page. There is a DetailViews control that lays out most of the content of the MainContent container. Below this control and on the right are the Udate and Cancel links where the user can determine whether or not to commit the changes made in the editor.

I can't find where the markup for those links is. It doesn't appear to be in AddEditArticle.aspx or its code behind. It doesn't appear to be in the master page. Where is it and where are its event handlers?

Thanks very much,

BK


 
Old October 6th, 2007, 05:50 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 488
Thanks: 2
Thanked 11 Times in 10 Posts
Default

BKahuna - if you look in the source htm of the addedit page, you'll find the following section:

<a href="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions(&quot;ctl00$MainContent$dv wArticle$ctl01&quot;, &quot;&quot;, true, &quot;&quot;, &quot;&quot;, false, true))" style="color:#333333;">Update</a>&nbsp;<a href="javascript:__doPostBack('ctl00$MainContent$d vwArticle','Cancel$0')" style="color:#333333;">Cancel</a></td>

basically, the events are wired at runtime (inbuilt feature of the detailsview in asp.net and not generated by tbh) as javascript postback options and the page is either posted back (_postback) or the postback is cancelled and the page redirected to the urlrefering page. if the page were postedback, then any server side validation/processing could then be done by examining the IsPostBack property on the page.

someone will hopefully give a more detailed explanation, but this is the simple version of events :)

jimi

http://www.originaltalent.com
 
Old October 6th, 2007, 12:28 PM
Registered User
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Jimi -

Yes, if I look at the View Source on the rendered page I can find this. My question is - where in the code is this markup created? It's not in the aspx page, the master page or the content page as far as I can tell.

Thanks,

BK
 
Old October 6th, 2007, 08:10 PM
Authorized User
 
Join Date: Jan 2007
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Look closely at the detailsview's main tag in the aspx code. Marco tends to use AutoGenerateInsertButton="True" and AutoGenerateEditButton="true" in detailsviews to make those links. So other than that, you write no actual explicit asp code to display them. They're automatically added at the bottom right of your detailsview. You could however set them to false, and write your own custom buttons for update/insert/cancel if you want to...I would tell you how, but I don't know myself! But I think this link will help:

http://www.codenewsgroups.net/group/...topic9888.aspx
 
Old October 7th, 2007, 02:58 AM
Registered User
 
Join Date: Oct 2007
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ah, that's what I needed!

Thanks very much,

BK


 
Old October 7th, 2007, 12:58 PM
Authorized User
 
Join Date: Jan 2007
Posts: 63
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by BKahuna
 Ah, that's what I needed!

Thanks very much,

BK
You're welcome.






Similar Threads
Thread Thread Starter Forum Replies Last Post
cancel appointment jeanhl BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 March 25th, 2008 03:55 AM
Update links in excel file Wall st Guru Excel VBA 2 December 11th, 2006 05:09 AM
Update/Cancel Command not responding in DataGrid acebookend ASP.NET 1.0 and 1.1 Professional 2 January 30th, 2006 03:00 PM
Help me ! Cancel Update Error ! minhtri Pro VB Databases 0 August 28th, 2004 09:03 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.