<?xml version="1.0" encoding="UTF-8" standalone="no"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:gd="http://schemas.google.com/g/2005" xmlns:georss="http://www.georss.org/georss" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-5496434591640077045</atom:id><lastBuildDate>Wed, 04 Sep 2024 14:19:38 +0000</lastBuildDate><category>Ajax in MVC4</category><category>@HTML.ActionLink</category><category>Action Link in MVC4</category><category>Action call on Html button click</category><category>Adding item from Dropdown list using Jquery</category><category>Before inserting Check Item already exist into the listbox or not using javascript</category><category>Block UI</category><category>Browser Comaptible Jquery/Javascript</category><category>Browser Comaptible Menu bar</category><category>C# generating Excel sheet</category><category>CRUD Operation using AngularJs</category><category>CRUD operation using Linq and EF</category><category>Check checkbox selected or not using Jquery</category><category>Column Sorting in AngularJs</category><category>Comparison of two dates which are selected using jquery date picker</category><category>Confirmation On Action link</category><category>Connection string Encryption</category><category>Controller action returns JSON  result in MVC4</category><category>Count of dropdown element</category><category>Creating attribute in mvc4</category><category>Custom Attribute in mvc4</category><category>Cut and Paste item from one dropdown to other using Jquery</category><category>DataTable in C#</category><category>Delete listbox items</category><category>Different variations in where claue</category><category>Display DataTable on view</category><category>Display DataTable result on HTML</category><category>Display crystal report on web page in mvc4</category><category>Dropdown list autocomplete fills dropdown</category><category>Dynamic Where clause in SQL</category><category>Enabling dropdown list</category><category>Excel Sheet Writting using C#</category><category>Find all dates between two dates</category><category>Free SMS sending using C#</category><category>Get checked checkboxes only from checkbox group</category><category>Get selected value and text from dropdown list</category><category>Getting single column from DataTable</category><category>Getting value html element using Jquery</category><category>Getting web.config value in C#</category><category>Grid search in AngularJs</category><category>HTML 5 AngularJs Required validator</category><category>Html Link in MVC4</category><category>Image Wirting in Excel file</category><category>Image Wirting in Excel file from server</category><category>In clause in SQl</category><category>Inner Join in Linq</category><category>Instead of system Exception show user defined error message</category><category>JSON Undefied in IE</category><category>Join in Linq</category><category>Join on Linq to Entities</category><category>Json Result using Ajax call</category><category>Json not working in IE</category><category>Json size problem in ajax and mvc4</category><category>JsonResult in mvc4</category><category>Left Outer Join in Linq</category><category>Length Of Selected Checkbox</category><category>Length Of Selected Radio Button</category><category>Length of dropdown element</category><category>Linq Join Query</category><category>Listbox operation using Jqery and javascript</category><category>MVC setting existing item selected in listbox</category><category>MVC4 Validations</category><category>Menubar with submenus</category><category>Message box in MVC4</category><category>Multilevel menu bar</category><category>Nested Query in Sql</category><category>Page refresh</category><category>PagedList in mvc4</category><category>Pagination using PagedList.Mvc in mvc4</category><category>Pass Javascript object through Ajax in MVC</category><category>Pass Javascript object to MVC controller using Ajax</category><category>Passing data to SP from MVC4</category><category>Passing items from one listbox to other on button click</category><category>Passing parameter to SQL store procedure</category><category>Passing value from one dropdown to other using Jquery</category><category>Popup in MVC4</category><category>RD Calculator</category><category>ROWLOCK in SQL Server</category><category>Refresh page using Javascript</category><category>Regex in JavaScript</category><category>Removing item from Dropdown list using Jquery</category><category>Report viewer in mvc4</category><category>Required attribute</category><category>SQL In clause</category><category>SQL Join statement</category><category>SQL like pattern</category><category>Selected coloumn of datatable shown into dropdown list</category><category>Selecting dropdown item using Javascript</category><category>Selecting dropdown item using Jquery</category><category>Sending mail to multile persons</category><category>Session Management in MVC4</category><category>Showing DataTable into DropdownList in MVC4</category><category>Sql nested query</category><category>Submit Html form only once</category><category>Submit form only once on submit button click</category><category>Trasnsaction Commit and Rollbcak in SQL Server</category><category>User Control In MVC4</category><category>User defined error messages in mvc4</category><category>Using Ajax set already selected item into list</category><category>Validation using JavaScript</category><category>Validations using Attributes</category><category>Vertical Menumbar using CSS and HTML</category><category>VirtualPathUtility.ToAbsolute()</category><category>Web.Config file connection string encryption and decryption</category><category>Write HTML Table into Excel file using Jquery</category><category>Writing Excel file using Jquery</category><category>Writing datatable into text file and then download the text file</category><category>Writting DataTable into Excel Sheet</category><category>crystal report viewer in mvc4</category><category>disabling dropdown list</category><category>download image</category><category>get count of checked checkbox among checkbox group</category><category>get selected column from datatable</category><category>page reload using javascript</category><category>sql distinct query</category><category>storing value into web.config</category><category>stringlegth attribute</category><category>subquery in Linq to entites</category><category>using VirtualPathUtility.ToAbsolute()</category><category>using site2SMS api form message sending</category><category>where and order by in Linq</category><title>technisher.in</title><description></description><link>http://technisher.blogspot.com/</link><managingEditor>noreply@blogger.com (Anonymous)</managingEditor><generator>Blogger</generator><openSearch:totalResults>64</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><language>en-us</language><itunes:explicit>no</itunes:explicit><itunes:subtitle/><itunes:owner><itunes:email>noreply@blogger.com</itunes:email></itunes:owner><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-6127317910792005838</guid><pubDate>Wed, 21 Oct 2015 13:25:00 +0000</pubDate><atom:updated>2017-06-11T10:13:12.455+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">HTML 5 AngularJs Required validator</category><category domain="http://www.blogger.com/atom/ns#">RD Calculator</category><title>Recurring Deposite Calculator using AngularJs and HTML5</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;div&gt;
&lt;pre&gt;Here I have created &lt;b&gt;Recurring Deposit&lt;/b&gt; Calculator using angularjs and HTML5&lt;br /&gt;


&lt;/pre&gt;
&lt;code&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiP5JQ6fzPY-SWoahNck7imnqmy1PjjdAqolRVUuejCT5-PiphyEKsyDLN4xq9KlBy8dAykQs6CdubaWxrs3I18vUBxwFipX0TXVVDvF_53E6PBEpIkmJ35zMtGTqcUMcCm98t2D1epoU/s1600/agu.jpg" imageanchor="1"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiP5JQ6fzPY-SWoahNck7imnqmy1PjjdAqolRVUuejCT5-PiphyEKsyDLN4xq9KlBy8dAykQs6CdubaWxrs3I18vUBxwFipX0TXVVDvF_53E6PBEpIkmJ35zMtGTqcUMcCm98t2D1epoU/s400/agu.jpg" /&gt;&lt;/a&gt;
&lt;/code&gt;&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;&amp;amp;lt!DOCTYPE html&amp;amp;gt
&amp;amp;lthtml&amp;amp;gt
&amp;amp;lthead&amp;amp;gt

&amp;amp;ltscript 
src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"&amp;amp;gt
&amp;amp;lt/script&amp;amp;gt

&amp;amp;ltlink rel="stylesheet" 
 href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&amp;amp;gt

&amp;amp;ltstyle&amp;amp;gt
#tbl ,th, td {
  border: 1px solid grey;

  padding: 5px;
}
#tbl 
{
   width:100%;
}

div 
{
 margin:5%;
 width:500px;
}


.label
{
   background-color: #707070;
}

#tbl tr:nth-child(odd) {
  background-color: #f1f1f1;
}
#tbl tr:nth-child(even) {
  background-color: #ffffff;
}

fieldset.scheduler-border {
    border: 1px groove #ddd !important;
    padding: 0 1.4em 1.4em 1.4em !important;
    margin: 0 0 1.5em 0 !important;
    -webkit-box-shadow:  0px 0px 0px 0px #000;
            box-shadow:  0px 0px 0px 0px #000;
}

    legend.scheduler-border {
        font-size: 1.2em !important;
        font-weight: bold !important;
        text-align: left !important;
        width:auto;
        padding:0 10px;
        border-bottom:none;
    }
&amp;amp;lt/style&amp;amp;gt

&amp;amp;lt/head&amp;amp;gt

&amp;amp;ltbody&amp;amp;gt

&amp;amp;ltdiv  ng-app="myApp"  ng-controller="rdCtrl"&amp;amp;gt
&amp;amp;ltfieldset class="scheduler-border"&amp;amp;gt
&amp;amp;ltlegend class="scheduler-border"&amp;amp;gtRd Calculator&amp;amp;lt/legend&amp;amp;gt
&amp;amp;ltform name="myForm" step="any" ng-model="formModel" 
ng-submit="Calculate()" &amp;amp;gt 
&amp;amp;lttable&amp;amp;gt
&amp;amp;lttr&amp;amp;gt
&amp;amp;lttd&amp;amp;gtMonthly Installment(R) :&amp;amp;lt/td&amp;amp;gt
&amp;amp;lttd&amp;amp;gt&amp;amp;ltinput type="number" step="any" class="form-control" 
name="rdamount" ng-model="rdamount" required&amp;amp;gt&amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
&amp;amp;lttr&amp;amp;gt
&amp;amp;lttd&amp;amp;gtRate of Interest :&amp;amp;lt/td&amp;amp;gt
&amp;amp;lttd&amp;amp;gt&amp;amp;ltinput type="number" step="any" class="form-control" 
name="interestrate" ng-model="interestrate" required&amp;amp;gt&amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
&amp;amp;lttr&amp;amp;gt
&amp;amp;lttd&amp;amp;gtNumber of Months(n)  : &amp;amp;lt/td&amp;amp;gt
&amp;amp;lttd&amp;amp;gt
&amp;amp;ltselect name="rdperiod" class="form-control" ng-model="rdperiod" &amp;amp;gt 
 &amp;amp;ltoption data-ng-repeat="month in months" value="{{month.value}}"&amp;amp;gt
{{month.text}}
&amp;amp;lt/option&amp;amp;gt
&amp;amp;lt/select&amp;amp;gt
&amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
&amp;amp;lttr&amp;amp;gt
&amp;amp;lttd&amp;amp;gtMaturity : &amp;amp;lt/td&amp;amp;gt
&amp;amp;lttd&amp;amp;gt{{rdmaturity | number:2}}&amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
&amp;amp;lttr&amp;amp;gt
&amp;amp;lttd colspan="2"&amp;amp;gt
&amp;amp;ltinput type="submit" class="form-control btn btn-info" &amp;amp;gt
&amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
&amp;amp;lt/table&amp;amp;gt
&amp;amp;lt/form&amp;amp;gt
 &amp;amp;lt/fieldset&amp;amp;gt
&amp;amp;lt/div&amp;amp;gt
&amp;amp;lt/body&amp;amp;gt
&amp;amp;lt/html&amp;amp;gt

&amp;amp;ltscript&amp;amp;gt

var app = angular.module('myApp', []);

app.controller('rdCtrl', function($scope) {
/****Initialisation at start ********/
 $scope.rdamount= 3000;
 $scope.interestrate = 8.7;
 $scope.rdperiod = 3;

$scope.Calculate = function() { 
 $scope.interestrate1=$scope.interestrate/400;
 $scope.quarter=$scope.rdperiod/3;
 $scope.rdmaturity=
 ($scope.rdamount*[ (Math.pow((1+$scope.interestrate1),$scope.quarter))-1])/
( 1- Math.pow((1+$scope.interestrate1),-1/3));
       }

$scope.months=[];

for(i=3;i&amp;amp;lt=120;i=i+3)
$scope.months.push({value:i,text:i});

});
&amp;amp;lt/script&amp;amp;gt
&lt;/code&gt;&lt;/pre&gt;
&lt;code&gt;
&lt;/code&gt;
&lt;/div&gt;
&lt;/div&gt;
</description><link>http://technisher.blogspot.com/2015/10/recurring-deposite-calculator-using.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgiP5JQ6fzPY-SWoahNck7imnqmy1PjjdAqolRVUuejCT5-PiphyEKsyDLN4xq9KlBy8dAykQs6CdubaWxrs3I18vUBxwFipX0TXVVDvF_53E6PBEpIkmJ35zMtGTqcUMcCm98t2D1epoU/s72-c/agu.jpg" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-7355639892022779283</guid><pubDate>Mon, 12 Oct 2015 06:23:00 +0000</pubDate><atom:updated>2015-10-22T22:25:56.524+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Column Sorting in AngularJs</category><category domain="http://www.blogger.com/atom/ns#">CRUD Operation using AngularJs</category><category domain="http://www.blogger.com/atom/ns#">Grid search in AngularJs</category><title>CRUD Operation, Searching, sorting and pagination using AngluarJs</title><description>&lt;div&gt;
&lt;p&gt;
&lt;pre&gt;
This is one simple angularjs Application with &lt;b&gt; Searching,Sorting, Pagination,
along with CRUD &lt;/b&gt; Operation on simple array of object.

