Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB 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 June 23rd, 2012, 09:33 PM
Authorized User
 
Join Date: Sep 2011
Posts: 41
Thanks: 3
Thanked 4 Times in 3 Posts
Default User Control not working correctly

Hi Imar,

Can you please take a look?

http://binaryjack.com/userControl.aspx

Each record is displayed using a user control. I have the delete button embedded in the user control.

Recreate Problem: click the first DELETE button, the last row gets deleted; after this I have to click the delete button (any of them) twice to make it work.

1) Is it bad practice to use a User Control (combined with a placeholder) to display a bunch of records? I query to get all records and then use a Foreach loop to populate each User Control and insert each UC into the placeholder.

2) Why does the Delete button not respond correctly?
 
Old June 24th, 2012, 04:54 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

What'sthe reason you're using User Controls in a foreach loop? Why not simply use something like a ListView to present each item?

Using a UC is not a bad practice per se, but you'll run into all kinds of problems including state (you'll need to recreate the tree after a postback for example).

>> Why does the Delete button not respond correctly?

Don't know. I am not allowed to use my psychic skills here so it'll be impossible to say anything useful without seeing relevant code ;--)

Finally, since this is not related to my book, can we continue this discussion in a general ASP.NET cateogy: http://p2p.wrox.com/asp-net-4-539/

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Login Control and create user wizard is not working in hosting space ramesh ASP.NET 4 General Discussion 2 February 2nd, 2012 12:07 PM
user control javascript not working in footer row of a gridview gagansharma7 ASP.NET 2.0 Professional 5 May 7th, 2009 04:33 PM
Hello User, not working correctly? Neotriple BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 1 October 5th, 2006 11:39 AM
No error but not working correctly! Adam H-W Javascript 7 November 10th, 2003 09:34 AM
User Control Id not working duncanthescott Pro VB.NET 2002/2003 4 September 23rd, 2003 11:44 AM





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