w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Datagrid Minimum Date in DateTime Field
I think the best way is to assign the default value in the view model. For example: public DateTime DateFilled { get { return _dateFilled; } set { _dateFilled = value; RaisePropertyChanged("DateFilled"); } } private DateTime _dateFilled = DateTime.Today; Alternatively, you could make the view-model property a nullable DateTime?. That way, you can use the binding's TargetNullValue: SelectedDate="{Binding Path=DateFilled,Mode=TwoWay,TargetNullValue={x:Static DateTime.Now}}"

Categories : Wpf

DataGrid edition 'EditItem' is not allowed for this view` when bound to a WPF DataGrid
I tried this and the problem is that you have initialized your Level2 collection as Hashset<>. IEditableCollectionView.EditItem() throws this error while trying to update item in Hashset<>. I initialized the collection as List<> and it was working fine. I am not sure why it is not able to update item in hashset, need to look deeper into it. But changing the Hashset<> to List<> will fix this error. Hope it helps Thanks

Categories : C#

Silverlight Datagrid scrolling, DataGrid fires RowLoading event
The RowLoading event is fired because rows are virtualized. With virtualization, rows are created (and loaded) only when they are visible on screen. So every time you scroll down or up a new row is created, loaded and the RowLoading event fired. To disable the virtualization you can try to set this property: VirtualizingStackPanel.VirtualizationMode="Standard" Be aware that this can slow down the performance of your grid if you have a lot of rows.

Categories : Database

Binding ComboBoxColumn to collection from DataGrid's ItemsSource in WPF DataGrid
MSDN: DataGridComboboxColumns says: To populate the drop-down list, first set the ItemsSource property for the ComboBox by using one of the following options: A static resource. For more information, see StaticResource Markup Extension. An x:Static code entity. For more information, see x:Static Markup Extension. An inline collection of ComboBoxItem types. So basically to just bind to data object`s collection property it`s better to use DataGridTemplateColumn: <DataGridTemplateColumn Header="Log"> <DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox ItemsSource="{Binding log}" /> </DataTemplate> </DataGridTemplateColumn.CellTemplate> </DataGridTemplateColumn> This type of c

Categories : Wpf

Validating A WPF Datagrid Against Data From Another Datagrid
From Microsoft official WPF course materials: ValidationRules are only to be used as simple validations (For instance Required fields, numeric formats, etc). If you need advanced / complex Business Rules validation, you should either implement IDataErrorInfo or create your own validation mechanism (that's what I did and it works like a charm)

Categories : C#

Copy selected row from datagrid at the end of datagrid
For Datagridview Databound you have to commit additional record to datasource (table) So, you have to do "INSERT INTO mytable ( fields here ... ) VALUES ( values here ..)" then to refresh your datagridview .. dt2.datasource = mytable ADDED : For your code ... try change like this insert_cmd.Parameters.AddWithValue("@Name", .item("Name")) insert_cmd.Parameters.AddWithValue("@Age", .item("Age"))

Categories : Sql Server

Master-Detail: On row click in master (DataGrid), display details (DataGrid)
If you searched online, you would have found a number of answers. For example, please take a look at the following articles: WPF Master Details MVVM Application Implementing a simple Master-Detail scenario for WPF in MVVM MVVM - Master Detail

Categories : Wpf

Copying data from a datagrid view to a new form with a new datagrid view VB
"Error 1 Reference to a non-shared member requires an object reference." As this message says: You need a instance of form2 - object of type form2created with New sub, which you created inside of BTN_Next_Click. But local variable frm_PI_01 can be used only inside of that function. With name of class form2 you can used only Shared member or functions/subs MSDN Shared members in VB My opinion if you need transfer some information/variables from form to another then in your case(when you transfer data only once when creating form) use a parameters in form constructors. Add another parameter to you form3 constructor. For example reference of your datagridview(this is may be not good practice referenced controls to another form, better create some variable with needed data and reference th

Categories : Vb.Net

How to add a new row in sql from datagrid and update sql row from same datagrid?
This article on codeproject does a nice (thorough) job of demonstrating what you are asking. It also comes with some demo code. http://www.codeproject.com/Articles/37430/Datagrid-Editing-Updating-Cancel-Selecting-Rows

Categories : SQL

Binding datagrid in datagrid
You have problem with DataContext here. In RowDetailsTemplate you trying to binding to a property in main view model, but DataContext of RowDetailsTemplate is the row item. If you want to binding to property in your main view model you should use RelativeSource binding. Try this: <DataGrid ItemsSource="{Binding Path=Files}" SelectedItem="{Binding Path=DataContext.CurentFile, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Window}}" AutoGenerateColumns="False" > ...

Categories : Wpf

How can embed datagrid in datagrid
I don't think it's possible. You can indeed manually replace a cell with the HTML of another grid (your "child" grid), but Dojo maintains its data in a store. Your store won't be "aware" of any changes you make in the DOM nodes of your grid, and inserting a DataGrid in a store isn't possible either since the DataGrid maps its columns to properties of the data objects.

Categories : Database

Given a particular date, is there a way to search for that date in a free text document without knowing in which format the date is written?
I'm not aware of any preexisting solutions for this, but it's not complicated to write your own. Make an array of the date formats you'd like to search for, then simply iterate over the formats, formatting your date and searching your document: require 'date' formats = ["%-m/%e/%Y", "%m/%d/%Y", "%Y-%m-%d", "%d-%b-%Y", "%B %d, %Y", "%b %d, %Y"] d = Date.new(2013, 1, 10) formats.each do |format| search_string = d.strftime(format) # Do your search for `search_string` end Update: A somewhat more complicated, more efficient method would be to turn the search strings into a Regexp: require 'date' formats = ["%-m/%e/%Y", "%m/%d/%Y", "%Y-%m-%d", "%d-%b-%Y", "%B %d, %Y", "%b %d

Categories : Javascript

PHP Sort Date Added Order By Biggest Date till Smallest Date
This query should definitely work for you: SELECT * FROM t_status ORDER BY date_added DESC Considering you have a table similar to this: CREATE TABLE `t_status` ( `form_no` int(11) NOT NULL AUTO_INCREMENT, `status` varchar(2) DEFAULT NULL, `date_added` datetime DEFAULT NULL, PRIMARY KEY (`form_no`) ) ENGINE=InnoDB AUTO_INCREMENT=5;

Categories : PHP

AngularJS date confusion with | date: 'short' not giving the correct date
The EcmaScprit specifications do not allow for that high of precision in Date values and you are seeing this result when you are applying the 'short' date filter. Anything over order of 3 precision (webkit does 5) and you will run into this issue. <div ng-app ng-init="modifiedDate = '2013-07-09T22:22:22.2425232+08:00'"> <input type="text" ng-model="modifiedDate"/> <h1>{{ modifiedDate | date:'short' }}</h1> <h1>{{ modifiedDate }}</h1> </div> Example showing the problem If you truncate to 5 your date shows displays correctly. 2013-07-09T22:22:22.24252+08:00 Working Example More information from google group

Categories : Angularjs

to select latest date and last but-one date from date column in SQL Server 2005
Simple use of ROW_NUMBER: ;WITH OrderedRows as ( SELECT ID,Date,ROW_NUMBER() OVER (PARTITION BY ID ORDER BY Date desc) rn from Table ) select * from OrderedRows where rn <=2

Categories : SQL

how do i compare current date with user input date from date picker
Create a new Date object this way: Date now = new Date(System.currentTimeMillis()); and use int result = now.compareTo(theOtherDate); result will be an int < 0 if now Date is less than the theOtherDate Date, 0 if they are equal, and an int > 0 if this Date is greater.

Categories : Android

check whether the date entered by the user is current date or the future date
You can compare two dates as if they were Integers: var now = new Date(); if (before < now) { // selected date is in the past } Just both of them must be Date. First search in google leads to this: Check if date is in the past Javascript However, if you love programming, here's a tip: A date formatted like YYYY-MM-DD could be something like 28-12-2013. And if we reverse the date, it is 2013-12-28. We remove the colons, and we get 20131228. We set an other date: 2013-11-27 which finally is 20131127. We can perform a simple operation: 20131228 - 20131127 Enjoy.

Categories : Javascript

jquery datepicker max date min date control using two date picker
Please try the below: <script type = "text/javascript"> $(function () { $("#from").datepicker({ onSelect: function (date) { $("#to").datepicker("option","minDate", date); $("#to").datepicker("option","maxDate", new Date()); }, maxDate: 0 }); }); </script>

Categories : Asp Net

Sql Server Return Max date and Date Nearest to and Greater than Max Date
Assuming SQL Server 2005+, you can use this: ;WITH CTE AS ( SELECT [ID], [Type], [Date], RN = ROW_NUMBER() OVER(PARTITION BY [ID] ORDER BY [Date] DESC) FROM YourTable WHERE [Type] = 'A' ) SELECT A.[ID], A.[Date] [Date A], B.[Date] [Date B] FROM (SELECT * FROM CTE WHERE RN = 1) A CROSS APPLY (SELECT TOP 1 [Date] FROM YourTable WHERE [Type] = 'B' AND [ID] = A.[ID] AND [Date] > A.[Date] ORDER BY [Date]) B The results are: ╔════╦═════════════════════════════════╦═════════════════════════════════╗ ║ ID ║

Categories : Sql Server

LINQ VB.NET Check Date between Effective and End Date (End Date can be null)
.Where(Function(x) _ x.srvc_def_desc = txtSrvDefDesc.Text.Trim() _ AndAlso txtsrvEffDt.SelectedDate >= x.eff_dt _ AndAlso (Not txtSrvEffDt.HasValue() OrElse txtsrvEffDt.SelectedDate <= x.end_dt)).Count() which can be simplified to (if the Count is all you're interested in): .Count(Function(x) _ x.srvc_def_desc = txtSrvDefDesc.Text.Trim() _ AndAlso txtSrvEffDt.SelectedDate >= x.eff_dt _ AndAlso (Not txtSrvEffDt.HasValue() OrElse txtsrvEffDt.SelectedDate <= x.end_dt))

Categories : Vb.Net

Comparing date between date selected with date from the database
you need to fetch data to a variable, then you can select it from array, try this: $class = getfield('class'); $getdata = mysql_query("select * from student where class = '$class' order by name ") or die(mysql_query); $result = mysql_query("select birth_no from student where class = '$class'") or die(mysql_query); $getstud = mysql_fetch_row($result); $result = mysql_query("select date from attendance where birth_no = '$getstud[0]'"); $getdate = mysql_fetch_row($result); echo $getdate[0]; but you should not use mysql_ functions, they are deprecated and will not be supported in future. Instead use mysli_ procedural functions or class http://www.php.net/manual/en/book.mysqli.php

Categories : PHP

How to close the date picker on change for HTML5 Input date element
Try this: $( ".selector" ).datepicker( "hide" ); Reference: http://api.jqueryui.com/datepicker/#method-hide

Categories : Javascript

Angular.js and HTML5 date input value -- how to get Firefox to show a readable date value in a date input?
Why the value had to be given in yyyy-MM-dd? According to the input type = date spec of HTML 5, the value has to be in the format yyyy-MM-dd since it takes the format of a valid full-date which is specified in RFC3339 as full-date = date-fullyear "-" date-month "-" date-mday There is nothing to do with Angularjs since the directive input doesn't support date type. How do I get Firefox to accept my formatted value in the date input? FF doesn't support date type of input for at least up to the version 24.0. You can get this info from here. So for right now, if you use input with type being date in FF, the text box takes whatever value you pass in. My suggestion is you can use Angular-ui's Timepicker and don't use the HTML5 support for the date input.

Categories : Javascript

For a Zend form, how can I update the end date to automatically be one day after the start date when a start date is entered?
When you set the data-date property for the end assign it the value of date("Y-m-d", strtotime("+1 day")); $end_date = new Zend_Form_Element_Text('end_date', array( 'label' => 'End date', 'required' => false, 'filters' => array('StringTrim', 'StripTags'), 'class' => 'input-small datepicker', 'decorators' => $customElementDecorators, 'data-date' => date("Y-m-d", strtotime("+1 day")), 'data-date-format' => 'yyyy-mm-dd', 'value' => date("Y-m-d") ) );

Categories : PHP

Checking for a null date before converting to java.sql.date from java.util.date
In your code if (dateBoxArchived.getValue() != null){ sqlDateArchived = dateBoxArchived.getValue().getTime(); convert last line to sqlDateArchived = new Date(dateBoxArchived.getValue().getTime());`

Categories : Java

onclick show date field and on select date hide date field
You want to check out the jQuery datepicker: http://jqueryui.com/datepicker/ Here's an example: http://jsfiddle.net/h7wau/ HTML: <input type="text" id="datepicker" value="2013-08-11" /> JS: $("#datepicker").click(function () { $(this).datepicker(); });

Categories : Javascript

Incorrect date returned when converting from java.util.date to java.sql.date
This may help you Calendar cal = Calendar.getInstance(); DateFormat df=new SimpleDateFormat("dd/mm/yyyy"); String dateStr="20/04/1961"; Date date = df.parse(dateStr); cal.setTime(date); Date sqlDate = new java.sql.Date(cal.getTime().getTime()); System.out.println("utilDate:" + df.format(date)); System.out.println("sqlDate:" + df.format(sqlDate));

Categories : Java

Date other than current date in gwt date picker
You can add 2 months to java util date and set it to the dateField. Date currentDate = new Date(); CalendarUtil.addMonthsToDate( currentDate, 2 ); dateFieldName.setValue( currentDate ); Hope this would help

Categories : Java

How to get the beginning of date an end of date with the date function
Just add a Less than clause for the day after. Everything BEFORE 1/1/2014 is ALL of 12/31/2013. Where e.id=t.event_id AND deceased='N' AND birth_datetime >= Cast('1/1/2001'AS Datetime) AND birth_datetime < Cast('1/1/2014' AS datetime)

Categories : SQL

How to validate string date is in the ISO 8601 date format before applying correct NSDateFormatter?
The easiest way to validate the format is to actually try converting the string using your date formatter. If it returns nil then the format isn't a match and you can try the other format.

Categories : Objective C

How to block(disable) selecting future date in type="date".in query mobile?
We can set the "max" and "min" date for date input type, using attribute to hidden future date. $('#caseDate').attr("max",today); $('#caseDate').attr("min",today);

Categories : Jquery

How to pivot two date columns and fill in the gaps with multiple overlapping date periods
Unless I'm missing something, I think you're over complicating this: SELECT a.EMPLOYEENUMBER, b.DATE, a.ABSENCETYPE, a.APPROVED FROM Table1 a JOIN Calendar b ON b.Date BETWEEN a.FIRSTDAYOFABSENCE AND a.LASTDAYOFABSENCE Demo: SQL Fiddle

Categories : SQL

Joining the correct budget date range fields based on the date of a service
you can use the BETWEEN clause on a.ID=b.ID AND DOSStart BETWEEN Start_DT AND End_DT . try this: CREATE TABLE #Service_Budget( ID int, SERV_Type int, Start_DT datetime, End_DT datetime, Budget int, NUMBER_OF_MONTHS_OF_SERVICES int ); INSERT INTO #Service_Budget VALUES (13946, 5, '4/2/2012', '4/2/2013', 622.4, 12), (13946, 5, '4/2/2013', '4/2/2014', 788.4, 12) CREATE TABLE #Service_Visits( ID int, Service_Type int, DOSStart datetime, BillableUnits int, RATE_AMOUNT int ); INSERT INTO #Service_Visits VALUES (13946, 5, '4/15/2013', 3,75.5) SELECT a.ID, a.Service_Type, a.DOSStart, MONTH(a.DOSStart) AS Month, YEAR(a.DOSStart) AS Year, MONTH(b.START_DT) AS Start_Month, YEAR(b.START_DT) AS Start_Year, b.Start_DT, b.End_DT,

