Search Results

Search found 24399 results on 976 pages for 'datatable select'.

Page 9/976 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Select Menu, go to url on select with JQuery?

    - by Keith Donegan
    Hey Guys, I have the following html: HTML markup <ul id="test"> <li><a href="http://www.yahoo.com">yahoo</a></li> <li><a href="http://www.google.com">Google</a></li> </ul> And some JS code: JQuery/JavaScript Code $('ul#test').each(function() { var select=$(document.createElement('select')).insertBefore($(this).hide()); $('>li a', this).each(function() { option=$(document.createElement('option')).appendTo(select).val(this.href).html($(this).html()); }); }); This code produces a select dropdown menu, exactly what I want, but my question is how do I go to the url on select? So if I click yahoo, it brings me to yahoo.com? Thanks for your help!

    Read the article

  • Insert a default row into a combobox that is bound to a datatable?

    - by John M
    On a winform there is a combobox that derives its information from a datatable. The datatable draws from a database list. this.cboList.DataSource = pullData(); this.cboList.DisplayMember = "fieldA"; Once the DataSource is set I am not able to insert a default row (ie *) as the first item in the combobox. I tried this: this.cboList.Items.Insert(0,"*"); Is there a way to insert in the combobox after the datasource is set or should this be done in the datatable?

    Read the article

  • Copying fix no of columns data from one tabel to another table.-DataTable.

    - by Harikrishna
    I have one Datatable like DataTable addressAndPhones; And there are four columns name,address,phoneno,and other details and I only want two columns Name and address from that so I do for that is DataTable addressAndPhones2; addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["name"].ColumnName)); addressAndPhones2.Columns.Add(new DataColumn(addressAndPhones.Columns["address"].ColumnName)); But it gives me error so how can I copy fix no of columns data from one table to another table ? ERROR :Object reference not set to an instance of an object.

    Read the article

  • select row from table and substitute a field with one from another column if it exists

    - by EarthMind
    I'm trying construct a PostgreSQL query that does the following but so far my efforts have been in vain. Problem: There are two tables: A and B. I'd like to select all columns from table A (having columns: id, name, description) and substitute the "A.name" column with the value of the column "B.title" from table B (having columns: id, table_A_id title, langcode) where B.table_A_id is 5 and B.langcode is "nl" (if there are any rows). My attempts: SELECT A.name, case when exists(select title from B where table_A_id = 5 and langcode= 'nl') then B.title else A.name END FROM A, B WHERE A.id = 5 and B.table_A_id = 5 and B.langcode = 'nl' -- second try: SELECT COALESCE(B.title, A.name) as name from A, B where A.id = 5 and B.table_A_id = 5 and exists(select title from B where table_A_id = 5 and langcode= 'nl') I've tried using a CASE and COALESCE() but failed due to my inexperience with both concepts. Thanks in advance.

    Read the article

  • Which index is used in select and why?

    - by Lukasz Lysik
    I have the table with zip codes with following columns: id - PRIMARY KEY code - NONCLUSTERED INDEX city When I execute query SELECT TOP 10 * FROM ZIPCodes I get the results sorted by id column. But when I change the query to: SELECT TOP 10 id FROM ZIPCodes I get the results sorted by code column. Again, when I change the query to: SELECT TOP 10 code FROM ZIPCodes I get the results sorted by code column again. And finally when I change to: SELECT TOP 10 id,code FROM ZIPCodes I get the results sorted by id column. My question is in the title of the question. I know which indexes are used in the queries, but my question is, why those indexes are used? I the second query (SELECT TOP 10 id FROM ZIPCodes) wouldn't it be faster if the clusteder index was used? How the query engine chooses which index to use?

    Read the article

  • Using PHP to populate a <select></select> ?

    - by Flins
    <select name="select"> </select> I want to populate the above tag with values from database. I have written php code up to this. while($row=mysql_fetch_array($result)) { } $row is fetching fetching correct values.. how to add it to the <select> please help... Am new to programming

    Read the article

  • use a sql select statement to get parameters for 2nd select statement

    - by diver-d
    Hi there, I am trying to write a sql statement that I have 2 tables Store & StoreTransactions. My first select command looks like SELECT [StoreID],[ParentStoreID] FROM Store Very simple stuff. How do I take the returned StoreID's and use them for my 2nd select statement? SELECT [StoreTransactionID],[TransactionDate],[StoreID] FROM StoreTransactions WHERE StoreID = returned values from the above query Any help would be great!

    Read the article

  • Change DIV contents on SELECT change

    - by Ian Batten
    I'm looking for a method of how to change the contents of a div when an option on a select dropdown is selected. I came across the following: <script type="text/javascript" src="jquery.js"></script> <!-- the select --> <select id="thechoices"> <option value="box1">Box 1</option> <option value="box2">Box 2</option> <option value="box3">Box 3</option> </select> <!-- the DIVs --> <div id="boxes"> <div id="box1"><p>Box 1 stuff...</p></div> <div id="box2"><p>Box 2 stuff...</p></div> <div id="box3"><p>Box 3 stuff...</p></div> </div> <!-- the jQuery --> <script type="text/javascript" src="path/to/jquery.js"></script> <script type="text/javascript"> $("#thechoices").change(function(){ $("#" + this.value).show().siblings().hide(); }); $("#thechoices").change(); </script> This worked fine on it's own, but I want to use it with the following script: http://www.dynamicdrive.com/dynamicindex1/chainedmenu/index.htm When using it alongside this chainedmenu script, it just loads all of the DIV box contents at once, rather than each div option when a SELECT option is chosen. Any ideas on what I can use alongside this chainedmenu script to get different DIV contents to show for different SELECT options? Thanks in advance, Ian EDIT Here is a test page: http://freeflamingo.com/t/new.html

    Read the article

  • SQL (mySQL) update some value in all records processed by a select

    - by jdmuys
    I am using mySQL from their C API, but that shouldn't be relevant. My code must process records from a table that match some criteria, and then update the said records to flag them as processed. The lines in the table are modified/inserted/deleted by another process I don't control. I am afraid in the following, the UPDATE might flag some records erroneously since the set of records matching might have changed between step 1 and step 3. SELECT * FROM myTable WHERE <CONDITION>; # step 1 <iterate over the selected set of lines. This may take some time.> # step 2 UPDATE myTable SET processed=1 WHERE <CONDITION> # step 3 What's the smart way to ensure that the UPDATE updates all the lines processed, and only them? A transaction doesn't seem to fit the bill as it doesn't provide isolation of that sort: a recently modified record not in the originally selected set might still be targeted by the UPDATE statement. For the same reason, SELECT ... FOR UPDATE doesn't seem to help, though it sounds promising :-) The only way I can see is to use a temporary table to memorize the set of rows to be processed, doing something like: CREATE TEMPORARY TABLE workOrder (jobId INT(11)); INSERT INTO workOrder SELECT myID as jobId FROM myTable WHERE <CONDITION>; SELECT * FROM myTable WHERE myID IN (SELECT * FROM workOrder); <iterate over the selected set of lines. This may take some time.> UPDATE myTable SET processed=1 WHERE myID IN (SELECT * FROM workOrder); DROP TABLE workOrder; But this seems wasteful and not very efficient. Is there anything smarter? Many thanks from a SQL newbie.

    Read the article

  • Bash Shell Script: Nested Select Statements

    - by CCG121
    I have A Script that has a Select statement to go to multiple sub select statements however once there I can not seem to figure out how to get it to go back to the main script. also if possible i would like it to re-list the options #!/bin/bash PS3='Option = ' MAINOPTIONS="Apache Postfix Dovecot All Quit" APACHEOPTIONS="Restart Start Stop Status" POSTFIXOPTIONS="Restart Start Stop Status" DOVECOTOPTIONS="Restart Start Stop Status" select opt in $MAINOPTIONS; do if [ "$opt" = "Quit" ]; then echo Now Exiting exit elif [ "$opt" = "Apache" ]; then select opt in $APACHEOPTIONS; do if [ "$opt" = "Restart" ]; then sudo /etc/init.d/apache2 restart elif [ "$opt" = "Start" ]; then sudo /etc/init.d/apache2 start elif [ "$opt" = "Stop" ]; then sudo /etc/init.d/apache2 stop elif [ "$opt" = "Status" ]; then sudo /etc/init.d/apache2 status fi done elif [ "$opt" = "Postfix" ]; then select opt in $POSTFIXOPTIONS; do if [ "$opt" = "Restart" ]; then sudo /etc/init.d/postfix restart elif [ "$opt" = "Start" ]; then sudo /etc/init.d/postfix start elif [ "$opt" = "Stop" ]; then sudo /etc/init.d/postfix stop elif [ "$opt" = "Status" ]; then sudo /etc/init.d/postfix status fi done elif [ "$opt" = "Dovecot" ]; then select opt in $DOVECOTOPTIONS; do if [ "$opt" = "Restart" ]; then sudo /etc/init.d/dovecot restart elif [ "$opt" = "Start" ]; then sudo /etc/init.d/dovecot start elif [ "$opt" = "Stop" ]; then sudo /etc/init.d/dovecot stop elif [ "$opt" = "Status" ]; then sudo /etc/init.d/dovecot status fi done elif [ "$opt" = "All" ]; then sudo /etc/init.d/apache2 restart sudo /etc/init.d/postfix restart sudo /etc/init.d/dovecot restart fi done

    Read the article

  • Jquery Show Fields depending on Select Menu value but on page load

    - by Tim
    Hello, This question refers to the question http://stackoverflow.com/questions/835259/jquery-show-hide-fields-depening-on-select-value <select id="viewSelector"> <option value="0">-- Select a View --</option> <option value="view1">view1</option> <option value="view2">view2</option> <option value="view3">view3</option> </select> <div id="view1"> <!-- content --> </div> <div id="view2a"> <!-- content --> </div> <div id="view2b"> <!-- content --> </div> <div id="view3"> <!-- content --> </div> $(document).ready(function() { $.viewMap = { '0' : $([]), 'view1' : $('#view1'), 'view2' : $('#view2a, #view2b'), 'view3' : $('#view3') }; $('#viewSelector').change(function() { // hide all $.each($.viewMap, function() { this.hide(); }); // show current $.viewMap[$(this).val()].show(); }); }); When I select the 2nd item in the menu it shows the corresponding field. The exception to this is when the on page load the select menu already has the 2nd menu item selected, the field does not show. As you may be able to tell, I am new to jquery and could definetly use some help with adjusting this code so that the selected item's field is shown on page load. Thanks, Tim

    Read the article

  • problems selecting a mutliple select value from database in Rails

    - by Ramy
    From inside of a form_for in rails, I'm inserting multiple select values into the database, like this: <div class="new-partner-form"> <%= form_for [:admin, matching_profile.partner, matching_profile], :html => {:id => "edit_profile", :multipart => true} do |f| %> <%= f.submit "Submit", :class => "hidden" %> <div class="rounded-block quarter-wide radio-group"> <h4>Exclude customers from source:</h4> <%= f.select :source, User.select(:source).group(:source).order(:source).map {|u| [u.source,u.source]}, {:include_blank => false}, {:multiple => true} %> <%= f.error_message_on :source %> </div> I'm then trying to pull the value from the database like this: def does_not_contain_source(matching_profiles) Expression.select(matching_profiles, :source) do |keyword| Rails.logger.info("Keyword is : " + keyword) @customer_source_tokenizer ||= Tokenizer.new(User.select(:source).where("id = ?", self.owner_id).map {|u| u.source}[0]) #User.select("source").where("id = ?", self.owner_id).to_s) @customer_source_tokenizer.divergent?(keyword) end end but getting this: ExpressionErrors: Bad syntax: --- - "" - B - "" this is what the value is in the database but it seems to choke when i access it this way. What's the right way to do this?

    Read the article

  • Access values of a group of select boxes in php from post

    - by 2Real
    Hi, I'm new to PHP, and I can't figure this out. I'm trying to figure out how to access the data of a group of select boxes I have defined in my HTML code. I tried grouping them as a class, but that doesn't seem to work... maybe I was doing it wrong. This is the following HTML code. <form action="" method="post"> <select class="foo"> <option> 1.....100</option> </select> <select class="foo"> <option> 1.... 500></option> </select> <input type="submit" value="Submit" name="submit"/> </form> I essentially want to group all my select boxes and access all the values in my PHP code. Thanks

    Read the article

  • document.getElementById returns null for my drop-down select menu

    - by tucson
    I am trying to create a drop-down select menu with custom css (similar to the drop-down selection of language at http://translate.google.com/#). I have current html code: <ul id="Select"> <li> <select id="myId" onmouseover="mopen('options')" onmouseout="mclosetime()"> <div id="options" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <option value="1" selected="selected">One</option> <option value="2">Two</option> <option value="3">Three</option> </div> </select> </li> </ul> and the Javascript: function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } But document.getElementById returns null. Though if I use the code with a div element that does not contain a select list the document.getElementById(id) returns proper div value. How do I fix this? or is there a better way to create drop-down select menu like http://translate.google.com ?

    Read the article

  • Move SELECT to SQL Server side

    - by noober
    Hello all, I have an SQLCLR trigger. It contains a large and messy SELECT inside, with parts like: (CASE WHEN EXISTS(SELECT * FROM INSERTED I WHERE I.ID = R.ID) THEN '1' ELSE '0' END) AS IsUpdated -- Is selected row just added? as well as JOINs etc. I like to have the result as a single table with all included. Question 1. Can I move this SELECT to SQL Server side? If yes, how to do this? Saying "move", I mean to create a stored procedure or something else that can be executed before reading dataset in while cycle. The 2 following questions make sense only if answer is "yes". Why do I want to move SELECT? First off, I don't like mixing SQL with C# code. At second, I suppose that server-side queries run faster, since the server have more chances to cache them. Question 2. Am I right? Is it some sort of optimizing? Also, the SELECT contains constant strings, but they are localizable. For instance, WHERE R.Status = "Enabled" "Enabled" should be changed for French, German etc. So, I want to write 2 static methods -- OnCreate and OnDestroy -- then mark them as stored procedures. When registering/unregistering my assembly on server side, just call them respectively. In OnCreate format the SELECT string, replacing {0}, {1}... with required values from the assembly resources. Then I can localize resources only, not every script. Question 3. Is it good idea? Is there an existing attribute to mark methods to be executed by SQL Server automatically after (un)registartion an assembly? Regards,

    Read the article

  • html/js: Refresh 'Select' options

    - by framara
    Hi, There's a class 'Car' with brand and model as properties. I have a list of items of this class List<Car> myCars. I need to represent in a JSP website 2 ComboBox, one for brand and another for model, that when you select the brand, in the model list only appear the ones from that brand. I don't know how to do this in a dynamic way. Any suggestion where to start? Thanks Update Ok, what I do now is send in the request a list with all the brand names, and a list of the items. The JSP code is like: <select name="manufacturer" id="id_manufacturer" onchange="return getManufacturer();"> <option value=""></option> <c:forEach items="${manufacturers}" var="man"> <option value="${man}" >${man}</option> </c:forEach> </select> <select name="model" id="id_model"> <c:forEach items="${mycars}" var="car"> <c:if test="${car.manufacturer eq man_selected}"> <option value="${car.id}">${car.model}</option> </c:if> </c:forEach> </select> <script> function getManufacturer() { man_selected = document.getElementById('id_manufacturer').value; } </script> How do I do to refresh the 'model' select options according to the selected 'man_selected' ?

    Read the article

  • Jquery - Setting form select-field "selected" value only works after refresh

    - by frequent
    Hi, I want to use a form select-field for users to select their country of residence, which shows the IP based country as default value (plus the IP address next to it); Location info (ipinfodb.com) is working. I'm passing "country" and "ip" to the function, which should modify select-field and ip adress Problem: IP adress works, but the select-field only updates after I hit refresh. Can someone tell me why? Here is the code: HTML <select name="setup_changeCountry" id="setup_changeCountry"> <option value="AL-Albania">Albanien</option> <option value="AD-Andorra">Andorra</option> <option value="AM-Armenia">Armenien</option> <option value="AU-Australia">Australien</option> ... </select> <div class="setup_IPInfo"> <span>Your IP</span> <span class="ipAdress"> -- ip --</span> </div> Javascript/Jquery function morph(country,ip) >> passed from function, called on DOMContentLoaded { var ipAdress = ip; $('.ipAdress').text(ipAdress); var countryForm = country; $('#setup_changeCountry option').each(function() { if ($(this).val().substr(0,2) == countryForm) { $(this).attr('selected', "true"); } }); } Thanks for any clues on how to fix this. Frequent

    Read the article

  • How do I display a Wicket Datatable, sorted by a specific column by default?

    - by David
    Hello everyone! I have a question regarding Wicket's Datatable. I am currently using DataTable to display a few columns of data. My table is set up as follows: DataTable<Column> dataTable = new DataTable<Column>("columnsTable", columns, provider, maxRowsPerPage) { @Override protected Item<Column> newRowItem(String id, int index, IModel<Column> model) { return new OddEvenItem<Column>(id, index, model); } }; The columns look like so: columns[0] = new PropertyColumn<Column>(new Model<String>("Description"), "description", "description"); columns[1] = new PropertyColumn<Column>(new Model<String>("Logic"), "columnLogic"); columns[2] = new PropertyColumn<Column>(new Model<String>("Type"), "dataType", "dataType"); Here is my column data provider: public class ColumnSortableDataProvider extends SortableDataProvider<Column> { private static final long serialVersionUID = 1L; private List<Column> list = null; public ColumnSortableDataProvider(Table table) { this.list = Arrays.asList(table.getColumns().toArray(new Column[0])); } public ColumnSortableDataProvider(List<Column> list) { this.list = list; } @Override public Iterator<? extends Column> iterator(int first, int count) { /* first - first row of data count - minimum number of elements to retrieve So this method returns an iterator capable of iterating over {first, first+count} items */ Iterator<Column> iterator = null; try { if(getSort() != null) { Collections.sort(list, new Comparator<Column>() { private static final long serialVersionUID = 1L; @Override public int compare(Column c1, Column c2) { int result=1; PropertyModel<Comparable> model1= new PropertyModel<Comparable>(c1, getSort().getProperty()); PropertyModel<Comparable> model2= new PropertyModel<Comparable>(c2, getSort().getProperty()); if(model1.getObject() == null && model2.getObject() == null) result = 0; else if(model1.getObject() == null) result = 1; else if(model2.getObject() == null) result = -1; else result = ((Comparable)model1.getObject()).compareTo(model2.getObject()); result = getSort().isAscending() ? result : -result; return result; } }); } if (list.size() > (first+count)) iterator = list.subList(first, first+count).iterator(); else iterator = list.iterator(); } catch (Exception e) { e.printStackTrace(); } return iterator; } Sorting by clicking a column works perfectly, but I would like the table to initially be sorted, by default, by the Description column. I am at a loss to do this. If you need to see some other code, please let me know. Thank you in advance!!! - D

    Read the article

  • SQL SERVER – Tricks to Replace SELECT * with Column Names – SQL in Sixty Seconds #017 – Video

    - by pinaldave
    You might have heard many times that one should not use SELECT * as there are many disadvantages to the usage of the SELECT *. I also believe that there are always rare occasion when we need every single column of the query. In most of the cases, we only need a few columns of the query and we should retrieve only those columns. SELECT * has many disadvantages. Let me list a few and remaining you can add as a comment.  Retrieves unnecessary columns and increases network traffic When a new columns are added views needs to be refreshed manually Leads to usage of sub-optimal execution plan Uses clustered index in most of the cases instead of using optimal index It is difficult to debug. There are two quick tricks I have discussed in the video which explains how users can avoid using SELECT * but instead list the column names. 1) Drag the columns folder from SQL Server Management Studio to Query Editor 2) Right Click on Table Name >> Script TAble AS >> SELECT To… >> Select option It is extremely easy to list the column names in the table. In today’s sixty seconds video, you will notice that I was able to demonstrate both the methods very quickly. From now onwards there should be no excuse for not listing ColumnName. Let me ask a question back – is there ever a reason to SELECT *? If yes, would you please share that as a comment. More on SELECT *: SQL SERVER – Solution – Puzzle – SELECT * vs SELECT COUNT(*) SQL SERVER – Puzzle – SELECT * vs SELECT COUNT(*) SQL SERVER – SELECT vs. SET Performance Comparison I encourage you to submit your ideas for SQL in Sixty Seconds. We will try to accommodate as many as we can. If we like your idea we promise to share with you educational material. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Database, Pinal Dave, PostADay, SQL, SQL Authority, SQL in Sixty Seconds, SQL Query, SQL Scripts, SQL Server, SQL Server Management Studio, SQL Tips and Tricks, T SQL, Technology, Video

    Read the article

  • How to read a database record with a DataReader and add it to a DataTable

    - by Olga
    Hello I have some data in a Oracle database table(around 4 million records) which i want to transform and store in a MSSQL database using ADO.NET. So far i used (for much smaller tables) a DataAdapter to read the data out of the Oracle DataBase and add the DataTable to a DataSet for further processing. When i tried this with my huge table, there was a outofmemory exception thrown. ( I assume this is because i cannot load the whole table into my memory) :) Now i am looking for a good way to perform this extract/transfer/load, without storing the whole table in the memory. I would like to use a DataReader and read the single dataRecords in a DataTable. If there are about 100k rows in it, I would like to process them and clear the DataTable afterwards(to have free memory again). Now i would like to know how to add a single datarecord as a row to a dataTable with ado.net and how to completly clear the dataTable out of memory: My code so far: Dim dt As New DataTable Dim count As Int32 count = 0 ' reads data records from oracle database table' While rdr.Read() 'read n records and add them to a dataTable' While count < 10000 dt.Rows.Add(????) count = count + 1 End While 'transform data in the dataTable, and insert it to the destination' ' flush the dataTable after insertion' count = 0 End While Thank you very much for your response!

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >