Querying a Dropdown List

I have a dropdown with populating code that looks like the following:
myDropdownBox.DataSource = myDataSource;
myDropdownBox.DisplayMmeber = "typeDescription";
myDropdownBox.DisplayValue = "typeId";
Assuming that I have a typeId with a value of, let's say, 28, how can I use Linq to query myDataSource to find the corresponding typeDescription to be displayed in myDropdownBox.Text?
Rob E.

Rob : What exactly is your data source ? does this help ?
DataTable objTable = new DataTable("table");
objTable.Columns.Add("typeId", typeof(int));
objTable.Columns.Add("typeDescription", typeof(string));
objTable.Rows.Add(10, "test10");
objTable.Rows.Add(20, "test20"); objTable.Rows.Add(28, "test28");
objTable.AcceptChanges();
// myDropdownBox.DataSource = objTable.DefaultView;
// myDropdownBox.DisplayMember = "typeDescription";
// myDropdownBox.ValueMember = "typeId";
var query = objTable.AsEnumerable().Where(x => x.Field<int>("typeId").Equals(28)).Select(x => x.Field<string>("typeDescription")).ToList();
if (query != null)
myDropdownBox.DataSource = null;
myDropdownBox.Items.Clear();
myDropdownBox.DataSource = query;

Similar Messages

  • Query based on a dropdown list (query)

    Hello
    I have a dropdown list (populated with data from a query)
    mysql_select_db($database_myconnection, $myconnection);
    $query_groepen = "SELECT * FROM artikelgroepen ORDER BY groepomschrijving ASC";
    $groepen = mysql_query($query_groepen, $myconnection) or die(mysql_error());
    $row_groepen = mysql_fetch_assoc($groepen);
    $totalRows_groepen = mysql_num_rows($groepen);
    Now I want to show on the webpage all articles which are part of the article-group that I have selected from the above mentioned list (query)
    Which parameter do I have to use in the query which follows :
    mysql_select_db($database_myconnection, $myconnection);
    $query_artikelen = "SELECT * FROM artikelen WHERE groep  ???????????";
    $artikelen = mysql_query($query_artikelen, $myconnection) or die(mysql_error());
    $row_artikelen = mysql_fetch_assoc($artikelen);
    $totalRows_artikelen = mysql_num_rows($artikelen);
    Thank you for your replies

    Sorry, I don't have the time to script it for you. As I said before, you need to submit the form and use a URL parameter to display the result. This is the same principle as any filtered recordset.
    Put your drop-down list in a form with the method set to GET.
    In the second recordset, use the name of the drop-down menu as a URL parameter to filter the SQL query. (See the following Help page: http://help.adobe.com/en_US/dreamweaver/cs/using/WSc78c5058ca073340dcda9110b1f693f21-799da .html).

  • Defaulting value of Dropdown List to the first value of a BI Query

    Hi,
    In my VC application I have a form containing a dropdown list to be used as selection criteria for other data.  The dropdown list is dynamically populated by a BI Query.  When I run the application, the dropdown list is correctly populated with the values returned by the linked query.  However, on initial load of the iView, the default value of the dropdown list is blank.  The requirement is for the first item returned by the linked query to display as the default value.
    I would appreciate any suggestions on how to achieve this requirement.
    Thank you,
    Mustafa Bensan.

    Hi Mustafa,
    I checked your requirement but it is not possible to display first value as default value for a drop down list because the list will be generate when you click the drop down list. You can use a 'list box' instead of drop down list.
    Regards
    Basheer

  • SSRS report - A single selection dropdown list converted to text box

    Hello everyone,
    We created a single selection dropdown parameter (City parameter) on a report. The data in this parameter is populated using MDX query. Also, it is filtered based on selection of another single selection dropdown list (Country parameter) of a report.
    The problem is when there is no cities for the selected country the dropdown list is gets converted to free type text box and user can insert city data in it. Why SSRS is not keeping it as empty dropdown list with no data?
    Any help would be much appreciated.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

    Hello Charlie,
    We developed a fresh report only with two parameters but still the dropdown control gets converted to text box in our case. We have two single selection parameters, Location and Customers. Based on selected Location the customer
    dropdown gets populated.
    Location Parameter Query
    WITH MEMBER [Measures].[ParameterCaption] AS [Location].[Location Name].CURRENTMEMBER.MEMBER_CAPTION MEMBER [Measures].[ParameterValue] AS [Location].[Location Name].CURRENTMEMBER.UNIQUENAME MEMBER
    [Measures].[ParameterLevel] AS [Location].[Location Name].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel]} ON COLUMNS , [Location].[Location Name].ALLMEMBERS ON ROWS FROM [Model]
    Customer Query
    WITH MEMBER [Measures].[ParameterCaption] AS
    [Customer].[Customer Name].CURRENTMEMBER.MEMBER_CAPTION
    MEMBER [Measures].[ParameterValue] AS
    [Customer].[Customer Name].CURRENTMEMBER.UNIQUENAME
    MEMBER [Measures].[ParameterLevel] AS [Customer].[Customer Name].CURRENTMEMBER.LEVEL.ORDINAL
    SELECT {[Measures].[ParameterCaption], [Measures].[ParameterValue], [Measures].[ParameterLevel],[Measures].[Amt]} ON COLUMNS,
    nonempty([Customer].[Customer Name].ALLMEMBERS,[Measures].[Amt]) ON ROWS FROM ( SELECT ( STRTOSET(@LocationName, CONSTRAINED) ) ON COLUMNS FROM [Model])
    Regarding parameter settings on General tab for both the above parameters we did not select any of the following values, all these checkboxes are empty:
    Allow Blank Value ("") , Allow null value, Allow multiple values.
    I think it has something related to [Measures].[Amt] that we used in customer parameter. We are now trying to take other two parameters where we would be not using the [Measures].[Amt] to filter the data. Will update you soon.
    Thanks, Ankit Shah
    Inkey Solutions, India.
    Microsoft Certified Business Management Solutions Professionals
    http://www.inkeysolutions.com/MicrosoftDynamicsCRM.html

  • How to implement two dependent dropdown lists in an input  table row?

    Hi all,
    I am new in Jdev 11g. I try to develop an input table with two dependent dropdown list. I can create independent dropdown list in such table. When I try to implement dependent one following some examples do it in a form using bind variable in the view object I get an empty listbox. How can I do this? Is it possible. I cannot find any documents about this.
    Thanks in advance

    Hi,
    it hasn't changed between 10.1.3 and 11. The basic outline of how you do it is
    - use a managed bean to query the data
    - populate the list with f:selectItems that point to the managed bean ArrayList<SelectItem> for the master and the detail
    - obtain the master ID in the managed bean by parsing the #{row} variable when the table renders
    - then bulild the detail list
    - have the detail list referencing the ArrayList<SelectItem> you expose for the details
    Note that without proper caching, the action is quite expensive
    Frank

  • Dynamically populating a dropdown list in a pdf form from a datasource

    Is there a way to populate a dropdown list in a pdf form from a datasource, specifically from an Access database table or query, using LiveCycle Designer. I am easily able to do this using cfselect in Coldfusion, however, cannot seem to figure it out for pdf forms. I am aware of the Show Dynamic Properties option enabled in LiveCycle Designer, and then binding to a datasource. However, this seems limited as I am only able to select single columns from Access (currently using an Access database) tables, and a unable to select from queries like I do using cfselect in Coldfusion forms. Is this something that must be done with Java scripting? If so, is there any other way? I know nothing about scripting. Thanks

    Derrick,
    There is a sample posted at
    http://www.adobe.com/devnet/livecycle/articles/lc_designer_db_lookup_tip.pdf
    It was created for Designer 7.0 but it should function the same in later versions of Designer.
    Steve

  • Problem in mapping dropdown list  values with the queries

    hi,
    I am building a simple applicaittion of currency conversion.
    The scenario :
    I have a input form with a dropdown list and a input field to enter the amount
    I have created the drop down list with the respective details
    Value   Desc
    1          dollarToeuro
    2          euroTodollar 
    when the user selects the first option in the drop down list and then enters the value and gives a submit -> the conversion takes place
    but evrytime i select the second option --> the application hangs..
    i have given a guard condition in the submit action for each if the query as LIKE(@option,"1") OR LIKE(@option,"2") for the respective queries.
    Please can someone tell me where i am going wrong???
    Regards,
    Vaishali

    Hi ,
    what is the need of ur gaurd condition there?
    and try to run the model without that guard condition.
    Regards,
    Govindu

  • What defines the values observable in a dropdown list?

    Hello everyone,
    We use a a dynamic entry list to define the input values of the user for 0CALMONTH.
    Therefor we chose a query on a multiprovider and selected 0CALMONTH for output.
    We also get now a nice dropdown list, BUT
    the values start 3.1995 and end 3.2005.
    This is very strange, becaus the query should deliver much more values.
    What is defining where the values of the drop down list start and where they end?
    sinecerly
    mark

    Hi Sandeep Patki,
    Well, I have chosen a dynamic list, but because of that I am not able to go to the query anymore.
    I was only able to chose the query onces at the beginning when i made the list (because it is not globally).
    I dont think it is master data. 0CALMONTH has no master data (or maybe I did not understand you properly).
    I figured out that the list which is shown to me is identical with the value help list (F4 help)
    when I try to have a look at the entries in my infocube.
    Sincerly
    mark

  • Parent Child dropdown list in ColdFusion

    Hi,
    I'm looking a CF/Javascript code with a functionality to show a parent dropdown list (ex. Country) and depending on the selected Country, need to show the child (State) dropdown list.
    Thanks.

    Cancelled Accounts
    AH099999 Hamilton Maurice Ralph
    Current Accounts
    AD099999 Greene Teresa L
    AH099999 Johnson Wm R
    AH099999 White Ben V Judith Ann
    AH099999 Jones Dean Edward
    AH099999 Smith Mary Carol
    This will create a tree just like Windows Explorer. The "Cancelled Accounts" and the "Current Accounts" are folders and the accounts are pages.
    <!--- list of all cancelled accounts --->
    <cfquery name="Accounts1" datasource="readprod" dbtype="ODBC">
    select accountinfo, ACCOUNT_NUM, web_acct_num_plain, value, code, category_code
    from directbilltext
    where (AGENT_NUM = '#SESSION.Usercode#')
           AND(CATEGORY_CODE = code)
           and (CATEGORY_CODE = '3')
      order by account_num
    </cfquery>
    <!--- list of all current accounts --->
    <cfquery name="Accounts2" datasource="readprod" dbtype="ODBC">
    select accountinfo, ACCOUNT_NUM, web_acct_num_plain, value, code, category_code
    from directbilltext
    where (AGENT_NUM = '#SESSION.Usercode#')
      AND(CATEGORY_CODE = code)
      and (CATEGORY_CODE = '4') and
       order by account_num
    </cfquery>
    <!--- beginning of tree. Parent levels are Cancelled Accounts and Current Accounts --->
    <cf_dccom component="TreeControl" width="400" height="250" usecookies="YES" title="Personal Lines Accounts">
         <cfset next_item = 1>
         <cfset current_parent = #next_item#>
         <cf_dccom id="#next_item#" parent="0" display="Cancelled Accounts" expand="false" ></cf_dccom>
         <cfloop query="Accounts1">
              <cfset next_item = #next_item# +1>
              <cf_dccom id="#next_item#" parent="#current_parent#" display="#accountinfo#"
                        HREF="/public/reports/Pers_history.htm?cftreeitemkey=#web_acct_num_plain#">
              </cf_dccom>
         </cfloop>
         <cfset next_item = #next_item# + 1>
         <cfset current_parent = #next_item#>
         <cf_dccom id="#next_item#" parent="0" display="Current Accounts" expand="false" ></cf_dccom>
         <cfloop query="Accounts2">
              <cfset next_item = #next_item# +1>
              <cf_dccom id="#next_item#" parent="#current_parent#" display="#accountinfo#"
                        HREF="/public/reports/Pers_history.htm?cftreeitemkey=#web_acct_num_plain#">
              </cf_dccom>
         </cfloop>
    </cf_dccom>
    So you could have a list of your countries with a list of your

  • Problem with dynamically loading the dropdown list from database

    Please help me,
    i am having a jsp page which contains a form
    with a textfield ,two dropdown list
    and a submit button
    when i select a list from first drop down, second drop down has to
    be loaded from the database dynamically according to the
    selected one in the first drop down.
    i gave onselect event for the first drop down and
    gave this one
    temp=first dropdown selected value
    self.location='currentfile+query='+temp;
    after this current page is reloading, but the already existing
    values in textfield and first selected value in drop down list is
    missing.
    how to solve this problem? and the rest of the problem. i mean
    loading the data into second drop down list.
    plz help me......

    in first <selcet> tag write Onchange and submit to the jsp then the values will return in second select box.

  • Query Search Select List

    I have a search form with multiple search list. When the user selects an option from the search list I want my other select list to filter based on the first dropdown option selected.
    Web App name "Listings"
    First Dropdown list is "Animal" - option 1 "Elk", option 2 "Deer", Option 3 "Bear".
    Second Dropdown list is "City" - option 1 "Steamboat", option 2 "Brush", Option 3 "Strasburg".
    From the first dropdown list the user would choose animal. I'm trying to accomplish the second dropdownlist to refresh and only display what City the animal would reside in. Can this be done? How would one do this?

    then v_where_clause := v_where_clause || c_isnull;If the parameter is not supplied then are you sure you want to match to null?
    Why not something like:
    if in_customer_id is not null then
    c_where_clause := c_where_clause||' WHERE customer_id = :customer_id';
    else
      c_where_clause := c_where_clause||' WHERE 1=1 or :customer_id is null';
    end if;
    if in_account_no is not null then
    c_where_clause := c_where_clause||' AND account_no = :account_no'
    else
      c_where_clause := c_where_clause||' AND 1=1 or :account_no is null';
    end if;Then your list of values in the using clause is always constant.
    This does get complicated if your in parameters are used multiple times in different ways throughout the query you are building up.
    Ben

  • Dropdown List Not Refresh with Static PDF

    Hi,
    I'm using LiveCycle ES2 version 9 to design my form and view using Acrobat X Pro. In my form, I have a dropdown list that binds to a data connection to populate the list of products available. The SQL query of the data connection is as simple as below,
         "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd = yes"
    Everything works perfectly when I save my PDF in dynamic form. However, due to some limitation with dynamic form, I have no choice but to save the PDF in static form. Problem with static form arises when there are changes to PUB_Product table which could be adding/removing product, setting an active product to non-active and etc. In case of any changes, I have to re-open the PDF in LiveCycle and save it in order to have the latest data reflected in the form. Is there anything I can do so that the changes to the product table will straight away reflected in the form without having to re-save it?
    Thanks in advance for your advise.
    Regards,
    Steven

    Hi Paul,
    Thanks for helping. I'm using Acrobat to view the PDF form. Thus, shouldn't have any problem connecting to the database.
    I've captured some screenshots as below and hope it helps you understand my situation better.
    This is my Access database
    This is my PDF. Added a data connection "Product" using SQL Query "SELECT ProductCode, ProductName FROM PUB_Product WHERE ActiveInd=yes" whereby it will only extract the "active" products.
    Binded the product code dropdown list with "Product" data connection to populate the list.
    The output of the PDF form. Only the active products are being listed.
    Now, if let's say I add a new product to my PUB_Product table, the dynamic form will straight away list the new product but not the static form.
    Dynamic form
    Static form
    In order to see the new product listed in the static form dropdown list, I have to re-open the form in Live Cycle and just simply save it. So my question is, is there anything I can do to skip this "open and save" step?
    Thanks.
    Regards,
    Steven

  • Execute specific query from Entry List

    Hi everybody,
    Is it possible to execute a specific query in a DropDown List ?
    Example:
    I have a dropdown list of airport (PARIS, ROME, BARCELONE).
    If i select PARIS, i would execute the specific query about PARIS and
    the associated chart
    If i select ROME, i would execute the specific query about ROME and
    the associated chart
    If i select BARCELONE, i would execute the specific query about BARCELONE and
    the associated chart
    Thanks for your help
    Rodolphe.

    Hi,
    Yes, you can do that.
    Add a custom action to the dropdown and name it for example event1.
    Connect the dropdown containter (form or table) to the PARIS query.
    Set the event name for this line event1 and the guard condition as @dropdown=='PARIS')
    connect another line to ROME query with the same event name and a corresponding guard condition.
    Do the same for the others.
    You can also add visibility conditions to the charts, based on the dropdown value.
    Hope this helps,
    Shay

  • Dropdown list from the recursive table in DB2

    Hi
    I need to create a dropdown list that looks like this in my JSP:
    Root
    BaseChildA
    ChildB
    ChildC
    BaseChildD
    ChildE
    ChildF
    I have to create it from the recursive table in the database, with columns that show parent-child relationships like this:
    child parent
    root
    A root
    B A
    C A
    D root
    E D
    F E
    Does anyone have an algorithm for doing this?
    Thanks!!

    I assume you just need to get the data and don't need instruction on how to create a dropdown list. (If you do need that instruction, go look for an HTML site -- there are lots.) Anyway, aren't you just going to get all the data from the "child" column? That would be the easiest way to get the data. But if you need to get the data in the order you showed there, look into whether your database can have a query that gives that. It's often called a "bill of materials explosion" or something like that.

  • Multiple criteria search with 4 dropdown lists

    I want to perform a multiple criteria search on a MySQL
    database. Users should be able to use from 4 dropdown lists in a
    form only one criterium, all 4 of them or 2 or 3.
    Each used dropdown list gives a numeric variable: Fvar1 ...
    Fvar4. The variables from the dropdown lists used should be matched
    with numeric fields in the database: DBvar1...DBvar4
    The numeric variables from the dropdown lists that are not
    used, should be ignored.
    Example: a user selects a value in dropdown list 2 and 3 and
    does not use dropdown lists 1 and 4. Fvar1 and Fvar 4 should then
    be ignored for the search, that has to be performed with Fvar2 and
    Fvar3, who have to be matched with DBvar2 and DBvar3.
    Anyone who can help me out with the WHERE statement in my SQL
    query?
    Your help will be greatly appreciated.
    Erik

    Erik61 wrote:
    > I want to perform a multiple criteria search on a MySQL
    database. Users should
    > be able to use from 4 dropdown lists in a form only one
    criterium, all 4 of
    > them or 2 or 3.
    Start by using the Advanced Recordset dialog box to create a
    query that
    looks for all four variables. Then switch to Code view and
    start carving
    up the code created by Dreamweaver.
    The query will look something like this:
    $query_getProducts = sprintf("SELECT product_name, price
    FROM products
    WHERE prod_type = %s AND colour = %s AND size = %s AND range
    = %s
    ORDER BY price ASC",
    GetSQLValueString($var1_getProducts, "text"),
    GetSQLValueString($var2_getProducts, "text"),
    GetSQLValueString($var3_getProducts, "text"),
    GetSQLValueString($var4_getProducts, "text"));
    Change it like this:
    $query_getProducts = "SELECT product_name, price
    FROM products
    WHERE ";
    $where = false;
    if (!empty($_GET['prod_type')) {
    $query_getProducts .= sprintf("prod_type = %s ",
    GetSQLValueString($var1_getProducts, "text"));
    $where = true;
    if (!empty($_GET['colour'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('colour = %s ',
    GetSQLValueString($var2_getProducts, "text"));
    $where = true;
    if (!empty($_GET['size'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('size = %s ',
    GetSQLValueString($var3_getProducts, "text"));
    $where = true;
    if (!empty($_GET['range'])) {
    if ($where) {
    $query_getProducts .= 'AND ';
    $query_getProducts .= sprintf('range = %s',
    GetSQLValueString($var4_getProducts, "text"));
    That builds the query in stages using $where to decide
    whether to add
    "AND" in front of the second, third, and fourth variables.
    David Powers, Adobe Community Expert
    Author, "The Essential Guide to Dreamweaver CS3" (friends of
    ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

Maybe you are looking for

  • Month and Year-To-Date Grouping

    Hello, I have 4 key figures.  For each of the key figures I need to display the value for the month and the value for the year-to-date.  Example, if the user selects October as the month the query should display only the totals for October and the to

  • Adding a space to contact numbers...

    I am adding mobile numbers to my contacts but am wondering how I can add a space when I add them e.g. 0411 000 000, at the moment it only will enter them 0411000000

  • I am running the migration assistant, will having the the screen saver on pause the process?

    I am running migration assistant on my new macbook pro and need to know if having the screen saver on will pause the process? Btw this is my first mac ever and I have only had it 2 days. I have turned off the sleep on both and it is saying 12 hrs to

  • Ghost pictures after upgrading to iPhoto 9.2.3

    I had to reload my external hard drive onto my Mac Pro after I needed a new harddrive. When opening iPhoto, it told me I had to upgrade in order for iPhoto to open so I did. Most of my photos & albums are there. However, there are a few albums that h

  • [quicktime pro] encode

    Hello, I try to encode a video in mp4 isma. Next I have to play this video with another player (osmo4 gpac). There's no problem with a little resolution of the image (QCIF 176x144) but when I choose CIF 352x288, I can't play the video correctly (good