Categories : SQL

Magento: Special Price From Date and To Date change when updating product programmatically
Since it seem to be a format issue, where it's reversing the day and month (where 4/7 become 7/4) what happen if you try to reset the date $product = Mage::getModel('catalog/product') ->load($productId); $product->setName('Some new name for the product') ->setSpecialFromDate($product->getSpecialFromDate()) // assuming that this = YYYY-MM-DD ->setSpecialFromDateIsFormated(true) ->setSpecialToDate($product->getSpecialTODate()) ->setSpecialToDateIsFormated(true) ->save(); See Set Special Price Programatically In Magento

Categories : Magento

How to show received date of birth values in android date picker dialog?
You are adding 1 to the month. And you are saying that it's printing a month more. So that is probably the problem. view.updateDate(yy, mm + 1, dd); view.updateDate(yy, mm, dd);

Categories : Android

how to select multiple date in calendar? how to change the back color of selected date?
Use Calendar1_PreRender function refer following links http://geekswithblogs.net/dotNETvinz/archive/2009/03/09/tiptrick-aspnet-calendar-control-with-multiple-date-selections.aspx http://asp-net-example.blogspot.in/2011/09/how-to-programmatically-select-multiple.html

Categories : Asp Net

How to display a date attribute of an object as the default value in HTML date input type
You can use the UpdateView generic class based view to simplify this process. A similar question was answered before. The other way to fix this is to use a ModelForm, and pre-load it with an instance. This is actually what UpdateView does, but if you don't want to use class based views, here is the alternative: In your forms.py: from django import forms from someapp.models import SomeModel class SomeModelForm(forms.ModelForm): class Meta: model = SomeModel In your views.py: def someview(request): obj = SomeModel.objects.get(pk=1) # Fetch the object to be edited form = SomeModelForm(instance=obj) # Load the form with the object's data return render(request, 'edit.html', {'form': form}) In edit.html: <form method="POST"> {% csrf_token $} {{ form }} &l

Categories : HTML

Delete posts with custom field date older than current date via cronjob
there's a typo in your code, you're missing an 's' at the end of $result. This: foreach($result as $post){ Should be this: foreach($results as $post){ I just tried it out. Once you make that fix the wp_delete_post() works great. EDIT I'm really unclear on what you're trying to do. You want to check if the custom field is set to some time in the past? What purpose does the continue serve? Also, I'm guessing you're using Advanced Custom Fields (ACF). Using the jquery Date Picker, you can format your date to Ymd by default so you don't have to convert it to a DateTime object. At any rate, this function should explain how to properly set and compare time values, you should be able to take it from there: function foobar_truncate_posts(){ global $wpdb; $currenttime =

Categories : Wordpress

Retrofit GSON serialize Date from json string into java.util.date
Gson can handle only one datetime format (those specified in builder) plus the iso8601 if parsing with custom format is not possible. So, a solution could be to write your custom deserializer. To solve your problem I defined: package stackoverflow.questions.q18473011; import java.util.Date; public class Foo { Date date; Date created_at; public Foo(Date date, Date created_at){ this.date = date; this.created_at = created_at; } @Override public String toString() { return "Foo [date=" + date + ", created_at=" + created_at + "]"; } } with this deserializer: package stackoverflow.questions.q18473011; import java.lang.reflect.Type; import java.text.*; import java.util.Date; import com.google.gson.*; public class FooDeserializer impleme

Categories : Java

jQuery Datepicker Highlight my given date & remove current date highlighted
By overriding the default css .ui-datepicker-today and a.ui-state-highlight of with the below one. .ui-datepicker-today a.ui-state-highlight { border-color: #d3d3d3; background: #e6e6e6 url(/themeroller/images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; color: #555555; } Check out this JSFiddle

Categories : Jquery



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.