Wrox Programmer Forums
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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 9th, 2011, 02:06 PM
Authorized User
 
Join Date: Feb 2011
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
Default Add New

I'm going crazy. I want to have a drop-down show all the names in a table, plus the first item should be "Add New". If the user selects the first item, the code-behind file redirects the user to a page that allows them to add the new entry. I was sure I saw how to do this in asp.net 4, but now I can't find it anywhere. What I remember was using a union something like this:

SELECT 0 AS ID, 'Add New' AS Name UNION it.ID, it.Name

I can't get this to work any way, and I can't find it on the web.

Can you help?
 
Old June 9th, 2011, 02:46 PM
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,

Can't you just add the "null" item to the markup and set AppendDataBoundItems to true on the control?

http://imar.spaanjaars.com/281/how-d...trol-in-aspnet

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!
 
Old June 9th, 2011, 04:02 PM
Authorized User
 
Join Date: Feb 2011
Posts: 13
Thanks: 2
Thanked 0 Times in 0 Posts
Default That works. Thanks!

That works. Thanks!





Similar Threads
Thread Thread Starter Forum Replies Last Post
I have to add a flash file in my C sharp code.How to add it? Archieteven C# 4.0 aka C# 2010 General Discussion 1 April 10th, 2011 01:07 AM
Chapter 18: Automation Add-Ins and COM Add-Ins David Bibby BOOK: Excel 2007 VBA Programmer's Reference ISBN: 978-0-470-04643-2 1 April 10th, 2009 05:47 AM
Add subhasps8 ASP.NET 2.0 Basics 1 March 28th, 2008 12:07 PM
Add a CDATA section; add nodeset to CDATA section kssudhish XSLT 3 January 3rd, 2008 07:13 AM
Add Push button or Check Box in outlook add-ins capdevs VS.NET 2002/2003 0 January 7th, 2006 08:51 AM





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