List Info

Thread: RE: A Blank entry in a DropDownList...




RE: A Blank entry in a DropDownList...
user name
2007-06-15 17:36:08
> Regarding the resources assembly issue, since the added
option is just
> another piece of data, wouldn't the language handling
be the 
> same as any
> other row?  I am not seeing how that would be different
than 
> any other data.

You may have a point. But in that case, you'd have to have
another
database table with lookups for "Selected a Group"
in different
cultures--it'd be a matter of whether you'd want to have
that lookup in
the database (possibly a new table unless you'd already have
one suited
to this purpose) or in the resource file.

--Peter


> -----Original Message-----
> From: Duane Lakoduk [mailto:duanemackin.com] 
> Sent: Friday, June 15, 2007 4:03 PM
> To: aspnetaspadvice.com
> Subject: [aspnet] RE: A Blank entry in a
DropDownList...
> 
> 
> Thanks for that advice, Peter.  
> 
> Regarding the resources assembly issue, since the added
option is just
> another piece of data, wouldn't the language handling
be the 
> same as any
> other row?  I am not seeing how that would be different
than 
> any other data.
> 
> 
> The Group_ID is a identity column on the Group table,
so zero (0) is
> unlikely to be a legitimate Group_ID.  In addition, the
code 
> behind, and
> ultimately, the SQL INSERT/UPDATE is checking for valid
Client_ID's.
> 
> For what it's worth, I was opting for adding the value
in C# 
> code-behind,
> but I was out-voted.
> 
> Regards,
> Duane
> 
> -----Original Message-----
> From: Johnson, Peter [mailto:Peter.Johnsonmercer.com] 
> Sent: June 15, 2007 1:53 PM
> To: aspnetaspadvice.com
> Subject: [aspnet] RE: A Blank entry in a
DropDownList...
> 
> You're mixing UI/presentation with data instead of
keeping 
> them on separate
> tiers. While this has the upside you mentioned, one
practical 
> downside could
> be if you globalize your site, and need "Selected
a Group" to be in
> different languages. If you're using a resources
assembly to 
> do this, you'd
> have to do something dicey to modify the data returned
by that query.
> 
> Another practical downside is that 0 becomes a
"magic number," so any
> consuming code would have to check for it specifically
and 
> not try to use it
> as a valid Group_ID.
> 
> Now, you may determine those downsides are worth the
upside and your
> solution is still the best one. I just wanted to point
out 
> the trade-offs
> for this particular technique to the list.
> 
> --Peter
> 
> 
> > -----Original Message-----
> > From: Duane Lakoduk [mailto:duanemackin.com]
> > Sent: Friday, June 15, 2007 1:57 PM
> > To: aspnetaspadvice.com
> > Subject: [aspnet] RE: A Blank entry in a
DropDownList...
> > 
> > 
> > I realize this is a late entry into this thread,
but this same 
> > requirement came up for me today and in discussing
various options 
> > presented here and discussion with our DBA, we
have opted to use a 
> > UNION ALL statement to insert the
"default" option into the 
> results of 
> > the SELECT statement.
> > 
> > The reason for opting for this method, is that if
we ever need to 
> > change the text or values for the select, we can
do so 
> without having 
> > to recompile and deploy the web site, but will
only need to 
> change the 
> > values in the stored procedure in the database.
> > 
> > Here is a simple example to get a list of groups
for a given client 
> > with a default option:
> > 
> > 	SELECT	Group_ID, 
> > 			[Name]
> > 	FROM	tbl_Groups
> > 	WHERE	Client_ID=Client_ID
> > 	UNION ALL
> > 	(Select 0, '--Selected a Group--')
> > 	ORDER BY Group_ID
> > 
> > 
> > The list.Add and List.Insert methods do work well,
however.
> > 
> > Again, sorry for the late post.
> > 
> > Duane
> > 
> > -----Original Message-----
> > From: Lamprecht, Jan [mailto:JLamprecht1fnb.co.za]
> > Sent: June 05, 2007 10:00 AM
> > To: aspnetaspadvice.com
> > Subject: [aspnet] A Blank entry in a
DropDownList...
> > 
> > Hi All,
> > 
> > I have a question. Suppose I have a dropdownlist
which is 
> bound to a 
> > dataset and it has a few values in it...
> > 
> >  
> > 
> > The first time I display the form, I would have
liked to 
> have a blank 
> > entry in the dropdownlist - the blank being an
indication that the 
> > user has not yet selected anything and that he
must select 
> something.
> > 
> > My problem is that I'm binding a dataset to the
dropdown 
> list and the 
> > dataset does not have a blank row in it.
> > 
> >  
> > 
> > How do I create a blank entry in a drop down list
given the above 
> > situation?
> > Do I have to add a blank record to the dataset
that I'm binding it 
> > with?
> > 
> > If so how do I do that?
> > 
> > Or, is there an option with dropdownlists for the
control to have a 
> > blank option? (I've looked but can't find
anything).
> > 
> > Or is there a better "conceptual" way of
going about this to begin 
> > with?
> > 
> >  
> > 
> > Thanks,
> > 
> > Jan
> > 
> > 
> > To read FirstRand Bank's Disclaimer for this email
click on the 
> > following address or copy into your Internet
browser:
> > https://www.fnb
.co.za/disclaimer.html
> > 
> > If you are unable to access the Disclaimer, send a
blank e-mail to 
> > firstrandbankdisclaimerfnb.co.za and we will send
you a 
> copy of the 
> > Disclaimer.
> > 
> > 
> > 
> > --- List Settings ---
> > http://aspadvice.com/list
s/
> > 
> > 
> > 
> > 
> > 
> > --- List Settings ---
> > http://aspadvice.com/list
s/
> > 
> 
>                                                        
 __
> 
> 
>
------------------------------------------------------------
-
> This e-mail and any attachments may be confidential or

> legally privileged.
> If you received this message in error or are not the
intended 
> recipient, you
> should destroy the e-mail message and any attachments
or 
> copies, and you are
> prohibited from retaining, distributing, disclosing, or
using any
> information contained herein.  Please inform us of the

> erroneous delivery by
> return e-mail. Thank you for your cooperation.
>
------------------------------------------------------------
-
> 
> FE01
> 
> --- List Settings ---
> http://aspadvice.com/list
s/
> 
> 
> 
> 
> 
> --- List Settings ---
> http://aspadvice.com/list
s/
> 

                                                         __


------------------------------------------------------------
-
This e-mail and any attachments may be confidential or
legally privileged. If you received this message in error or
are not the intended recipient, you should destroy the
e-mail message and any attachments or copies, and you are
prohibited from retaining, distributing, disclosing, or
using any information contained herein.  Please inform us of
the erroneous delivery by return e-mail. Thank you for your
cooperation.
------------------------------------------------------------
-

FE01

--- List Settings ---
http://aspadvice.com/list
s/


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )