logo
down
shadow

Modifying SQL code to pick the Dropdown list instead of constant text


Modifying SQL code to pick the Dropdown list instead of constant text

By : user2185261
Date : November 21 2020, 04:01 AM
wish of those help In the below query I would like to redirect ''MyDivision_1'' (MyDivision_1 is a constant text) to a dropdown list selection. , You can use a parameter inside SELECT query like this:
code :
SELECT sProductName, sDivision, sStockistName, Qty FROM TblPresentStock 
WHERE sDivision = @MyDivision_1
<%-- Dropdownlist example --%>
<asp:DropDownList ID="DropDownList1" runat="server" ... />
    <asp:ListItem Text="SampleText" Value="SampleValue" />
    ...
</asp:DropDownList>

<%-- SqlDataSource --%>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" 
 ConnectionString="<%$ ConnectionStrings:dbFOConnectionString %>" 
 SelectCommand="..." ...>
     <SelectParameters>
         <asp:ControlParameter ControlID="DropDownList1"
              PropertyName="SelectedValue"
              Name="MyDivision_1"
              Type="String" />
     </SelectParameters>
</asp:SqlDataSource>


Share : facebook icon twitter icon
I have binded a grid with List<int> (temporary list), how can i pick the list text into controls text in item temp

I have binded a grid with List<int> (temporary list), how can i pick the list text into controls text in item temp


By : L. Thornton
Date : March 29 2020, 07:55 AM
hop of those help? I have binded a grid with List (temporary list), how can I pick the list text into controls text in item template in grid view. , If I get you, lstdenomination is a List. You can do this
code :
   <asp:TemplateField HeaderText="Value">
        <ItemTemplate> 
            <asp:Label ID="lblValue" runat="server" Text='<%# Container.DataItem %>'> </asp:Label>
        </ItemTemplate>
    </asp:TemplateField>
how to pick dropdown list item

how to pick dropdown list item


By : Jonathan Tinajero
Date : March 29 2020, 07:55 AM
hop of those help? Define a change event for your select, get the selected value, and go from there (assign values to your option elements)
code :
$("#middle").change(function() {
    var selected = this.value; //value of selected attribute
    if (selected == "call1") //do stuff
});
dropdown dependent pick list

dropdown dependent pick list


By : Venkatesh J
Date : March 29 2020, 07:55 AM
When a user pick a speaker name on a dropdown list only the speakers expertise will show in the next topic dropdown list

When a user pick a speaker name on a dropdown list only the speakers expertise will show in the next topic dropdown list


By : stryitg
Date : March 29 2020, 07:55 AM
I hope this helps . There are some basic things you can look to improve with your implementation. The biggest is you don't need to keep querying the same table for different pieces of data. If you are okay with running the SELECT * on the speakers table then you can skip the rest of your queries.
The next task is to try and make your code less dependent on singular values. If you notice you are writing the same code for value 1, value 2, etc then try to think about how to abstract your code so that it can work for an unlimited number of values.
code :
<?php

    // Based on your code and image these appear to be the fields in the speakers table:
    //  speaker_fullname
    //  speaker_image
    //  speaker_videolink
    //  speaker_specialization1
    //  speaker_specialization2
    //  speaker_specialization3
    //  speaker_specialization4
    //  speaker_specialization5

    // Make your connection
    $conn = new mysqli($servername, $username, $password, $dbname);

    // Get speakers and all their data (you only need one query!)
    $result = mysqli_query($conn, "SELECT * FROM speakers");

    // Store the speakers for later
    //  (You could maybe use this instead but depends on your PHP version:)
    //      -> http://php.net/manual/en/mysqli-result.fetch-array.php
    $speaker_array = array();
    while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) {
        $speaker_array[] =  $row;      
    }         

    // Apparently you have session values? You don't start the session though?
    //  See: http://php.net/session_start
    $session_speaker_fullname = ( ! empty($_SESSION["selectedSpeaker"])) ? $_SESSION["selectedSpeaker"] : '';

?>
<html>
    <head>
    </head>
    <body>
        <div class="form-group">
            <label for="speaker">Preferred Speaker:</label>
            <select name="speaker" class="form-control" id="speaker" style='text-transform:capitalize;'>
                <option value=""></option>
                <?php foreach($speaker_array as $row):;?>
                    <option value="<?php echo $row['speaker_fullname'];?>" 
                        <?php if($session_speaker_fullname == $row['speaker_fullname']) echo "selected";?>
                        ><?php echo $row['speaker_fullname'];?></option>
                <?php endforeach;?>
            </select>
        </div>
        <div class="form-group">
            <label for="topic" id="topicTitle" class="hidden">Topic:</label>
            <select name="topic" class="form-control" id="topic" style='text-transform:capitalize;' autofocus required="required">
                <!-- this will get populated via JavaScript -->                        
            </select>
        </div>
        <script type="text/javascript">

            // Let your data be used by JavaScript
            var speaker_array = <?php echo json_encode($speaker_array); ?>;

            // A function to update the topic select
            function update_topic_select_list() {

                // Clear the current topic list
                $('#topic').html('');

                // Only re-build the topic list if a speaker is selected
                if ($('#speaker option:selected').val() != '') {
                    var topic_array = Array();

                    // Find the correct speaker
                    for (var i = 0; i < speaker_array.length; i++) {

                        // The speaker name matches
                        if (speaker_array[i].speaker_name == $('#speaker option:selected').val())

                            // Add the values to the topic array
                            topic_array.push(speaker_array[i].speaker_specialization1);
                            topic_array.push(speaker_array[i].speaker_specialization2);
                            topic_array.push(speaker_array[i].speaker_specialization3);
                            topic_array.push(speaker_array[i].speaker_specialization4);
                            topic_array.push(speaker_array[i].speaker_specialization5);

                            // Stop the loop
                            break;
                        }
                    }

                    // Update the topic list
                    for (var i = 0; i < topic_array.length; i++) {

                        // Don't add empty values
                        if (topic_array[i] != '') {
                            $('#topic').append('<option value="' + topic_array[i] + '">' + topic_array[i] + '</option>');
                        }
                    }
                }
            }

            // Watch for changes to the speaker selection
            $('#speaker').change(function() {

                // Do you need to do anything else?

                // Call the update function
                update_topic_select_list();
            });

            // Force a change trigger after page load - in case you need that session value set?
            $('#speaker').trigger('change');
        </script>
    </body>
