Wednesday 29 October 2014

ASP.NET CheckBoxList check and uncheck with jQuery

//

function SetFishingDay() {
                var txtval = $("#<%= txt_setday.ClientID %>").val();
                var $ctrls = $('#<%= chkdayoffishing.ClientID %>');
                var mm = '';
                //Uncheck all
                var selValuefalse = [1,2,3,4,5,6,7];              
                for (var i = 0; i < selValuefalse.length; i++) {
                    $ctrls.find('input:checkbox[value=' + selValuefalse[i] + ']').prop('checked', false);
                }

                //check selected
                var selValuetrue = [];
                for (var i = 0; i < txtval.length; i++) {
                    selValuetrue.push(txtval[i]);
                }
                var $ctrls = $('#<%= chkdayoffishing.ClientID %>');
                for (var i = 0; i < selValuetrue.length; i++) {
                    $ctrls.find('input:checkbox[value=' + selValuetrue[i] + ']').prop('checked', true);
                }

                return false;

            }

Wednesday 8 October 2014

Pesudo class which is use with out using javascript class

There are a lot more Pseudo Class available through which we can really add special effects without using JavaScript. Below listed Pseudo Classes are some of the examples among those:
  1. :first-child
  2. :focus
  3. :hover
  4. :right
  5. :target
  6. :valid
  7. :visited
  8. :active
  9. :checked
  10. :default
  11. :dir()
  12. :disabled
  13. :empty 
  1. :enabled
  2. :first
  3. :root
  4. :scope
  5. :last-child
  6. :last-of-type
  7. :left
  8. :link
  9. :not()
  10. :nth-child()
  11. :only-child
  12. :first-of-type
  13. :fullscreen

  1. :only-of-type
  2. :optional
  3. :out-of-range
  4. :read-only
  5. :read-write
  6. :required
  7. :indeterminate
  8. :in-range
  9. :invalid
  10. :lang()
  11. :nth-last-child()
  12. :nth-last-of-type()
  13. :nth-of-type()
Note: Please check here for browser support details.

Thanks Smile | :) and I will be happy to head from you.

Monday 6 October 2014

Select query with case using multiple when conditions to get Months from datetime columns

//Query

select CONVERT(date, Tally_VOUCHER.Date), CASE
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=4 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 1 else 2 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=5 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 3 else 4 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=6 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 5 else 6 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=7 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 7 else 8 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=8 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 9 else 10 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=9 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 11 else 12 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=10 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 13 else 14 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=11 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 15 else 16 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=12 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 17 else 18 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=1 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 19 else 20 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=2 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 21 else 22 end
  WHEN DATEPART(MONTH,CONVERT(date, Tally_VOUCHER.Date))=3 then
  case when DATEPART(DAY,CONVERT(date, Tally_VOUCHER.Date))<=15 then 23 else 24 end
   
END Month_Num

from Tally_VOUCHER



//Result

Dates               Month_Num
2013-10-31               14
2013-12-31               18
2013-11-29               16
2013-12-04               17
2013-04-25               2
2013-07-05               7
2013-07-31               8
2013-05-15               3
2013-08-27               10
2013-09-24               12
2013-11-04               15
2013-06-29               6
2013-05-31               4
2013-06-10               5
2013-09-01               11

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...