Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Question on DropDownList

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rote - 29 Feb 2008 06:37 GMT
I have a DropDownList in a DetailView like so
<asp:TemplateField HeaderText="PCode">

<ItemTemplate>

</ItemTemplate>

<EditItemTemplate>

<asp:DropDownList ID="ddlCode" runat="server" BackColor="Pink"
DataSourceID="SqlDataSource2"

DataTextField="PCode" DataValueField="PCode" SelectedValue='<%#
Bind("PCode") %>'>

</asp:DropDownList>

</EditItemTemplate>

</asp:TemplateField>

The pcode is either 0,1,2
I need to change the DataTextField to a text string for example
if pcode is 0 then "boy"
if pcode is 1 then "girl"

Any ideas ?
Sure a function that returns a Datasource should be able to do it
But is there anyway i can do it in my aspx page?
nick chan - 29 Feb 2008 10:46 GMT
you could easily return from sql

select pcode, case when pcode=0 then 'boy' else when pcode=1 then
'girl' else 'others' end [sex] ..............

the set datatextfield to 'sex'

> I have a DropDownList in a DetailView like so
> <asp:TemplateField HeaderText="PCode">
[quoted text clipped - 25 lines]
> Sure a function that returns a Datasource should be able to do it
> But is there anyway i can do it in my aspx page?
rote - 02 Mar 2008 22:52 GMT
Nick i know about that but i would be interested if they are other ways to
do it.

you could easily return from sql

select pcode, case when pcode=0 then 'boy' else when pcode=1 then
'girl' else 'others' end [sex] ..............

the set datatextfield to 'sex'

On Feb 29, 2:37 pm, "rote" <naijaco...@hotmail.com> wrote:
> I have a DropDownList in a DetailView like so
> <asp:TemplateField HeaderText="PCode">
[quoted text clipped - 25 lines]
> Sure a function that returns a Datasource should be able to do it
> But is there anyway i can do it in my aspx page?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.