Before doing copy paste kindly add one additional JS file i.e
&lt;b&gt;dirPagination.js&lt;/b&gt;.
After that just change the reference address of that file which is 
specified in head section.

To get dirPagination.js &lt;a  href="https://github.com/michaelbromley/angularUtils/blob/master/src/directives/pagination/dirPagination.js" target=_blank&gt;Click here. &lt;/a&gt;
&lt;/pre&gt;


&lt;/p&gt;
&lt;code&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv7DGFwRcfwlvgFK9vP6jg4y9omkVyoNfA0Kx9UfuEgBqrbms4JVf3y0krw6AVHyXz-HpPjZm51zpv5wgNL6gtno9UO0IZShX98SY5PSNUdPCyeHSTwpt57RUilkb7oKKlyNskCE3xTX0/s1600/AJ+CRUD.jpg" imageanchor="1" &gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv7DGFwRcfwlvgFK9vP6jg4y9omkVyoNfA0Kx9UfuEgBqrbms4JVf3y0krw6AVHyXz-HpPjZm51zpv5wgNL6gtno9UO0IZShX98SY5PSNUdPCyeHSTwpt57RUilkb7oKKlyNskCE3xTX0/s320/AJ+CRUD.jpg" /&gt;&lt;/a&gt;
&lt;pre&gt;
&amp;ltdiv dir="ltr" style="text-align: left;" trbidi="on"&amp;gt


&amp;lt!DOCTYPE html&amp;gt
&amp;lthtml&amp;gt
&amp;lthead&amp;gt

&amp;ltscript 
src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"&amp;gt
&amp;lt/script&amp;gt
&amp;ltscript src="D:/Study/anugular/dirPagination.js"&amp;gt&amp;lt/script&amp;gt
&amp;ltlink rel="stylesheet"
 href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&amp;gt

&amp;ltstyle&amp;gt
#tbl ,th, td {
  border: 1px solid grey;
  border-collapse: collapse;
  padding: 5px;
}
#tbl 
{
   width:100%;
}

div 
{
 margin:5%;
 width:500px;
}

.label
{
   background-color: #707070;
}

#tbl tr:nth-child(odd) {
  background-color: #f1f1f1;
}
#tbl tr:nth-child(even) {
  background-color: #ffffff;
}
&amp;lt/style&amp;gt

&amp;lt/head&amp;gt

&amp;ltbody&amp;gt

&amp;ltdiv  ng-app="myApp"  ng-controller="personCtrl"&amp;gt

&amp;lt!-- Create New Employee --&amp;gt
&amp;ltdiv ng-hide="editorEnabled"&amp;gt
&amp;ltform name="myForm" ng-model="formModel" ng-submit="addEmployee()" 
novalidate&amp;gt &amp;lttable id="tbl"&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtName: &amp;lt/td&amp;gt
&amp;lttd&amp;gt
&amp;ltinput type="text" name="username" ng-model="name" required&amp;gt
 
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtCountry:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltinput type="text" ng-model="country" required&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtAge:&amp;lt/td&amp;gt
&amp;lttd&amp;gt &amp;ltinput type="number" ng-model="age" required&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtEmail:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltinput type="email" name="emailid" ng-model="email" required&amp;gt

&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtGender:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltlabel data-ng-repeat="gender in genders"&amp;gt
    &amp;ltinput name="Gender"  type="radio"  value="{{gender.value}}" 
  ng-model="$parent.personGender" /&amp;gt  {{gender.text}} &amp;nbsp;&amp;nbsp;
&amp;lt/label&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtDepartment:&amp;lt/td&amp;gt
&amp;lttd&amp;gt
 &amp;ltselect name="dept" ng-model="department" &amp;gt 
 &amp;ltoption  data-ng-repeat="dept in departments" 
       value="{{dept.value}}"&amp;gt{{dept.text}}&amp;lt/option&amp;gt
 &amp;lt/select&amp;gt
&amp;ltspan style="color:red" ng-show="myForm.dept.$dirty &amp;&amp; myForm.dept.$invalid"&amp;gt
  &amp;ltspan ng-show="myForm.dept.$error.required"&amp;gtDepartment is required.&amp;lt/span&amp;gt
  &amp;lt/span&amp;gt &amp;lt/span&amp;gt
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd colspan="2"&amp;gt
&amp;ltinput type="submit" &amp;gt
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lt/table&amp;gt
&amp;lt/form&amp;gt
&amp;lt/div&amp;gt

&amp;lt!-- Edit Employee --&amp;gt
&amp;ltdiv ng-show="editorEnabled"&amp;gt
&amp;ltform name="editablemyForm" ng-model="editableformModel" ng-submit="saveEmployee()" 
 novalidate&amp;gt
&amp;lttable id="tbl"&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtName: &amp;lt/td&amp;gt
&amp;lttd&amp;gt
&amp;ltinput type="text" name="editableusername" ng-model="editablename" required&amp;gt
 
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtCountry:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltinput type="text" ng-model="editablecountry" required&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtAge:&amp;lt/td&amp;gt
&amp;lttd&amp;gt &amp;ltinput type="number" ng-model="editableage" required&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtEmail:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltinput type="email" ng-model="editableemail" required&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtGender:&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltlabel data-ng-repeat="gender in genders"&amp;gt
    &amp;ltinput name="editableGender"  type="radio"  value="{{gender.value}}"
   ng-model="$parent.editablepersonGender"/&amp;gt  {{gender.text}} &amp;nbsp;&amp;nbsp;
&amp;lt/label&amp;gt&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd&amp;gtDepartment:&amp;lt/td&amp;gt
&amp;lttd&amp;gt
 &amp;ltselect name="dept" ng-model="editabledepartment"&amp;gt
 &amp;ltoption   data-ng-repeat="dept in departments" 
       value="{{dept.value}}"&amp;gt{{dept.text}}&amp;lt/option&amp;gt
 &amp;lt/select&amp;gt
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lttr&amp;gt
&amp;lttd colspan="2"&amp;gt
&amp;ltinput type="submit" value="Update" &amp;gt
&amp;ltinput type="button" value="Cancel"  ng-click="CancelEdit()" &amp;gt
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lt/table&amp;gt
&amp;lt/form&amp;gt
&amp;lt/div&amp;gt

&amp;ltbr/&amp;gt

&amp;ltspan class="label"&amp;gtOrdered By: {{orderByField}}, 
Reverse Sort: {{reverseSort}}&amp;lt/span&amp;gt&amp;ltbr&amp;gt&amp;ltbr&amp;gt
            &amp;ltlabel&amp;gtSearch&amp;lt/label&amp;gt
            &amp;ltinput type="text" ng-model="search" class="form-control" 
         placeholder="Search"&amp;gt
 &amp;ltb&amp;gt  Size :&amp;lt/b&amp;gt &amp;ltinput type="text" ng-model="pagesize" 
class="form-control" placeholder="Size"&amp;gt
 &amp;lt/br&amp;gt
&amp;lttable class="table table-bordered"&amp;gt
&amp;ltthead&amp;gt
&amp;ltth&amp;gt
Edit
&amp;lt/th&amp;gt
&amp;ltth&amp;gt 
 &amp;lta href="#" ng-click="orderByField='id';
   reverseSort = !reverseSort"&amp;gtId
 &amp;ltspan ng-show="orderByField == 'id'"&amp;gt
 &amp;ltspan ng-show="!reverseSort"&amp;gt^&amp;lt/span&amp;gt
 &amp;ltspan ng-show="reverseSort"&amp;gtv&amp;lt/span&amp;gt&amp;lt/span&amp;gt
 &amp;lt/a&amp;gt
&amp;lt/th&amp;gt
&amp;ltth&amp;gt 
 &amp;lta href="#" ng-click="orderByField='name';
       reverseSort = !reverseSort"&amp;gtName
 &amp;ltspan ng-show="orderByField == 'name'"&amp;gt
 &amp;ltspan ng-show="!reverseSort"&amp;gt^&amp;lt/span&amp;gt
 &amp;ltspan ng-show="reverseSort"&amp;gtv&amp;lt/span&amp;gt&amp;lt/span&amp;gt
 &amp;lt/a&amp;gt
&amp;lt/th&amp;gt
&amp;ltth&amp;gtCountry&amp;lt/th&amp;gt
&amp;ltth&amp;gt
 &amp;lta href="#" ng-click="orderByField='age';
        reverseSort = !reverseSort"&amp;gt
   Age &amp;ltspan ng-show="orderByField == 'age'"&amp;gt
 &amp;ltspan ng-show="!reverseSort"&amp;gt^&amp;lt/span&amp;gt
 &amp;ltspan ng-show="reverseSort"&amp;gtv&amp;lt/span&amp;gt
 &amp;lt/span&amp;gt
          &amp;lt/a&amp;gt
&amp;lt/th&amp;gt
&amp;ltth&amp;gtEmail&amp;lt/th&amp;gt
&amp;ltth&amp;gtGender&amp;lt/th&amp;gt
&amp;ltth&amp;gtDepartment&amp;lt/th&amp;gt
&amp;ltth&amp;gtRemove&amp;lt/th&amp;gt
&amp;lt/thead&amp;gt
&amp;lttr dir-paginate="employee in employees| orderBy:orderByField:reverseSort | 
filter:{name:search || ''}:strict | itemsPerPage:pagesize"&amp;gt
&amp;lt!-- &amp;lttr ng-repeat="employee in employees| orderBy:orderByField:reverseSort | 
filter:{name:search || ''}:strict "&amp;gt --&amp;gt
 &amp;lttd&amp;gt
      &amp;ltbutton class="btn" ng-click="editEmployee(employee.id)"&amp;gt
        &amp;ltspan class="glyphicon glyphicon-pencil"&amp;gt&amp;lt/span&amp;gt&amp;nbsp;&amp;nbsp;Edit
      &amp;lt/button&amp;gt
&amp;lt/td&amp;gt
&amp;lttd&amp;gt{{employee.id}}&amp;lt/td&amp;gt
 &amp;lttd&amp;gt{{employee.name}}&amp;lt/td&amp;gt
&amp;lttd&amp;gt{{employee.country}}&amp;lt/td&amp;gt
&amp;lttd&amp;gt{{employee.age}}&amp;lt/td&amp;gt
&amp;lttd&amp;gt{{employee.email}}&amp;lt/td&amp;gt
&amp;lttd&amp;gt{{getGenderTextFromValue(employee.gender)}} &amp;lt/td&amp;gt
&amp;lttd&amp;gt{{getDepartmentTextFromValue(employee.department)}}&amp;lt/td&amp;gt
&amp;lttd&amp;gt&amp;ltinput type="button" value="Remove" class="btn btn-primary" ng-disabled="editorEnabled" ng-click="deleteEmployee(employee.id)"/&amp;gt
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lt/table&amp;gt
&amp;lt!--Pagination Control--&amp;gt
  &amp;ltdir-pagination-controls   max-size="pagesize" direction-links="true" boundary-links="true" &amp;gt
    &amp;lt/dir-pagination-controls&amp;gt