</html>
Python and Selenium - Pick value from dropdown list

Python and Selenium - Pick value from dropdown list


By : user3614488
Date : March 29 2020, 07:55 AM
I wish this help you Induce WebDriverWait() and element_to_be_clickable() and click on first dropdown div tag to expand and the click on the dropdown item.Hope this will work.
code :
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.dropdown__selector"))).click()
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//ul[contains(@class,'dropdown__menu')]//li[@class='dropdown__menu_item']//a[@data-et-on-tab='women' and text()='Dresses']"))).click()
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.CSS_SELECTOR,"div.dropdown__selector"))).click()
WebDriverWait(driver,10).until(EC.element_to_be_clickable((By.XPATH,"//div[contains(@class,'dropdown__selector')]/following::div[1]//ul[contains(@class,'dropdown__menu')]//li[@class='dropdown__menu_item']//a[@data-et-on-tab='women' and text()='Dresses']"))).click()
Related Posts Related Posts :
  • Insert rows not contained in one table to another
  • Is it possible to add values from an array of tuples to separate columns in a table
  • Syntax error while using multiple rename RENAME expressions postgresql
  • SQL Server : concat values
  • Querying Column Headers in GBQ
  • How to sort the row of record and update dynamically in SQL?
  • Linked server not showing on database list
  • How do I dynamically make calculations via a CASE statement based on the results of the previous row's calculations in O
  • SQL Trouble finding SUM Costs of Object grouped by the object on different dates
  • oracle query to fetch count
  • Epoch conversion to DateTime in SQL
  • SQL Set Value of a Column Using COUNT(*)
  • SQL GROUP BY Column Value
  • Is it true that all joins following a left join in a SQL query must also be left joins? Why or why not?
  • Need SQL JOIN statement assistance
  • Unexpected results with PATINDEX
  • Oracle 11 query to combine multiple rows into 1 row
  • How to compare 2 converted dates in sql
  • From a bit complex SQL statement to preparedStatement
  • How to count distinct logins
  • SQL Server - Operand type clash: numeric is incompatible with datetimeoffset
  • Splitting 24 hours into 96 equal 15 minute intervals in T-SQL
  • WHERE clause not hitting on LEFT JOIN
  • SQL Pivot String Data
  • Redshift - Find % as compared to total value
  • How to find count of N columns in a table
  • SQL statement giving no result
  • IN condition is not working when the data is like 'Test','Test' from a result query
  • SUM of COUNT with only certain variables
  • How to get all products with at least X reviews in SQL?
  • sql Group by columns to the same row without join
  • Check if an integer is within the next 5 increments in SQL, when the numbers can wrap
  • Case and When query give me both column filled
  • How to check JSON string on contains field AND like value?
  • Find uncovered periods without exploding each combination
  • How to compare date to format date on oracle
  • SQL Server : duplicate rows when joining tables and inserting new data?
  • Oracle - Combine timestamp with date and remove duplicates
  • Array to json and row to json in SQL Server 2016
  • How to get max value of column values in a record ? (BigQuery)
  • Elasticsearch filter after aggregation
  • Teradata: varchar to timestamp 2
  • specific row number with all the fields
  • INSERT INTO SELECT query in SQL where primary key is used and multiple duplicates are in another table
  • SQL Query - Eliminate records
  • What is wrong with this SQL join query
  • Hybris Flexible search union query to fetch products
  • Stale Data Count
  • Adding new column of total_event
  • Query to Skip the first Delimiter and select the second Delimiter In SQL
  • Very slow (12+ hours) large table joins in postgres
  • LINQ query for specific group
  • SQL - return xpath for multiple XML results
  • Can't compile my trigger in Apex Oracle SQL/PL PLS-00103
  • Select 1 field from a group
  • Airflow + pandas read_sql_query() with commit
  • Get higest value of each relation
  • SQL - select limit column2 values for distinct column 1
  • Compilation failed, PLS-00103 pl/sql
  • SQL Query for all IDs where all rows with that ID match a value in another column
  • shadow
    Privacy Policy - Terms - Contact Us © bighow.org