Jun 16, 2016

Usable Things for Bootstrap


  • Bootstrap css front-end framework.
  • jQuery fast, small, and feature-rich JavaScript library.
  • DataTables advanced interaction controls in any HTML table
  • DropzoneJS library that provides drag'n'drop file uploads with image previews
  • EasyPieChart plugin to render and animate nice pie charts with the HTML5 canvas element
  • Flot simple but powerful chart plugin
  • FullCalendar is a jQuery plugin that provides a full-sized, drag & drop calendar
  • Gritter Notification plugin
  • iCheck Custom radio and checkbox buttons
  • IonRangeSlider Easy and light range slider plugin
  • Jasny additional components for bootstrap framework.
  • Jeditable Edit In Place Plugin For jQuery
  • jQueryUI set of user interface interactions, effects, widgets, and themes built on top of the jQuery
  • bootstrapdatepicker datepicker
  • Chosen plugin that makes long, unwieldy select boxes much more user-friendly
  • jsKnob Nice, downward compatible, touchable, jQuery dial.
  • metisMenu Easy menu jQuery plugin for Twitter bootstrap
  • Morris.js good-looking charts library
  • nouislider Lightweight javascript range slider
  • Pace Automatic page load progress bar

Apr 28, 2016

how to use multiple versions of jquery on the same page


Use jQuery.noConflict():

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
<script>
    var $i = jQuery.noConflict();
    alert($i.fn.jquery);
</script> 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script>
    var $j = jQuery.noConflict();
    alert($j.fn.jquery);
</script> 

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script>
    var $k = jQuery.noConflict();
    alert($k.fn.jquery);
</script> 

Feb 26, 2016

Avoid duplicate rows by keep same order in SQL Server


I am looking for another solution for my sql query result.
My query below returns
SELECT 
    M.Mroutes_srno, M.Mroutes_loginid 
FROM
    Mroutes M
LEFT JOIN 
    MAccSanctioningLimit Limit ON M.mroutes_role = Limit.sac_type
                               AND M.Mroutes_moduleno = Limit.sac_moduleno
                               AND M.Mroutes_companycd = Limit.company_cd
WHERE
    M.mroutes_deptcd = 'BKAF'
    AND M.Mroutes_moduleno = 145
    AND M.mroutes_role NOT IN ('MIS', 'CFO', 'MD')
Output:
Mroutes_srno    Mroutes_loginid
--------------------------------
1   --------    AIJ1546
2   --------    BCS8021
3   --------    AIJ1546
4   --------    BCS8021
5   --------    venkatesh
6   --------    151N1636
But, after removing duplicate rows it result like below.
SELECT  
    M.Mroutes_loginid  
FROM
    Mroutes M
LEFT JOIN 
    MAccSanctioningLimit Limit ON M.mroutes_role = Limit.sac_type
                               AND M.Mroutes_moduleno = Limit.sac_moduleno
                               AND M.Mroutes_companycd = Limit.company_cd
WHERE 
    M.mroutes_deptcd = 'BKAF'
    AND M.Mroutes_moduleno = 145
    AND M.mroutes_role NOT IN ('MIS', 'CFO', 'MD')
GROUP BY
    M.Mroutes_loginid 
Output:
Mroutes_loginid
---------------
151N1636
AIJ1546
BCS8021
venkatesh
I need to keep the query in same order.

Answer 

You need to use row_number window function:
;WITH cte AS(
SELECT M.Mroutes_srno,
       M.Mroutes_loginid,
       ROW_NUMBER() OVER(PARTITION BY M.Mroutes_loginid ORDER BY M.Mroutes_srno) rn 
from Mroutes M
left JOIN MAccSanctioningLimit  Limit on M.mroutes_role =Limit.sac_type
    and  M.Mroutes_moduleno = Limit.sac_moduleno
    and M.Mroutes_companycd = Limit.company_cd
where M.mroutes_deptcd ='BKAF'
and M.Mroutes_moduleno =145
and M.mroutes_role NOT in ('MIS', 'CFO', 'MD'))

SELECT Mroutes_srno, Mroutes_loginid
FROM cte 
WHERE rn = 1
ORDER BY Mroutes_srno
Or you can order by aggregation like:
SELECT  M.Mroutes_loginid  
from Mroutes M
left JOIN MAccSanctioningLimit  Limit on M.mroutes_role =Limit.sac_type
    and  M.Mroutes_moduleno = Limit.sac_moduleno
    and M.Mroutes_companycd = Limit.company_cd
where M.mroutes_deptcd ='BKAF'
and M.Mroutes_moduleno = 145
and M.mroutes_role NOT in ('MIS', 'CFO', 'MD')
group by M.Mroutes_loginid
order by min(M.Mroutes_srno)

Jun 23, 2014

Do various things by JSON in ASP.net -3

Do various things by JSON in ASP.net -3


Bind dropdown list by JSON


Do various things by JSON in ASP.net -2

Do various things by JSON in ASP.net -2

Display records in GridView by JSON

 

Do various things by JSON in ASP.net -1

Do various things by JSON in ASP.net -1

Simply Add/Edit records by JSON 



Form Design


Feb 28, 2014

Export DataGridview To Excel

See the code

References:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
using System.Configuration;
using System.IO;

Code for button for exporting to Excel
SaveFileDialog sfd = new SaveFileDialog();
sfd.Filter = "Excel Documents (*.xls)|*.xls";
sfd.FileName = "export.xls";
if (sfd.ShowDialog() == DialogResult.OK)
{
    //ToCsV(dataGridView1, @"c:\export.xls");
    ToCsV(dataGridView1, sfd.FileName); // Here dataGridview1 is your grid view name
} 


Function for exporting to Excel:
private void ToCsV(DataGridView dGV, string filename)
{
        string stOutput = "";
        // Export titles:
        string sHeaders = "";

        for (int j = 0; j < dGV.Columns.Count; j++)
            sHeaders = sHeaders.ToString() + Convert.ToString(dGV.Columns[j].HeaderText) + "\t";
        stOutput += sHeaders + "\r\n";
        // Export data.
        for (int i = 0; i < dGV.RowCount - 1; i++)
        {
            string stLine = "";
            for (int j = 0; j < dGV.Rows[i].Cells.Count; j++)
                stLine = stLine.ToString() + Convert.ToString(dGV.Rows[i].Cells[j].Value) + "\t";
            stOutput += stLine + "\r\n";
        }
        Encoding utf16 = Encoding.GetEncoding(1254);
        byte[] output = utf16.GetBytes(stOutput);
        FileStream fs = new FileStream(filename, FileMode.Create);
        BinaryWriter bw = new BinaryWriter(fs);
        bw.Write(output, 0, output.Length); //write the encoded file
        bw.Flush();
        bw.Close();
        fs.Close();
}


What is the use of n-tier architecture and 3-tier architecture?

how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...