&amp;lt/div&amp;gt
&amp;lt/body&amp;gt
&amp;lt/html&amp;gt
&amp;ltscript&amp;gt
var app = angular.module('myApp', ['angularUtils.directives.dirPagination']);

app.controller('personCtrl', function($scope) {
/****Initialisation at start ********/
 $scope.orderByField = 'id';
$scope.reverseSort = false;
$scope.pagesize = 4;
$scope.personGender=3;
$scope.editorEnabled = false;


 $scope.employees = [
        {id:1,name:'Jani',country:'Norway',age:30,email:'aq@b.com', gender:1,department:2},
        {id:2,name:'Hege',country:'Sweden',age:20,email:'aw@b.com',gender:3,department:4},
        {id:3,name:'Kai',country:'Denmark',age:22,email:'ad@b.com',gender:2,department:1},
        {id:4,name:'Raj',country:'India',age:25,email:'aa@b.com',gender:1,department:3},
        {id:5,name:'Rani',country:'Nepal',age:24,email:'as@b.com',gender:2,department:1}
    ];

 $scope.genders =
        [
           {value:1, text: "Male"}, {value:2, text:"Female"}, {value:3, text:"Other"}
        ];

 $scope.departments =
        [
           {value:1, text: "HR"}, {value:2, text:"Admin"}, {value:3, text:"IT"}, {value:4, text:"Finance"}
        ];



/******find gender text from value**********/
 
$scope.getGenderTextFromValue = function(value) { 
  for (i in $scope.genders) {
            if ($scope.genders[i].value==value) {
  return $scope.genders[i].text ;
 }
         }
};



/******find department text from value**********/
 
$scope.getDepartmentTextFromValue = function(value) { 
  for (i in $scope.departments) {
            if ($scope.departments[i].value==value) {
  return $scope.departments[i].text ;
 }
         }
};



  /****** Add a Item to the list**********/
    $scope.addEmployee = function () {

/*finding max id from exiting to generate new max id for new record*/
$scope.maxId=0;
for (i in $scope.employees) {
            if ($scope.employees[i].id &amp;gt$scope.maxId) {
  $scope.maxId=$scope.employees[i].id ;
 }
}

        $scope.employees.push({
         id:  $scope.maxId+1,
                        name: $scope.name,
                        age: $scope.age,
                        country: $scope.country,
                        email: $scope.email,
                        gender:$scope.personGender,
         department:$scope.department
        });
    $scope.name='';
    $scope.age='';
   $scope.country='';
   $scope.email ='';        
}


/*********Get Item to Edit from list********** */
$scope.id='';
$scope.editEmployee = function(id) {

/*this id is used at the time of sving edited employee records*/
    $scope.id=id;

    $scope.editorEnabled = true;
    $scope.editablename = $scope.employees[id-1].name;
    $scope.editablecountry= $scope.employees[id-1].country;
    $scope.editableage= $scope.employees[id-1].age;
    $scope.editableemail= $scope.employees[id-1].email; 
   $scope.editablepersonGender= $scope.employees[id-1].gender; 
    $scope.editabledepartment= $scope.employees[id-1].department;
}


/*********Save Edited Records***********/
$scope.saveEmployee = function() { 
                $scope.employees[$scope.id-1].name=$scope.editablename;
                $scope.employees[$scope.id-1].age=$scope.editableage;
                $scope.employees[$scope.id-1].country=$scope.editablecountry;
                $scope.employees[$scope.id-1].email=$scope.editableemail;
 $scope.employees[$scope.id-1].gender=$scope.editablepersonGender;
 $scope.employees[$scope.id-1].department=$scope.editabledepartment; 
 
  $scope.editorEnabled = false;
       }


/*******Cacnel edit operation*********/
$scope.CancelEdit=function(){
  $scope.editorEnabled = false;
}


/*********Delete row from list***********/
$scope.deleteEmployee = function (id) {
        for (i in $scope.employees) {
            if ($scope.employees[i].id == id) {
               if( confirm("This Record will get deleted permanently"))
  {
                     $scope.employees.splice(i, 1);                    
 }
            }
        }
    }

});
&amp;lt/script&amp;gt


&amp;lt/div&amp;gt
&lt;/pre&gt;
&lt;/code&gt;
&lt;/div&gt;</description><link>http://technisher.blogspot.com/2015/10/crud-operation-using-angluarjs.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjv7DGFwRcfwlvgFK9vP6jg4y9omkVyoNfA0Kx9UfuEgBqrbms4JVf3y0krw6AVHyXz-HpPjZm51zpv5wgNL6gtno9UO0IZShX98SY5PSNUdPCyeHSTwpt57RUilkb7oKKlyNskCE3xTX0/s72-c/AJ+CRUD.jpg" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-105081570603150198</guid><pubDate>Mon, 08 Dec 2014 12:19:00 +0000</pubDate><atom:updated>2014-12-09T13:36:57.175+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Creating attribute in mvc4</category><category domain="http://www.blogger.com/atom/ns#">Custom Attribute in mvc4</category><title>Role based Access to MVC4 Action/Controller using Custom Attribute</title><description>&lt;pre&gt;
&lt;p&gt;
&lt;b&gt;Custom Attribute in mvc4:&lt;/b&gt;
Here I created one Custom Attribute named "CustomUserTypeAttribute"
which is used to check user type. If user type matches with restricted user
type then only this will redirect user to assigned error page.

To pass restricted user type I used one string variable named "UserLevel" and 
implemented it's "get set" property. And then I compared that with the current
user level which is stored in session variable.
&lt;/p&gt;
&lt;b&gt;Custom Attribute class : &lt;/b&gt;
&lt;code&gt;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Routing;
using System.Web.Mvc;

