Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Go Back  Xtreme Visual Basic Talk > > > Selecting value from a multi value dropdown list


Reply
 
Thread Tools Display Modes
  #1  
Old 11-22-2011, 10:31 AM
kawi6rr kawi6rr is offline
Newcomer
 
Join Date: Jan 2009
Posts: 9
Default Selecting value from a multi value dropdown list


I have a dataview that I'm sorting with two text boxes and two dropdown lists. In the "Diag" dropdown list I needed to add in the "Diag Description" so our people know what the "Diag" code means. When doing this I didn't realise at the time it would break my SQL. How do I read the first part of my multi value dropdown lsit?

Example dropdown list:

Diag: 4554 - member was seen by wrong employee
4553 - member was seen at wrong time

I need to be able to read only the code 4554 or 4553.

Here's some of the code that I'm actually using.

This is the query that fills my dropdown list
SELECT DISTINCT Diag + ' - ' + [Diag Desc] AS Diag FROM OPPEnew WHERE (Provider = @Practitioner) AND ([Admit Dt] >= @beginDate) AND ([Disch Dt] <= @endDate) ORDER BY Diag

This is the query that fills my data grid
SELECT Provider, [Prov Type], [Pat Cls], Diag, [Diag Desc], [Proc], [Proc Desc], [Admit Dt], [Disch Dt]
FROM OPPEnew
WHERE ([Admit Dt] >= @beginDate) AND ([Disch Dt] <= @endDate) AND (Provider = @Practitioner) AND (Diag = @dxDropDown)

Any help is appreciated, thanks!
Reply With Quote
  #2  
Old 11-23-2011, 03:37 PM
kawi6rr kawi6rr is offline
Newcomer
 
Join Date: Jan 2009
Posts: 9
Default

Solved!
OK, in your select statement you need to select the numeric value by itself and then the numeric + text (also change how you're naming the concatenated field so it isn't the same as the numeric field):

SELECT DISTINCT Diag, Diag + ' - ' + [Diag Desc] AS DiagTxt FROM OPPEnew WHERE (Provider = @Practitioner) AND ([Admit Dt] >= @beginDate) AND ([Disch Dt] <= @endDate) ORDER BY Diag

Then in your dropdown list set the DataValueField to the numeric code and DataTextField to what you want displayed:

Diag #&nbsp;<aspropDownList ID="dxDropDown" runat="server"
AutoPostBack="True" DataSourceID="SqlDataSource3" DataValueField="Diag" DataTextField="DiagTxt" CssClass="textBoxes" Width="250px" OnSelectedIndexChanged="dxDropDown_SelectedIndexChanged" TabIndex="4">
</aspropDownList>
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
 
Selecting value from a multi value dropdown list
Selecting value from a multi value dropdown list
 
-->