namespace AuthenticationModule.Web.Common
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, 
     AllowMultiple = false, Inherited = true)]
    public class CustomUserTypeAttribute : ActionFilterAttribute
    {
    public string UserLevel { get; set; }
   public override void OnActionExecuting(ActionExecutingContext filterContext)
     {             
   try
      {
     if(HttpContext.Current.Session["user_level"].ToString().Equals(UserLevel))
       {
         RouteValueDictionary redirectTargetDictionary =
                               new RouteValueDictionary();

         redirectTargetDictionary.Add("action", "ErrorPage");
         redirectTargetDictionary.Add("controller", "Home");

         filterContext.Result = 
                     new RedirectToRouteResult(redirectTargetDictionary);
        }
       }
   catch(Exception)
    {
     throw;
    }
  }
 }
}
&lt;/code&gt;
&lt;p&gt;
Using following you can apply this action filter on any action or controller.
Here I passed the on string argument named "UserLevel" with value 2 to the 
action filter.
&lt;/p&gt;
&lt;code&gt;
      [CustomUserType(UserLevel = "2")]
        public ActionResult Add()
        {
&lt;/code&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/12/role-based-access-to-mvc4.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-5769229549322053298</guid><pubDate>Thu, 04 Dec 2014 07:41:00 +0000</pubDate><atom:updated>2014-12-04T13:12:36.734+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Json size problem in ajax and mvc4</category><category domain="http://www.blogger.com/atom/ns#">JsonResult in mvc4</category><title>Json size problem in mvc4 </title><description>&lt;pre&gt;
&lt;p&gt;&lt;b&gt;Json Size limitation :&lt;/b&gt; While using json in mvc4 there is a problem 
when you transfer data using Ajax with JsonResult.

So here is a solution for this. you have to just set the "MaxJsonLength"
property to maxvalue.  &lt;/p&gt;

&lt;code&gt;
 var jsonResult = Json(result, JsonRequestBehavior.AllowGet);
            jsonResult.MaxJsonLength = int.MaxValue;
            return jsonResult;
&lt;/code&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/12/json-size-problem-in-mvc4.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3736987334597208758</guid><pubDate>Tue, 02 Dec 2014 09:37:00 +0000</pubDate><atom:updated>2014-12-02T15:07:50.554+05:30</atom:updated><title>Change date formate of Jquery datepicker in mvc4</title><description>&lt;pre&gt;
&lt;p&gt;
Following Code is used to change jquery date picker formate to accept the 
date as "dd/mm/yy" format instead of any other formate. 
&lt;/p&gt;
&lt;code&gt;

  $(function () {
            $.validator.addMethod('date',
            function (value, element) {
                if (this.optional(element)) {
                    return true;
                }
                var ok = true;
                try {
                    $.datepicker.parseDate('dd/mm/yy', value);
                }
                catch (err) {
                    ok = false;
                }
                return ok;
         });
            $(".date").datepicker({ dateFormat: 'dd/mm/yy', changeYear: true });
        });

&lt;/code&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/12/change-date-formate-of-jquery.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-2793464420831545121</guid><pubDate>Tue, 11 Nov 2014 07:33:00 +0000</pubDate><atom:updated>2014-11-17T10:22:41.757+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">ROWLOCK in SQL Server</category><category domain="http://www.blogger.com/atom/ns#">Trasnsaction Commit and Rollbcak in SQL Server</category><title>Trasnsaction Commit and Rollbcak in SQL Server</title><description>&lt;pre&gt;
&lt;b&gt;Trasnsaction Commit and Rollbcak in SQL Server :&lt;/b&gt;
&lt;p&gt;
Generally Trasnsaction Commit and Rollbcak is used in SQL Server when user
want to perform Add, Modify and Delete operation but he don't want to submit
changes into the database until last statement execute successfully. Means  the
situation where either all or nothing.

Following store procedure is used to perform Add, Modify and Delete
operation on &lt;b&gt;VisitorsPurpose&lt;/b&gt; table.

 Here OperationType 1 is  used to perform Add operation. OperationType 2
 is used to perform Modify operation and OperationType 3 is used to perform
 delete operation.

Here &lt;b&gt;begin tran&lt;/b&gt; is used to begin the transaction. User can give any transaction
name but it must start with begin keyword followed by transaction name. Here 
I given &lt;b&gt;tran&lt;/b&gt; as a transaction name.

After completion of all the operation successfully if @ErrorCode variable 
contains zero as a ErrorCode value then  &lt;b&gt;commit tran&lt;/b&gt; is used which
commits all changes into the database. To commit transaction use commit 
keyword followed transaction name which is begin last.

If @ErrorCode variable contains non zero as a ErrorCode value then &lt;b&gt;rollback tran&lt;/b&gt;
which  is used to undo all the operations performed within the trasaction. To
rollback transaction use rollback keyword followed by last begin transaction.

Also in insert statement I used &lt;b&gt;with (ROWLOCK)&lt;/b&gt; keyword it means I want to
insert only single record at a time. If more than one records come at the same 
time then second record has to wait until first records gets inserted. It is 
used to avoid deadlock conditions but this may degreed performance.
&lt;/p&gt;
&lt;code&gt;
Create procedure [dbo].[SpAmdPurpose]
(
  @OperationType as int   --1. Add Purpose 2. Modify Purpose. 3. Delete Purpose.
, @PurposeId int=0
, @PurposeName varchar(250)=null
, @CreatedBy varchar(100)=null
, @CreatedDate datetime=null
, @ModifiedBy varchar(100) = null
, @ModifiedDate datetime = null
)
as
begin
set nocount on

 declare @ErrorCode as int
 declare @Message as varchar(max)
 select @ErrorCode=0 , @Message=''

begin
 begin try
  begin tran  

--OperationType = 1 is used for adding new purpose.
 
 if(@OperationType = 1) 
         begin
  insert into VisitorsPurpose with (ROWLOCK)
  (
    PurposeName, CreatedBy, CreatedDate
  )
  values
  (
    @PurposeName, @CreatedBy, getdate()
  )
  set @ErrorCode=0
  set @Message='Purpose Created Successfully!'
 end

 --OperationType = 2 is used for modifying existing Purpose.

 else if(@OperationType=2)
 begin
  update VisitorsPurpose with (ROWLOCK)
  set
    PurposeName = @PurposeName
  , ModifiedBy = @ModifiedBy
  , ModifiedDate = getdate()
  where PurposeId=@PurposeId
   
  set @ErrorCode=0
  set @Message='Purpose Modified Successfully!' 
 end

--OperationType = 3 is used for Deleting Purpose

 else if(@OperationType=3) 
 begin
  if exists(select 1 from VisitorsPurpose where PurposeId=@PurposeId)
  begin
   set @ErrorCode=1
   set @Message='Purpose cannot be Deleted! It is already in use.'
  end
  else
  begin
   delete from VisitorsPurpose where PurposeId=@PurposeId
   set @ErrorCode=0
   set @Message='Purpose Deleted Successfully!'
  end
 end

 else
 begin
  set @ErrorCode=1
  set @Message='Invalid Operation Type!'
 end
  commit tran
 end try
 begin catch
   select @ErrorCode=110, @Message='Operation Failed due to invalid data. Please check details.'
   rollback tran
 end catch 
 end
 select @ErrorCode as [ErrorCode], @Message as [Message]
 set nocount off
end 
&lt;/code&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/11/trasnsaction-commit-and-rollbcak-in-sql.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-104670461347595451</guid><pubDate>Tue, 16 Sep 2014 07:18:00 +0000</pubDate><atom:updated>2014-11-11T13:05:16.325+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">crystal report viewer in mvc4</category><category domain="http://www.blogger.com/atom/ns#">Display crystal report on web page in mvc4</category><category domain="http://www.blogger.com/atom/ns#">Report viewer in mvc4</category><title>Crystal report in MVC4</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre&gt;&lt;b&gt;Display Crystal Report in MVC4 Razor view: &lt;/b&gt;
Here I am going to explain you the crystal report implementation
in MVC4 razor view. As there is a separate Report Viewer control in 
Asp.Net to display crystal report on the web page.

But in MVC4 there is no report viewer or any HTML helper to display
the report on the web page. Here I am displaying the report inside 
the iframe html element.  

Here I implemented the report viewer in three ways.



&lt;b&gt;web Page Design : &lt;/b&gt;
Following code is used to Design the web page on which I am going
to display the report. 



&lt;code&gt;
@using (Html.BeginForm("Index", "myController"))
{
 &amp;amp;lttable align="center"&amp;amp;gt
  &amp;amp;lttr&amp;amp;gt
     &amp;amp;lttd&amp;amp;gt
      Select Year: @Html.DropDownList("Year", new List&amp;amp;ltSelectListItem&amp;amp;gt { },
                   new { Id = "ddlYear", @class = "DropDown" })
     &amp;amp;lt/td&amp;amp;gt
 &amp;amp;lt/tr&amp;amp;gt
 &amp;amp;lttr&amp;amp;gt
    &amp;amp;lttd&amp;amp;gt
    Select Month: @Html.DropDownList("Month", new List&amp;amp;ltSelectListItem&amp;amp;gt { },
                new { Id = "ddlMonth", @class = "DropDown" })
    &amp;amp;lt/td&amp;amp;gt
 &amp;amp;lt/tr&amp;amp;gt
 &amp;amp;lttr&amp;amp;gt
  &amp;amp;lttd&amp;amp;gt
    &amp;amp;lta href="@Url.Action("GenerateReport")"&amp;amp;gtGet Pdf&amp;amp;lt/a&amp;amp;gt
     &amp;amp;ltinput type="submit" value="Show simple" /&amp;amp;gt
     &amp;amp;ltinput type="button" value="Show Report" onclick="SimpleInSameWin()" /&amp;amp;gt
   &amp;amp;lt/td&amp;amp;gt
&amp;amp;lt/tr&amp;amp;gt
 &amp;amp;lt/table&amp;amp;gt
}
&amp;amp;ltiframe name="theFrame" width="100%" height="100%"&amp;amp;gt&amp;amp;lt/iframe&amp;amp;gt

&lt;/code&gt;

&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7b0VRI8E6cS1vsC7UupGjx_FqnPXOQFOcOn3QIl7aoE0olGI1FrZKk1tgp6gOV9kEdDOEDy4PYiwC2rb_2m0NYO87YAcjosUXvWao4WsfKqcgYMhcDWpKa9TvuwaBi6tKJARDhoz3xG4/s1600/ss.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7b0VRI8E6cS1vsC7UupGjx_FqnPXOQFOcOn3QIl7aoE0olGI1FrZKk1tgp6gOV9kEdDOEDy4PYiwC2rb_2m0NYO87YAcjosUXvWao4WsfKqcgYMhcDWpKa9TvuwaBi6tKJARDhoz3xG4/s320/ss.png" /&gt;&lt;/a&gt;&lt;/div&gt;
As design shows there are 
two buttons and one link.
Link is used to generate 
the PDF Report. While first 
button i.e. Show Simple is used to 
display report on the same web page.

While Button Show Report is used to display report on the same web page inside 
the iframe element.   

Following script is used to call the controller action and then resultant report
will be get displayed inside the iframe.  



&lt;b&gt;Script which call controller action to display report inside the frame element : &lt;/b&gt;
&lt;code&gt;

 function SimpleInSameWin() {
        window.open("../SalarySlip/ShowSimple?year=" + $('#ddlYear').val() + 
"&amp;amp;month=" +   $('#ddlMonth').val(), "theFrame"); // calling action      
    }

&lt;code&gt;

Above Script shows that window.open() method opens the crystal report inside the iframe element named &lt;b&gt;theFrame&lt;/b&gt;. Also here I passed form elements value as a query string.
Above javscript method is called when user clicks on  show Report button. 



&lt;b&gt;Controller code : &lt;/b&gt;
In side Controller there are lots of method/actions. Following action is used for 
PDF report generation.  


&lt;b&gt;1. Code for PDF generation : &lt;/b&gt;
To generate pdf report must specify the exact path of your crystal report 
and must specify the DataSource value.
&lt;b&gt;Note: As a practice I just passed the "dt" as argument you may call any 
method or write your own code to specify the data source for the crystal report.&lt;/b&gt; 



&lt;code&gt;
  public ActionResult GenerateReport(DataTable dt)
        {
            SqlConnection con = new
 SqlConnection(ConfigurationManager.ConnectionStrings["HREntities1"].
ConnectionString);
                   

            ReportDocument rd = new ReportDocument();
            rd.Load(Path.Combine(Server.MapPath("~/Report"), "rpt_report.rpt"));
            rd.SetDataSource(dt);

            Response.Buffer = false;
            Response.ClearContent();
            Response.ClearHeaders();

            Stream stream = 
rd.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
            stream.Seek(0, SeekOrigin.Begin);
            return File(stream, "application/pdf", "rpt_report.pdf");

            
        }
&lt;/code&gt;
When user clicks on given link then above code gets executed and the PDF will 
be get generated. 



&lt;b&gt;2. Display Report on the Same page inside the iframe element :
&lt;/b&gt;
Following controller action is used to generate the report and display it 
on the same web page. This action is called from javascript method
SimpleInSameWin(). This action receive arguments which are passed as
querystring from script. 



&lt;b&gt;Controller action To generate report: &lt;/b&gt;

&lt;code&gt;
 public void ShowSimple(string year, string month)
        {  
            using (ReportClass rp = new ReportClass())
            {             
                string emp_code = "120";
                rp.FileName = Server.MapPath("~/Report") + "//rpt_Report.rpt";
                rp.Load();
                /*Get data from detatbase using Data layer via business layer*/
                rp.SetDataSource(bizSalarySlip.GetData(month, year, emp_code));
                rp.ExportToHttpResponse(ExportFormatType.PortableDocFormat,
 System.Web.HttpContext.Current.Response, false, "crReport");
            }
        }
      
&lt;/code&gt;

In above code I passed the argument to the action method and generated the
report.
As a datasource I called one method by passing arguments. That method returns the
DataTable result which is passed as a DataSource. 




&lt;b&gt;3. Display Report on whole web page : &lt;/b&gt;
There may be situation where user want's to display crystal report on the
whole page instead of iframe html element. In this situation user must click
on button "Show simple" that will call the controller action method name Index 
and will display report on the same page.
 


&lt;b&gt;Controller Index action method code : &lt;/b&gt;
&lt;code&gt;
         [HttpPost]
        public ActionResult Index(FormCollection formCollection)
        {
            string month = formCollection["Month"];
            string year = formCollection["Year"]; ;
            string emp_code = "120";
            using (ReportClass rp = new ReportClass())
            {
                rp.FileName = Server.MapPath("~/Report") + "//rpt_Report.rpt";

                rp.Load();
                rp.SetDataSource(bizSalarySlip.GetData(month, year, emp_code));
          rp.ExportToHttpResponse(ExportFormatType.PortableDocFormat,
         System.Web.HttpContext.Current.Response, false, "crReport");
            }
            return View();
        }
&lt;/code&gt;

When user submit the form above action method will be gets called all the 
form data received as FormCollection object.



&lt;/code&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</description><link>http://technisher.blogspot.com/2014/09/crystal-report-in-mvc4.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7b0VRI8E6cS1vsC7UupGjx_FqnPXOQFOcOn3QIl7aoE0olGI1FrZKk1tgp6gOV9kEdDOEDy4PYiwC2rb_2m0NYO87YAcjosUXvWao4WsfKqcgYMhcDWpKa9TvuwaBi6tKJARDhoz3xG4/s72-c/ss.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3374235195259796028</guid><pubDate>Tue, 19 Aug 2014 09:52:00 +0000</pubDate><atom:updated>2014-09-22T13:42:44.343+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Left Outer Join in Linq</category><category domain="http://www.blogger.com/atom/ns#">subquery in Linq to entites</category><title>Left Outer Join in Linq </title><description>&lt;pre&gt;
&lt;h3&gt;Left Outer Join in Linq to Entites:&lt;/h3&gt;
&lt;p&gt;
So guys here I am going to explain you the Left Outer Join in Linq to entities.
Here I performed left outer join on the results of two separate 
join queries.  

If left table does not contains value then &lt;b&gt;DefaultIfEmpty()  &lt;/b&gt;
is used to select default value for that record. 
&lt;/p&gt;
&lt;b&gt;Linq Query : &lt;/b&gt;
&lt;code&gt;
var result=(from s in db.schedules
            join sp in db.programs
            on s.scheduleId equals sp.scheduleId 
                         
join sub in
   (
      from pc in db.PersonCategories
      join fc in db.FilmCrews
         on pc.PersonCategoryCode equals fc.PersonCategoryCode     
      
      where (pc.PersonCategoryId == "PC0000001")
      select new { fc.Name, fc.programmeId }
    )

on sp.programmeId equals sub.programmeId into eGroup
from sub in eGroup.DefaultIfEmpty()

   where (s.date &gt;= "1 aug 2014")  
   orderby s.date, sp.starttime

select new { s.date, sp.starttime, s.programme_name, sub.Name });

&lt;/code&gt;

&lt;b&gt;Code Explanation : &lt;/b&gt;
&lt;p&gt;
In above code I performed join operation on &lt;b&gt;schedule&lt;/b&gt; and &lt;b&gt;programs&lt;/b&gt;
table on the basis of scheduleId which is primary key in schedule table and
forign key in programs table.

Similarly I performed the join on &lt;b&gt;PersonCategories&lt;/b&gt; and&lt;b&gt; FilmCrews&lt;/b&gt;
tables, on the basis of PersonCategoryCode which is primary key in first table 
and foreign key in second table.

Now on the result of these two queries I performed left outer join as there 
is only join keyword which is used to perform all types of join operations.

In above code I performed left outer join on the field programmeId which is
present in the both the query results. 

To perform left outer join I used one Linq method named &lt;b&gt;DefaultIfEmpty()&lt;/b&gt;.
As you know in left outer join all values from left table are selected and 
only available values from second table are selected, so here DefaultIfEmpty()
method is used for the same reason this method put Default value i.e. null in
the place where there is no value for the current record.
&lt;/p&gt;

&lt;b&gt;Subquery in Linq : &lt;/b&gt;
&lt;p&gt;
In above code I also performed the subquery operation, i.e. here I performed 
left outer join on the subquery result. Here I created one alias named sub
which holds the result of subquery. 

Then I performed Left outer join on the result of first join operation
and on the result of subquery. 
&lt;/p&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/08/left-outer-join-in-linq.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-2050298019327091807</guid><pubDate>Tue, 19 Aug 2014 09:41:00 +0000</pubDate><atom:updated>2014-09-22T13:41:13.573+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Inner Join in Linq</category><category domain="http://www.blogger.com/atom/ns#">Join in Linq</category><category domain="http://www.blogger.com/atom/ns#">Join on Linq to Entities</category><category domain="http://www.blogger.com/atom/ns#">where and order by in Linq</category><title>Inner join in linq</title><description>&lt;pre&gt;
&lt;h3&gt;Inner Join in linq:&lt;/h3&gt;
Following code shows the inner join using Linq to Entities.
&lt;b&gt;Linq query : &lt;/b&gt;
&lt;code&gt;

var result=(from s in db.schedules
join sp in db.programs
   on s.scheduleId equals sp.scheduleId 
join pm in db.programme_data
   on sp.ProgramId equals pm.ProgramId 

where (s.date &gt;= '1 aug 2014')
orderby s.date, sp.starttime

 select new { s.date, sp.starttime,pm.pgm_name});

&lt;/code&gt;
&lt;b&gt;Code Explanation : &lt;/b&gt;
In above code I performed the inner join operation on three entities named 
&lt;b&gt;schedules, programs and programme_data&lt;/b&gt;. Here I performed first join
operation in between schedules and programs entities on the field scheduleId 
i.e. primary key in the table schedules and foreign key in second table i.e.
programs.

Then on I performed join opertion with third table i.e. programme_data on the field 
on the field ProgramId i.e. primary key in the table schedules and foreign key in
 second table.
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/08/inner-join-in-linq.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-6690925392976686918</guid><pubDate>Mon, 21 Jul 2014 07:43:00 +0000</pubDate><atom:updated>2014-10-01T13:04:38.062+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Pass Javascript object through Ajax in MVC</category><category domain="http://www.blogger.com/atom/ns#">Pass Javascript object to MVC controller using Ajax</category><title>Pass Javascript object to MVC controller using Ajax</title><description>&lt;pre&gt;
To pass javascript object follow following steps.

&lt;b&gt;Step 1. Creating Javascript Object:&lt;/b&gt;
&lt;code&gt;
  var Person = {   
    Id:$("#Id").val(),
    Name:$('#Name').val()
};
&lt;/code&gt;
&lt;p&gt;Here I created one javascript object named Person with two properties named
Id and Name. Here I assigned values from form controls to that properties.
&lt;/p&gt;

&lt;b&gt;Step 2. Ajax Call to pass data to MVC Controller&lt;/b&gt;
&lt;code&gt;
 $.ajax({
   url: '@Url.Action("getDetail", "Employee")',
   data: JSON.stringify({ PersonDetail:Person }),
   dataType: 'json',
   type: 'POST',
   contentType: "application/json",
   async: true,
   traditional: true,
   success: function (result) {
              alert("result");
              }
    });       
&lt;/code&gt;

&lt;p&gt;In above code I made ajax call to the controller action named &lt;b&gt;getDetail&lt;/b&gt;
then I passed the javascript obejct to controller via &lt;b&gt;data&lt;/b&gt; property of the 
ajax.
&lt;/p&gt;

&lt;b&gt;Step 3.Create Model class with all the person properties&lt;/b&gt;
&lt;code&gt;
public class Person 
    {
        public string Id{ get; set; }
        public string Name { get; set; }
    }
&lt;/code&gt;
&lt;p&gt;In above code I created one Model class with all the Person properties that 
will get initialised in javascript code.
&lt;/p&gt;
&lt;b&gt;Step 4. Write controller action which receives the data which 
sent through ajax.&lt;/b&gt;
&lt;code&gt;
        [HttpPost]
        public JsonResult getDetail(Person PersonDetail)
        {
&lt;/code&gt;

&lt;p&gt;Then in controller action the person data is received in person object. Here you 
will get all the values for the person from PersonDetail object.
&lt;/p&gt;

&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/07/pass-javascript-object-to-mvc.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-8365552881730024613</guid><pubDate>Mon, 14 Jul 2014 09:17:00 +0000</pubDate><atom:updated>2014-10-01T13:05:29.587+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">@HTML.ActionLink</category><category domain="http://www.blogger.com/atom/ns#">Confirmation On Action link</category><title>Confirmation on Action link click in mvc4</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;pre&gt;&lt;b&gt;Confirmation:&lt;/b&gt;

&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1rMSBLurZSxPJId4dvX1M0xXdN5JjleGXIHoTTzP6-ajVagY8IfQ2BA7ZaMLbfgg8a0daLF5vUAErE3gacs2127xRLlCxqU9-rnM0T-p5M1bXhxNbzIifAFx_ahUHiZDIbCZmgJB9m4/s1600/logout.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img alt="Jquery alert" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1rMSBLurZSxPJId4dvX1M0xXdN5JjleGXIHoTTzP6-ajVagY8IfQ2BA7ZaMLbfgg8a0daLF5vUAErE3gacs2127xRLlCxqU9-rnM0T-p5M1bXhxNbzIifAFx_ahUHiZDIbCZmgJB9m4/s1600/logout.png" height="140" title="Client side confirmation" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
Get confirmation on action link click in mvc4. 
&lt;br /&gt;
&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;
@Html.ActionLink("LOG-OUT", "Logout", "Home", new { id = "logout" },
 new { onclick = "return confirm('Are you sure you want Logout?')" })

In above code &lt;b&gt; @Html.ActionLink() &lt;/b&gt; html helper is used to create an  
action link in mvc4 razore view. There are many overloads for action link so
that the user can use it according to his requirement.

Here I want a client side confirmation i.e. when user clicks on logout ActionLink
then Javascript alert will be gets open as shown inn above image.

Here I called confirm() javascript function inside the html property of 
 &lt;b&gt; @Html.ActionLink() &lt;/b&gt; html helper.
  
&lt;br /&gt;

&lt;/pre&gt;
&lt;/div&gt;</description><link>http://technisher.blogspot.com/2014/07/delete-confirmation-on-action-link-click.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZ1rMSBLurZSxPJId4dvX1M0xXdN5JjleGXIHoTTzP6-ajVagY8IfQ2BA7ZaMLbfgg8a0daLF5vUAErE3gacs2127xRLlCxqU9-rnM0T-p5M1bXhxNbzIifAFx_ahUHiZDIbCZmgJB9m4/s72-c/logout.png" width="72"/><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-7400360053819620299</guid><pubDate>Fri, 11 Jul 2014 09:27:00 +0000</pubDate><atom:updated>2014-10-01T13:37:06.530+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Browser Comaptible Menu bar</category><category domain="http://www.blogger.com/atom/ns#">Menubar with submenus</category><category domain="http://www.blogger.com/atom/ns#">Multilevel menu bar</category><category domain="http://www.blogger.com/atom/ns#">Vertical Menumbar using CSS and HTML</category><title>Vertical menubar with submenus using HTML, CSS</title><description>&lt;pre&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCL6w2xFBtz2diFjsOe09xIL6GH5EUpufNJMy1nc8m_nAjngzp2TA4BFGTOZrM5BHGRPwByfObdshk18Ta4W23FdtjyR1OaMew9rPDojmIg8YlN-T829RkH0cVHFGipegSzJgfq2efTe4/s1600/menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCL6w2xFBtz2diFjsOe09xIL6GH5EUpufNJMy1nc8m_nAjngzp2TA4BFGTOZrM5BHGRPwByfObdshk18Ta4W23FdtjyR1OaMew9rPDojmIg8YlN-T829RkH0cVHFGipegSzJgfq2efTe4/s400/menu.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;
&lt;b&gt;Vertical MenuBar: Following code is used to Create vertical
menu bar. It is created using plain HTML and CSS. &lt;/b&gt;

Here I used plain HTML/HTML5 and CSS to create the browser compatible vertical
menu bar. also I created the menu , submenu and two level submenus also. Also 
used some css to highlight the selected menu. 
&lt;/p&gt;
 &amp;lthtml&amp;gt
&amp;lthead&amp;gt
&amp;lt/head&amp;gt

&amp;lt!-- STYLE--&amp;gt
&amp;ltstyle&amp;gt

nav {    
  display: block;
  text-align: center;
}
nav ul {
  margin: 0;
  padding:0;
  list-style: none;
}
.nav a {
  display:block; 
  background: #111; 
  color: #fff; 
  text-decoration: none;
  padding: 0.8em 1.8em;
  text-transform: uppercase;
  font-size: 80%;
  letter-spacing: 2px;
  text-shadow: 0 -1px 0 #000;
  position: relative;
}
.nav{  
  vertical-align: top; 
  display: inline-block;
  box-shadow: 
    1px -1px -1px 1px #000, 
    -1px 1px -1px 1px #fff, 
    0 0 6px 3px #fff;
  border-radius:6px;
}
.nav li {
  position: relative;
}
.nav &amp;gt li { 
  float: left; 
  border-bottom: 4px #aaa solid; 
  margin-right: 1px; 
} 
.nav &amp;gt li &amp;gt a { 
  margin-bottom: 1px;
  box-shadow: inset 0 2em .33em -0.5em #000064; 
}
.nav &amp;gt li:hover, 
.nav &amp;gt li:hover &amp;gt a { 
  border-bottom-color: 33CCFF;
}
.nav li:hover &amp;gt a { 
  color:33CCFF; 
}
.nav &amp;gt li:first-child { 
  border-radius: 4px 0 0 4px;
} 
.nav &amp;gt li:first-child &amp;gt a { 
  border-radius: 4px 0 0 0;
}
.nav &amp;gt li:last-child { 
  border-radius: 0 0 4px 0; 
  margin-right: 0;
} 
.nav &amp;gt li:last-child &amp;gt a { 
  border-radius: 0 4px 0 0;
}
.nav li li a { 
  margin-top: 1px;
}

.nav li a:first-child:nth-last-child(2):before { 
  content: ""; 
  position: absolute; 
  height: 0; 
  width: 0; 
  border: 5px solid transparent; 
  top: 50% ;
  right:5px;  
 }

/* submenu positioning*/
.nav ul {
  position: absolute;
  white-space: nowrap;
  border-bottom: 5px solid  33CCFF;
  z-index: 1;
  left: -99999em;
}
.nav &amp;gt li:hover &amp;gt ul {
  left: auto;
  margin-top: 5px;
  min-width: 100%;
}
.nav &amp;gt li li:hover &amp;gt ul { 
  left: 100%;
  margin-left: 1px;
  top: -1px;
}
/* arrow hover styling */
.nav &amp;gt li &amp;gt a:first-child:nth-last-child(2):before { 
  border-top-color: #aaa; 
}
.nav &amp;gt li:hover &amp;gt a:first-child:nth-last-child(2):before {
  border: 5px solid transparent; 
  border-bottom-color: 33CCFF; 
  margin-top:-5px
}
.nav li li &amp;gt a:first-child:nth-last-child(2):before {  
  border-left-color: #aaa; 
  margin-top: -5px
}
.nav li li:hover &amp;gt a:first-child:nth-last-child(2):before {
  border: 5px solid transparent; 
  border-right-color: 33CCFF;
  right: 10px; 
}

&amp;lt/style&amp;gt

&amp;ltbody&amp;gt
&amp;ltnav&amp;gt
  &amp;ltul class="nav"&amp;gt
     &amp;ltli&amp;gt&amp;lta href="#"&amp;gtAbout&amp;lt/a&amp;gt&amp;lt/li&amp;gt
      &amp;ltli&amp;gt&amp;lta href="#"&amp;gtReports&amp;lt/a&amp;gt
        &amp;ltul&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtDaily&amp;lt/a&amp;gt&amp;lt/li&amp;gt
           &amp;ltli&amp;gt&amp;lta href="#"&amp;gtWeekly&amp;lt/a&amp;gt&amp;lt/li&amp;gt
           &amp;ltli&amp;gt&amp;lta href="#"&amp;gtMonthly&amp;lt/a&amp;gt&amp;lt/li&amp;gt
        &amp;lt/ul&amp;gt
     &amp;lt/li&amp;gt
     &amp;ltli&amp;gt&amp;lta href="#"&amp;gtResources&amp;lt/a&amp;gt
        &amp;ltul&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtTelephone&amp;lt/a&amp;gt&amp;lt/li&amp;gt
           &amp;ltli&amp;gt&amp;lta href="#"&amp;gtComputer&amp;lt/a&amp;gt
             &amp;ltul&amp;gt
                &amp;ltli&amp;gt&amp;lta href="#"&amp;gtKeyboard&amp;lt/a&amp;gt&amp;lt/li&amp;gt
               &amp;ltli&amp;gt&amp;lta href="#"&amp;gtMouse&amp;lt/a&amp;gt&amp;lt/li&amp;gt
                 &amp;ltli&amp;gt&amp;lta href="#"&amp;gtMonitor&amp;lt/a&amp;gt&amp;lt/li&amp;gt
               &amp;ltli&amp;gt&amp;lta href="#"&amp;gtCPU&amp;lt/a&amp;gt&amp;lt/li&amp;gt
             &amp;lt/ul&amp;gt
           &amp;lt/li&amp;gt
           &amp;ltli&amp;gt&amp;lta href="#"&amp;gtMobiles&amp;lt/a&amp;gt&amp;lt/li&amp;gt
           &amp;ltli&amp;gt&amp;lta href="#"&amp;gtResources 3&amp;lt/a&amp;gt&amp;lt/li&amp;gt
        &amp;lt/ul&amp;gt
     &amp;lt/li&amp;gt
     &amp;ltli&amp;gt&amp;lta href="#"&amp;gtDownload&amp;lt/a&amp;gt&amp;lt/li&amp;gt
     &amp;ltli&amp;gt&amp;lta href="#"&amp;gtRants&amp;lt/a&amp;gt
        &amp;ltul&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtitem&amp;lt/a&amp;gt&amp;lt/li&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtitem&amp;lt/a&amp;gt&amp;lt/li&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtitem&amp;lt/a&amp;gt&amp;lt/li&amp;gt
          &amp;ltli&amp;gt&amp;lta href="#"&amp;gtitem&amp;lt/a&amp;gt&amp;lt/li&amp;gt
        &amp;lt/ul&amp;gt
     &amp;lt/li&amp;gt
     &amp;ltli&amp;gt&amp;lta href="#"&amp;gtContact&amp;lt/a&amp;gt&amp;lt/li&amp;gt
  &amp;lt/ul&amp;gt
&amp;lt/nav&amp;gt&amp;lt/body&amp;gt
&amp;lt/html&amp;gt
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/07/vertical-menubar-with-submenus.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCL6w2xFBtz2diFjsOe09xIL6GH5EUpufNJMy1nc8m_nAjngzp2TA4BFGTOZrM5BHGRPwByfObdshk18Ta4W23FdtjyR1OaMew9rPDojmIg8YlN-T829RkH0cVHFGipegSzJgfq2efTe4/s72-c/menu.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3921474529926750165</guid><pubDate>Wed, 25 Jun 2014 11:32:00 +0000</pubDate><atom:updated>2014-10-01T13:53:36.546+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Connection string Encryption</category><category domain="http://www.blogger.com/atom/ns#">Web.Config file connection string encryption and decryption</category><title>Connection string encryption and decryption in C#</title><description>&lt;pre&gt;
&lt;b&gt;Encryption:&lt;/b&gt;
Following code is used to encrypt connection string present in 
the web.config file.
Write below code on page load event or create the function 
when that function gets called the connection string which is
present in the Web.config will be get encrypted. After encryption
normal connection string i.e. plain text connection string will
be replaced by the encrypted coneection string which is not human
readable.


&lt;code&gt;
   public void EncryptConnectionString()
        {
Configuration config = WebConfigurationManager.
        OpenWebConfiguration(Request.ApplicationPath);
   ConfigurationSection configSection =
      config.GetSection("connectionStrings");
            
       if (!configSection.SectionInformation.IsProtected)
  {
        configSection.SectionInformation.
        ProtectSection("DataProtectionConfigurationProvider");
        config.Save();
         Response.Write("ConnectionStrings encryted successfully.");
   }
       else
  {
        Response.Write("ConnectionStrings has been encryted, 
    this action has been cancled");
  }
}
&lt;/code&gt;

&lt;p&gt;
In the above code when the EncryptConnectionString() function gets called 
in first line I specified the part of web.config file which I want to encrypt 
i.e.&lt;b&gt;"connectionStrings"&lt;/b&gt; then in if(!configSection.SectionInformation.IsProtected)
I checked whether connection string already encrypted or not if not then I replaced
normal connection string with the encrypted connection string. (Plain text to 
cipher text)

config.Save(); is used to save the web.config file.

In if condition fails to execute then this means connection string already encrypted. 
&lt;/p&gt;

&lt;b&gt;Decryption:&lt;/b&gt;
Following code is used to decrypt connection string present in the 
web.config file.
Write below code on page load event or or create the
function when that function gets called the connection string which is
present the Web.config will be get updated with the decrypted connection
strings i.e. from cipher text to plain text which is user readable. 

&lt;code&gt;
public void DecryptConnectionString()
        {
        Configuration config = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);
        ConfigurationSection section = 
          config.GetSection("connectionStrings");
        if (section.SectionInformation.IsProtected)
        {
            section.SectionInformation.UnprotectSection();
            config.Save();
        }
}
&lt;/code&gt;

&lt;p&gt;
In the above code when the DecryptConnectionString() function gets called 
in first line I specified the part of web.config file which I want to decrypt
i.e.&lt;b&gt;"connectionStrings"&lt;/b&gt; then in if(section.SectionInformation.IsProtected)
I checked whether connection string already encrypted or not if it is encrypted 
then I replaced encrypted connection string with the plain text connection string. 
(Cipher text to Plain text).
config.Save(); is used to save the web.config file.
&lt;/p&gt;

Following are the two ways of Encryption currently I used second approch. 
To use first approch just change the function call from &lt;b&gt;ProtectSection("DataProtectionConfigurationProvider")&lt;/b&gt;
to &lt;b&gt;ProtectSection("RSAProtectedConfigurationProvider").&lt;/b&gt;

1) RSAProtectedConfigurationProvider: This is the default provider and uses the RSA Public Key Encryption algorithm to encrypt and decrypt data.

2) DataProtectionConfigurationProvider: This provider uses Windows Data Protection Application Programming Interface (DPAPI) to encrypt and decrypt data.


&lt;b&gt;Another Approch For Encryption:&lt;/b&gt;
For encryption you can use following command.
Open Visual studio command prompt as a administrator and fire the command.
 
aspnet_regiis.exe -pe "connectionStrings" -app "/ProjectName"

&lt;b&gt;Note: Please run visual studio as administrator.&lt;/b&gt;
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/06/connection-string-encryption-and.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-4120897103281069687</guid><pubDate>Fri, 30 May 2014 06:55:00 +0000</pubDate><atom:updated>2014-10-08T15:53:15.204+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Writing datatable into text file and then download the text file</category><title>Writing datatable into text file</title><description>&lt;p&gt;
Following function is used to write DataTable into the text file
and then download that file.
Pass the datatable as an argument to this function.
&lt;/p&gt;
&lt;pre&gt;
  public void WriteDataToFile(DataTable submittedDataTable)        
        {
            int i = 0;
           
            MemoryStream ms = new MemoryStream();
            TextWriter tw = new StreamWriter(ms);
          
            foreach (DataRow row in submittedDataTable.Rows)
            {
                object[] array = row.ItemArray;
                for (i = 0; i &lt; array.Length - 1; i++)
                {
                    tw.Write(array[i].ToString() + ";");
                }
                tw.Write(array[i].ToString());
                tw.WriteLine();
            }
            tw.Flush();
            byte[] bytes = ms.ToArray();
            ms.Close(); 
            Response.Clear();
            Response.ContentType = "application/force-download";

            Response.AddHeader("content-disposition", 
                             "attachment;filename=MPBP.txt");

            Response.BinaryWrite(bytes);
            Response.End();     
        }
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/05/writing-datatable-into-text-file.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-5543237494712706344</guid><pubDate>Wed, 21 May 2014 07:55:00 +0000</pubDate><atom:updated>2014-10-08T15:57:43.666+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Browser Comaptible Jquery/Javascript</category><category domain="http://www.blogger.com/atom/ns#">Json not working in IE</category><category domain="http://www.blogger.com/atom/ns#">JSON Undefied in IE</category><title>Json undefined error while using IE</title><description>&lt;pre&gt;
&lt;p&gt;
Just copy and paste the following code into the head tag section
of your web page. For reusability you can add this code on your 
Master page.

This code is used to avoid Json related and all the Ajax related problems
that comes while using different types of browsers. 
&lt;/p&gt;
&amp;ltmeta charset="UTF-8" /&amp;gt 
   &amp;ltmeta http-equiv="X-UA-Compatible" content="IE=edge;chrome=1" /&amp;gt
&amp;lt!--[if lt IE 9]&amp;gt
  &amp;ltscript src="http://code.jquery.com/jquery-1.10.2.js"&amp;gt&amp;lt/script&amp;gt
&amp;lt![endif]--&amp;gt
&amp;lt!--[if gte IE 9]&amp;gt&amp;lt!--&amp;gt
  &amp;ltscript src="http://code.jquery.com/jquery-2.0.3.js"&amp;gt&amp;lt/script&amp;gt
&amp;lt!--&amp;lt![endif]--&amp;gt

&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/05/json-undefined-error-while-using-ie.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3898969855753641147</guid><pubDate>Mon, 19 May 2014 11:37:00 +0000</pubDate><atom:updated>2014-10-08T16:03:30.433+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Write HTML Table into Excel file using Jquery</category><category domain="http://www.blogger.com/atom/ns#">Writing Excel file using Jquery</category><title>Export HTML Table to Excel file using Jquery</title><description>&lt;pre&gt;
To write HTML table as it is inside the Excel file user must 
first create the html table inside the div element then you
can write that table as it is in Excel file.

Here I created HTML table inside the div whose id is divTable.
Then I exported that div to the Excel using window.open().
In window.open() function I specified data type as 
&lt;b&gt;application/vnd.ms-excel.&lt;/b&gt;

Following code is used to write HTML table into the Excel file.
Here on button click HTML table which is present in the div 
whose id is "divTable" will be get printed into the Excel file.


$("#btnExcelExport").click(function(e) {
window.open('data:application/vnd.ms-excel,' + $('#divTable').html());
e.preventDefault();
});​
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/05/export-to-excel-using-jquery.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3811533832135951931</guid><pubDate>Mon, 05 May 2014 10:16:00 +0000</pubDate><atom:updated>2014-10-08T16:16:32.589+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">download image</category><category domain="http://www.blogger.com/atom/ns#">Image Wirting in Excel file from server</category><category domain="http://www.blogger.com/atom/ns#">using VirtualPathUtility.ToAbsolute()</category><category domain="http://www.blogger.com/atom/ns#">VirtualPathUtility.ToAbsolute()</category><title> write image into Excel cell </title><description>&lt;pre&gt;
Following code is used to write image into Excel cell without any external
dll's.

To get absolute path of an image &lt;b&gt;VirtualPathUtility.ToAbsolute()&lt;/b&gt;
function is used. This function works on local machine as well as
on IIS.

Before that I checked whether code running is on local machine or it is
deployed on IIS by using the function &lt;b&gt;ResolveServerUrl()&lt;/b&gt;. This
function takes two arguments first one is image path using the function
&lt;b&gt;VirtualPathUtility.ToAbsolute()&lt;/b&gt;.

So &lt;b&gt;ResolveServerUrl()&lt;/b&gt; is used check whether program is running on 
local(localhost) machine or whether it is running on Server(http) .


&lt;b&gt;Code:&lt;/b&gt;
   HttpContext.Response.Write("&lt;TR style='font-size:12.0pt; 
   text-align:center; font-style:italic; text-decoration:underline;
   font-weight:bold; font-family:Book Antiqua;'&gt;");
  
string filePath=ResolveServerUrl(
       VirtualPathUtility.ToAbsolute("~/Content/Images/img1.jpg"),
       false);

 string imagepath = string.Format("&amp;ltimg src='{0}'/&amp;gt", filePath);
                       
 HttpContext.Response.Write("&lt;Td&gt;");
 HttpContext.Response.Write(imagepath);
 HttpContext.Response.Write("&lt;/Td&gt;");
 HttpContext.Response.Write("&lt;/TR&gt;");

&lt;b&gt;Function for checking:&lt;/b&gt;
public static string ResolveServerUrl(string serverUrl, bool forceHttps)
        {
            if (serverUrl.IndexOf("://") &gt; -1)
                return serverUrl;

string newUrl = serverUrl;
Uri originalUri = System.Web.HttpContext.Current.Request.Url;
newUrl = (forceHttps ? "https" : originalUri.Scheme) +
                "://" + originalUri.Authority + newUrl;
 return newUrl;
        } 
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/05/download-and-write-image-into-excel-cell.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-4806228377972796561</guid><pubDate>Mon, 28 Apr 2014 05:48:00 +0000</pubDate><atom:updated>2014-08-22T13:34:35.481+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Image Wirting in Excel file</category><title>Add image into excel sheet without any dll</title><description>Writing image in excel default location is top left corner.
To work the same code after deployment on IIS server don't forget to change
the Image Url.  
&lt;br/&gt;
&lt;b&gt;Code:&lt;/b&gt;
&lt;pre&gt;
    HttpContext.Response.Clear();
    HttpContext.Response.ClearContent();
    HttpContext.Response.ClearHeaders();
    HttpContext.Response.Buffer = true;
    HttpContext.Response.ContentType = "application/ms-excel";
   
    HttpContext.Response.Write(@"&amp;lt!DOCTYPE HTML PUBLIC "
             "-//W3C//DTD HTML 4.0 Transitional//EN""&amp;gt");

  //Set the name of report as per query fired by the user.
 HttpContext.Response.AddHeader("Content-Disposition",
                  "attachment;filename=" + fileName);

HttpContext.Response.Charset = "utf-8";
HttpContext.Response.ContentEncoding = 
System.Text.Encoding.GetEncoding("windows-1250");

 HttpContext.Response.Write("&amp;ltTR style='font-size:12.0pt;
 text-align:center; font-style:italic; text-decoration:underline;
 font-weight:bold;font-family:Book Antiqua;'&amp;gt");

 string s = Server.MapPath("~\\Content\\Images\\abcd.jpg");
                     
   string filePath =
   System.Configuration.ConfigurationManager.AppSettings["LogoPath"];
   string imagepath = string.Format("&amp;ltimg src='{0}'/&amp;gt", s);
                                        
 HttpContext.Response.Write("&amp;ltTd&amp;gt");
 HttpContext.Response.Write(imagepath);
 HttpContext.Response.Write("&amp;lt/Td&amp;gt");
 HttpContext.Response.Write("&amp;lt/TR&amp;gt");
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/04/add-image-into-excel-sheet-without-any.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-5745541155328057364</guid><pubDate>Wed, 16 Apr 2014 07:14:00 +0000</pubDate><atom:updated>2014-04-16T12:44:31.310+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Adding item from Dropdown list using Jquery</category><category domain="http://www.blogger.com/atom/ns#">Removing item from Dropdown list using Jquery</category><title>Adding and Removing item from Dropdown list using Jquery</title><description>&lt;pre&gt;
&lt;b&gt;Remove all item from dropdownlist&lt;/b&gt;
     $("#selectClient").empty();

&lt;b&gt;Add item to dropdown list&lt;/b&gt;
var newOption = "&lt;option value=" + graphicsEdit[i].ClientId + "&gt;" + graphicsEdit[i].ClientName + "&lt;/option&gt;";

$("#selectClient").append(newOption);
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/04/adding-and-removing-item-from-dropdown.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-9159633521189686327</guid><pubDate>Mon, 14 Apr 2014 07:41:00 +0000</pubDate><atom:updated>2014-04-14T13:11:30.693+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">disabling dropdown list</category><category domain="http://www.blogger.com/atom/ns#">Enabling dropdown list</category><title>Enabling and disabling dropdown list</title><description>
&lt;h3&gt;Disabling drodown list&lt;/h3&gt;
$("#selectAgency").prop("disabled", true).css('background', '#F0F0F0');

&lt;h3&gt;Enabling drodown list&lt;/h3&gt;
$("#selectAgency").prop("disabled", false).css('background', '#F0F0F0');</description><link>http://technisher.blogspot.com/2014/04/enabling-and-disabling-dropdown-list.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-884040035458653819</guid><pubDate>Mon, 14 Apr 2014 07:25:00 +0000</pubDate><atom:updated>2014-04-14T12:55:38.389+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Selecting dropdown item using Javascript</category><category domain="http://www.blogger.com/atom/ns#">Selecting dropdown item using Jquery</category><title>Set particular item selected in dropdown list using Jquery </title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;h3&gt;Using Value Attribute setting dropdown item selected&lt;/h3&gt;
&lt;pre&gt;
 $('#selectGraphicsMode').val(graphicsEdit[i].ModeId);
&lt;/pre&gt;

&lt;h3&gt;Using text property setting dropdown item selected&lt;/h3&gt;
&lt;pre&gt;
   $("#selectAgency option:contains(" + graphicsEdit[i].AgencyId + ")")
     .attr('selected', 'selected');
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/04/set-particular-item-selected-in.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-442027531706655447</guid><pubDate>Mon, 14 Apr 2014 07:18:00 +0000</pubDate><atom:updated>2014-10-08T17:53:22.335+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Regex in JavaScript</category><category domain="http://www.blogger.com/atom/ns#">Validation using JavaScript</category><title>Client side Validation using Regular Expression</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;pre&gt;
&lt;b&gt;Client side Validation using Regular Expression : &lt;/b&gt;

There are situations where user may performs many types of validation
on single field for example while entering email user must check empty 
field as well as email syntax all such validations can be performed in
single line by creating regular expression. 

In javascript there is method called &lt;b&gt;match()&lt;/b&gt; which compare regEx
with the input field value.

  var reg = /^[V|v][0-9]{3}$/;
            var x = $("#Version").val();
   if (!x.match(reg)) {
        alert("Version must start with character v followed by 3 digit number");
            }
         
In above code I compared regular expression which is stored in variable reg
with the value entered in the textbox whose id is Version. Then in if 
condition I compared the regEx and value.     
&lt;/pre&gt;</description><link>http://technisher.blogspot.com/2014/04/regex-validation-using-javascript.html</link><author>noreply@blogger.com (Anonymous)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-6894255391391326101</guid><pubDate>Mon, 14 Apr 2014 06:58:00 +0000</pubDate><atom:updated>2014-04-14T12:46:16.600+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">MVC setting existing item selected in listbox</category><category domain="http://www.blogger.com/atom/ns#">Using Ajax set already selected item into list</category><title>Making existing item selected in listbox using Ajax in mvc4</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;p&gt;
Here I am displaying already selected items into listbox
which are present into the database. And also I am removing 
them from orginal item listbox.
&lt;/p&gt;

&lt;h3&gt;Design&lt;/h3&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBMFn8juZ3aIl-m8Q63nk5qi2r60zfWM1-ltAHlmuo3LTyldb5u5lVZDaasijHMKKOdlUadWN2CQ_d-gMjgcxnFnMwB79NGUbmdpaGi0VeTVSI-pE7NoKi2xB571NGd3eewvXDzcBtwl0/s1600/val.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBMFn8juZ3aIl-m8Q63nk5qi2r60zfWM1-ltAHlmuo3LTyldb5u5lVZDaasijHMKKOdlUadWN2CQ_d-gMjgcxnFnMwB79NGUbmdpaGi0VeTVSI-pE7NoKi2xB571NGd3eewvXDzcBtwl0/s400/val.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;In above design there are two listboxes one is showing all items
and other is selected item. There are two button which transfer item
from left to right and right to left.&lt;/p&gt;

&lt;p&gt;Here right hand side listbox showing already selected items.
Generally while editing the from data we retrieve already selected 
values into the form control in such case we are using this feature.&lt;/p&gt;

&lt;h3&gt;Ajax Action&lt;/h3&gt;
&lt;code&gt;
&lt;pre&gt;
 public JsonResult Edit(string graphicsId)
        {
 List&amp;ltstring&amp;gt mappedChannelId = context.ChannelGraphicsMaps.Where
(x =&amp;gt x.GraphicsId == Id).Select(y =&amp;gt y.channel_code).ToList();
            string mappedChannelName = string.Empty;

List&amp;ltKeyValuePair&amp;ltstring, string&amp;gt&amp;gt selectedChannels =
 new List&amp;ltKeyValuePair&amp;ltstring, string&amp;gt&amp;gt();

            foreach (string item in mappedChannelId)
            {
      mappedChannelName=context.channel_master
.Where(a =&amp;gt a.channel_code == item)
.Select(a =&amp;gta.channel_name).SingleOrDefault().ToString();
 
selectedChannels.Add(new KeyValuePair&amp;ltstring,
string&amp;gt(item,mappedChannelName));
            }           

  var result = (from x in graphics select new 
{ 
    SelectedChannels=selectedChannels,                     
});
   return Json(result, JsonRequestBehavior.AllowGet);
        }
&lt;/pre&gt;
&lt;/code&gt;

&lt;h3&gt;Ajax code&lt;/h3&gt;
&lt;code&gt;
&lt;pre&gt;
  var options = {};
                options.url = '@Url.Action("Edit", "GraphicsMaster")',
                options.type = "POST";
                options.data = JSON.stringify({ graphicsId: Id });
                options.dataType = "json";
                options.contentType = "application/json";
                options.success = function (graphicsEdit) {
            //Code for assigning values to control of Programme
      for (var i = 0; i &amp;lt graphicsEdit.length; i++)
 {
 /*Getting already selected channels into listbox
       and remove it from all channels list*/
  $('#selectedChannelList').empty();
 for (var j = 0; j &amp;lt graphicsEdit[i].SelectedChannels.length; j++)
 {
 var listBox = document.getElementById("selectedChannelList");
 $("#selectLeft option[value=" + graphicsEdit[i].SelectedChannels[j].Key + "]").remove();

 move(listBox, graphicsEdit[i].SelectedChannels[j].Key, graphicsEdit[i].SelectedChannels[j].Value);
                        }

}
&lt;/pre&gt;
&lt;/code&gt;

&lt;h3&gt;Design for above code in mvc4&lt;/h3&gt;
&lt;code&gt;
&lt;pre&gt;
&amp;lttable&amp;gt
&amp;lttr&amp;gt
  &amp;lttd&amp;gt
     Select Channel
  &amp;lt/td&amp;gt
  &amp;lttd valign="top"&amp;gt
     @Html.ListBox("channels", ViewBag.channels as MultiSelectList,
       new { size = "6", id = "selectLeft" })
  &amp;lt/td&amp;gt
  &amp;lttd valign="top"&amp;gt
 &amp;ltinput name="btnRight" type="button" id="btnRight" value="&amp;gt;&amp;gt;" onclick="javaScript:moveToRightOrLeft(1);"&amp;gt
    &amp;ltinput name="btnLeft" type="button" id="btnLeft" value="&amp;lt;&amp;lt;" onclick="javaScript:moveToRightOrLeft(2);"&amp;gt
 &amp;lt/td&amp;gt
&amp;lttd valign="top"&amp;gt
     @Html.ListBox("channelSelected", new List&amp;ltSelectListItem&amp;gt(), 
      new { size = "6", id = "selectedChannelList" })
&amp;lt/td&amp;gt
&amp;lt/tr&amp;gt
&amp;lt/table&amp;gt
&lt;/pre&gt;
&lt;/code&gt;</description><link>http://technisher.blogspot.com/2014/04/making-existing-item-selected-in.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBMFn8juZ3aIl-m8Q63nk5qi2r60zfWM1-ltAHlmuo3LTyldb5u5lVZDaasijHMKKOdlUadWN2CQ_d-gMjgcxnFnMwB79NGUbmdpaGi0VeTVSI-pE7NoKi2xB571NGd3eewvXDzcBtwl0/s72-c/val.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-6667101846523310181</guid><pubDate>Mon, 07 Apr 2014 07:38:00 +0000</pubDate><atom:updated>2014-04-07T13:15:31.894+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">PagedList in mvc4</category><category domain="http://www.blogger.com/atom/ns#">Pagination using PagedList.Mvc in mvc4</category><title>Pagination in MVC4</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis_Llk2aQO0oCcVmHWQmWzzUH5QQL0j8787neD6toW7efLwA1M0wD23n0gUVIjgJ4O7g-xX5ZYaSblJUaKtUyS4PoWeD_mWCVU3v-OJAE5M_7G5Z7r7H_mFhXC-C-nKwJFf2bWk26Pjkk/s1600/val.png" imageanchor="1" &gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis_Llk2aQO0oCcVmHWQmWzzUH5QQL0j8787neD6toW7efLwA1M0wD23n0gUVIjgJ4O7g-xX5ZYaSblJUaKtUyS4PoWeD_mWCVU3v-OJAE5M_7G5Z7r7H_mFhXC-C-nKwJFf2bWk26Pjkk/s400/val.png" /&gt;&lt;/a&gt;

&lt;p&gt;Here I am going to show you how to apply pagination in mvc4.
Many time while showing list of items from database there may 
be situation where you want to show only limited number of items 
at a time in this situation pagination is used.&lt;/p&gt;

&lt;p&gt;To apply pagination in mvc4 you need to download &lt;b&gt;PagedList.mvc&lt;/b&gt; 
package from &lt;b&gt;nuget package manager&lt;/b&gt;. 
To download this follow following steps:&lt;/p&gt;
&lt;pre&gt;
&lt;b&gt;1.&lt;/b&gt;open your project and click on Tools menu.
&lt;b&gt;2. Tools --&gt; Library Package Manager --&gt; manage nuget packages for solutions&lt;/b&gt;
&lt;b&gt;3.&lt;/b&gt;Now choose online as option from left hand side list.
&lt;b&gt;4.&lt;/b&gt;And in search box type &lt;b&gt;PagedList.Mvc&lt;/b&gt; 
&lt;b&gt;5.&lt;/b&gt;Now in search result you will get PackgedList.Mvc 
     and install button click install button.
&lt;b&gt;6.&lt;/b&gt; After installation in your project reference two references 
        will be get added. And also PagedList.css added into your content 
        directory.
&lt;b&gt;7.&lt;/b&gt;Add following reference on your view and controller to this package
&lt;b&gt;a. using PagedList;
   b. using PagedList.Mvc;
&lt;/b&gt;
&lt;/pre&gt;

&lt;b&gt;Controller Action:&lt;/b&gt;
&lt;pre&gt;
      public ActionResult Index(int? page )
        {
            return View(db.IrdMasters.ToList().ToPagedList(page ?? 1,2));
        }
&lt;/pre&gt;
&lt;p&gt;
In above code I passed nullable reference named page this
is necessary in case of first page loading.
And also added  &lt;b&gt;ToPagedList(page ?? 1,2)&lt;/b&gt; here I specified number 
of record i.e. 3 will be displayed at a time.
&lt;/p&gt;

&lt;b&gt;View:&lt;/b&gt;
&lt;pre&gt;
@using PagedList;
@using PagedList.Mvc;
@model IPagedList&amp;ltDistribution.Entities.IrdMaster&amp;gt
@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
&amp;lth2&amp;gt
    Index&amp;lt/h2&amp;gt
&amp;ltp&amp;gt
    @Html.ActionLink("Create New", "Create")
&amp;lt/p&amp;gt
&amp;lttable border="1"&amp;gt
    &amp;lttr&amp;gt
        &amp;ltth&amp;gt
            @Html.DisplayNameFor(model =&amp;gt model.First().IrdCode)
        &amp;lt/th&amp;gt
        &amp;ltth&amp;gt
        Edit
        &amp;lt/th&amp;gt
        &amp;ltth&amp;gt
        Details
        &amp;lt/th&amp;gt
        &amp;ltth&amp;gt
        Delete
        &amp;lt/th&amp;gt
    &amp;lt/tr&amp;gt
    @foreach (var item in Model)
    {
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
                @Html.DisplayFor(modelItem =&amp;gt item.IrdCode)
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt@Html.ActionLink("Edit", "Edit", new { id = item.IrdId })
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt@Html.ActionLink("Details", "Details", new { id = item.IrdId })
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                @Html.ActionLink("Delete", "Delete", new { id = item.IrdId })
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
    }
&amp;lt/table&amp;gt
&lt;b&gt;
@Html.PagedListPager(Model, Page =&amp;gt Url.Action("Index", new { Page }),
new PagedListRenderOptions {Display=PagedListDisplayMode.IfNeeded, DisplayPageCountAndCurrentLocation=true})
&lt;/b&gt;
&lt;/pre&gt;

&lt;p&gt;In above code I replaced IEnumerable&lt;Distribution.Entities.IrdMaster&gt; 
with IPagedList&lt;Distribution.Entities.IrdMaster&gt; because here we are giving 
the only that much record that are set into controller action instead of whole list.
&lt;/p&gt;

&lt;p&gt;Also I added one html helper at the end after the table that shows the 
Pagination option at bottom of table that is shown into our view.

Here in this helper I specified lots of option like where to redirect(Index Action) 
and passing current clicked pagination option.&lt;/p&gt;</description><link>http://technisher.blogspot.com/2014/04/pagination-in-mvc4.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEis_Llk2aQO0oCcVmHWQmWzzUH5QQL0j8787neD6toW7efLwA1M0wD23n0gUVIjgJ4O7g-xX5ZYaSblJUaKtUyS4PoWeD_mWCVU3v-OJAE5M_7G5Z7r7H_mFhXC-C-nKwJFf2bWk26Pjkk/s72-c/val.png" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-5496434591640077045.post-3342023021983069464</guid><pubDate>Sat, 05 Apr 2014 15:44:00 +0000</pubDate><atom:updated>2014-04-07T13:09:42.514+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Free SMS sending using C#</category><category domain="http://www.blogger.com/atom/ns#">using site2SMS api form message sending</category><title>Free SMS sending through ASP.NET</title><description>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;
&lt;br /&gt;&lt;/div&gt;

&lt;pre&gt;
&lt;p&gt;Here I developed one web application through which you
 can send free SMS on any mobile number in India.&lt;/br&gt;
&lt;h3&gt;Note: Messages will not be delivered if receiver mobile number activated with the DND Service&lt;/h3&gt;
&lt;b&gt;
View of a page:
&lt;a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfpP5aHK1kKKieRHgngRNynmkmxOgzyzXG9MUeBoqufMcG-r9cIB6y_RydmFzi-ukMQFzGaiUCQ8Y5UfR5ww4CiVbN0u3Fc6ZrVA-LwxEJOH7eZkg9x-H53924jGViimzBj_Jq1-YaVPI/s1600/sms.png" imageanchor="1" &gt;&lt;img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfpP5aHK1kKKieRHgngRNynmkmxOgzyzXG9MUeBoqufMcG-r9cIB6y_RydmFzi-ukMQFzGaiUCQ8Y5UfR5ww4CiVbN0u3Fc6ZrVA-LwxEJOH7eZkg9x-H53924jGViimzBj_Jq1-YaVPI/s320/sms.png" /&gt;&lt;/a&gt;
&lt;/b&gt;
&lt;b&gt;To send SMS you have to follow following steps:&lt;/b&gt;
&lt;b&gt;1.&lt;/b&gt;Create your account on site2sms.com
&lt;b&gt;2.&lt;/b&gt;Now using this account credential create one 
          api key which is used in our code.
&lt;b&gt;3.&lt;/b&gt;TO generate API key &lt;a href="https://www.mashape.com/"&gt;Click Here&lt;/a&gt; 
&lt;b&gt;4.&lt;/b&gt;Also you need to use ASPSnippets.SmsAPI.dll file 
          add this file into your projects references directory.
&lt;b&gt;5.&lt;/b&gt;TO get ASPSnippets.SmsAPI.dll file &lt;a href="http://aspsnippets.com/DownloadFile.aspx?File=ASPSnippets.SmsAPI.dll#center"&gt;Click Here&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;Following code is used for design the page using asp.net&lt;/p&gt;

&lt;/pre&gt;
&lt;b&gt;Design smssend.aspx&lt;/b&gt;
&lt;code&gt;
&lt;pre&gt;
&amp;ltform id="form1" runat="server"&amp;gt
    &amp;lttable border="0"&amp;gt
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
                Your Number:
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:TextBox ID="txtNumber" runat="server"&amp;gt&amp;lt/asp:TextBox&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:RequiredFieldValidator ID="RequiredFieldValidator1" 
                    runat="server" ErrorMessage="Required"
                    ControlToValidate="txtNumber" ForeColor="Red"&amp;gt
&amp;lt/asp:RequiredFieldValidator&amp;gt
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
                Password:
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:TextBox ID="txtPassword" TextMode="Password"
                 runat="server"&amp;gt&amp;lt/asp:TextBox&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:RequiredFieldValidator ID="RequiredFieldValidator2" 
                          runat="server" ErrorMessage="Required"
                    ControlToValidate="txtPassword" ForeColor="Red"&amp;gt
&amp;lt/asp:RequiredFieldValidator&amp;gt
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
                Recepient Number:
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:TextBox ID="txtRecepientNumber" 
                          runat="server" Width="300" 
                    ontextchanged="txtRecepientNumber_TextChanged"&amp;gt
            &amp;lt/asp:TextBox&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:RequiredFieldValidator ID="RequiredFieldValidator3" 
                   runat="server" ErrorMessage="Required"
                  ControlToValidate="txtRecepientNumber" ForeColor="Red"&amp;gt
              &amp;lt/asp:RequiredFieldValidator&amp;gt
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
                Message:
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:TextBox ID="txtMessage" runat="server"
                       TextMode="MultiLine"&amp;gt&amp;lt/asp:TextBox&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:RequiredFieldValidator ID="RequiredFieldValidator5" 
                runat="server" ErrorMessage="Required"
                ControlToValidate="txtMessage" ForeColor="Red"&amp;gt
              &amp;lt/asp:RequiredFieldValidator&amp;gt
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
        &amp;lttr&amp;gt
            &amp;lttd&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
                &amp;ltasp:Button ID="btnSend" runat="server" 
                     Text="Send" OnClick="btnSend_Click" /&amp;gt
            &amp;lt/td&amp;gt
            &amp;lttd&amp;gt
            &amp;lt/td&amp;gt
        &amp;lt/tr&amp;gt
    &amp;lt/table&amp;gt
    &amp;lt/form&amp;gt
&lt;/pre&gt;
&lt;/code&gt;
&lt;b&gt;smssend.aspx.cs&lt;/b&gt;
&lt;pre&gt;
  protected void btnSend_Click(object sender, EventArgs e)
        {
            string s = txtRecepientNumber.Text;

            SMS.APIType = SMSGateway.Site2SMS;
            SMS.MashapeKey = "&lt;your api key&gt;";
            SMS.Username = txtNumber.Text.Trim();
            SMS.Password = txtPassword.Text.Trim();
            if (s.Trim().IndexOf(",") == -1)
            {
                //Single SMS
               
                SMS.SendSms(s.Trim(), txtMessage.Text.Trim());
            }
            else
            {
                //Multiple SMS
                List&lt;string&gt; numbers = s.Trim().Split(',').ToList();
                foreach (string number in numbers)
                {
                 SMS.SendSms(number, txtMessage.Text.Trim());
                }
            }
        }
&lt;/pre&gt;
&lt;p&gt;In above code add your api key. And also import the file
1. using System.Net;
2. using ASPSnippets.SmsAPI; &lt;/p&gt;

</description><link>http://technisher.blogspot.com/2014/04/free-sms-sending-through-aspnet.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" height="72" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfpP5aHK1kKKieRHgngRNynmkmxOgzyzXG9MUeBoqufMcG-r9cIB6y_RydmFzi-ukMQFzGaiUCQ8Y5UfR5ww4CiVbN0u3Fc6ZrVA-LwxEJOH7eZkg9x-H53924jGViimzBj_Jq1-YaVPI/s72-c/sms.png" width="72"/><thr:total>3</thr:total></item></channel></rss>