==>>In this article I am posting how to rotate multiple div like a slide show . It's a basic functionality that is used mostly in various websites. So i explain how to rotate div In Asp .Net using JQuery.In the Previous Article post the New-Features-in-Visual-Studio-2013 will help you for increase knowledge .: -
First you Need to create a website that have a aspx page.
Then add a Div in the body that have multiple divs.
. Div
<div id="MainDv">
<div id="Div1" class="DvCss DvCssa">
div 1 Show now
</div>
<div id="Div2" class="DvCss">
div 2 Show now
</div>
<div id="Div3" class="DvCss">
div 3 Show now
</div>
</div>
After the add div in body need to write css and js .
Css.
<style type="text/css">
div
{
width: 100px;
height: 100px;
}
#MainDv
{
position: relative;
}
.DvCss
{
position: absolute;
top: 0;
left: 0;
display: none;
}
.DvCssa
{
display: block;
}
#Div1
{
background-color: Pink;
}
#Div2
{
background-color: Aqua;
}
#Div3
{
background-color: Fuchsia;
}
</style>
.JS
<script type="text/javascript" language="javascript">
$(window).load(function() {
var divs = $('.DvCss');
function fade() {
var current = $('.DvCssa');
var currentIndex = divs.index(current),
nextIndex = currentIndex + 1;
if (nextIndex >= divs.length) {
nextIndex = 0;
}
var next = divs.eq(nextIndex);
next.stop().fadeIn(2000, function() {
$(this).addClass('DvCssa');
});
current.stop().fadeOut(2000, function() {
$(this).removeClass('DvCssa');
setTimeout(fade, 2500);
});
}
fade();
})
</script>
.donot forgot add
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
'C# .NET ASP .NET,Grid View,DropDownList,AJAX,JavaScript,JQuery,asp.net articles,C#.NET Articles,ASP,ASP.NET,C#,VB,CSharp,C Sharp,dotnet,subhash jakhar,GridView,DropDownList,Visual Studio,ajax,Java Script,JQuery,XML,Crystal Reports,SSIS,SSRS,DetailsView,winforms,windows forms,windows application,code samples,.net code examples'
Tuesday, July 23, 2013
Monday, July 8, 2013
What's new features in Visual Studio 2013
==>>In this article I am posting What is New in Visual Studio 2013. In this version Microsoft bring various stuff either in tooling, core, service etc . So i explain the new features of .NET Framework 4.5.1 will help you for increase knowledge .: -
1. In this version MicrSoft include Edit & Continue during debugging in 64-bit
2. Return Value Inspection, In this features we can get the return value of a method when we debugging in auto windows and immediate window.
3. Improve the functionality of Async Debugging ,Call Stack and Task Window this is support Store Applications, Web Applications and Desktop Applications in Windows 8.1
4. This version provide reliable connection with Azure Database.
5. This version provide the functionality for make Automatically retry/reconnect broken connection
6. Good experience for connected devices
7. Colorize the icons in Solution Explorer
8. New design for Team Explorer
9. Scroll bar map mode
10. Browser Links,It is a good feature that provide functionality to IDE connected with the browser via SignalR hub
11. New HTML Editor
12. Improvment in JavaScript & CSS editor
13. In Java Script provide the
(i) Block-Scoped Variables (ii) Container Objects,
14. In the Code Features
(i) View Definition in popup
(ii) Enhanced Scroll-Bar Facility
15. 200+ bugs with high DPI monitors have been fixed with Visual Studio 2013, including how options are displayed.
16. Provide the functionality auto-complete braces, comments, and quotes has now also been included out of the box, meaning If we have open a curly brace and start writing without worrying about the ending brace. It adjust automacily.
17. Solutions will now be loaded async, meaning we are able to open solutions with 100+ projects, and they will open in the background allowing you to work on files while everything else loads. The files you last had open will load first allowing you to quickly resume where you left off.
18. Now in the new version the options menus can now be resized, so we are not restricted to the default size.
19. Now we are able choose the theme of your IDE (Blue, Dark, Black).
The various new thing carry by this new version If you want to try to use features of this version then download by Click Here.....
1. In this version MicrSoft include Edit & Continue during debugging in 64-bit
2. Return Value Inspection, In this features we can get the return value of a method when we debugging in auto windows and immediate window.
3. Improve the functionality of Async Debugging ,Call Stack and Task Window this is support Store Applications, Web Applications and Desktop Applications in Windows 8.1
4. This version provide reliable connection with Azure Database.
5. This version provide the functionality for make Automatically retry/reconnect broken connection
6. Good experience for connected devices
7. Colorize the icons in Solution Explorer
8. New design for Team Explorer
9. Scroll bar map mode
10. Browser Links,It is a good feature that provide functionality to IDE connected with the browser via SignalR hub
11. New HTML Editor
12. Improvment in JavaScript & CSS editor
13. In Java Script provide the
(i) Block-Scoped Variables (ii) Container Objects,
14. In the Code Features
(i) View Definition in popup
(ii) Enhanced Scroll-Bar Facility
15. 200+ bugs with high DPI monitors have been fixed with Visual Studio 2013, including how options are displayed.
16. Provide the functionality auto-complete braces, comments, and quotes has now also been included out of the box, meaning If we have open a curly brace and start writing without worrying about the ending brace. It adjust automacily.
17. Solutions will now be loaded async, meaning we are able to open solutions with 100+ projects, and they will open in the background allowing you to work on files while everything else loads. The files you last had open will load first allowing you to quickly resume where you left off.
18. Now in the new version the options menus can now be resized, so we are not restricted to the default size.
19. Now we are able choose the theme of your IDE (Blue, Dark, Black).
The various new thing carry by this new version If you want to try to use features of this version then download by Click Here.....
Monday, July 1, 2013
Price/Number convert into words in C# Asp .Net
==>> In this article I am posting how to convert Price/Number in words using c# Asp .Net. Some time we need convert Price/Number in words in banking /financial type application and in invoice report we need this so this post will heplfull for you.
For this you need take a new website and add a textbox,label and button then add the cs code given below : -
aspx Page Code:-
TextBox
<asp:TextBox ID="TxtPrice" runat="server" MaxLength="9"></asp:TextBox>
Button
<asp:Button ID="BtnConvert" runat="server" Text="Convert In Words" ValidationGroup="val"
onclick="BtnConvert_Click" />
Label
<asp:Label ID="LblPriceinWords" runat="server" BackColor="#ccffff" ></asp:Label>
aspx.cs Page Code:-
public static string AmountToWord(int number)
{
if (number == 0) return "Zero";
if (number == -2147483648)
return "Minus Two Hundred and Fourteen Crore Seventy Four Lakh Eighty Three Thousand Six Hundred and Forty Eight";
int[] num = new int[4];
int first = 0;
int u, h, t;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (number < 0)
{
sb.Append("Minus ");
number = -number;
}
string[] words0 = {"" ,"One ", "Two ", "Three ", "Four ",
"Five " ,"Six ", "Seven ", "Eight ", "Nine "};
string[] words1 = {"Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ",
"Fifteen ","Sixteen ","Seventeen ","Eighteen ", "Nineteen "};
string[] words2 = {"Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ",
"Seventy ","Eighty ", "Ninety "};
string[] words3 = { "Thousand ", "Lakh ", "Crore " };
num[0] = number % 1000; // units
num[1] = number / 1000;
num[2] = number / 100000;
num[1] = num[1] - 100 * num[2]; // thousands
num[3] = number / 10000000; // crores
num[2] = num[2] - 100 * num[3]; // lakhs
//You can increase as per your need.
for (int i = 3; i > 0; i--)
{
if (num[i] != 0)
{
first = i;
break;
}
}
for (int i = first; i >= 0; i--)
{
if (num[i] == 0) continue;
u = num[i] % 10; // ones
t = num[i] / 10;
h = num[i] / 100; // hundreds
t = t - 10 * h; // tens
if (h > 0) sb.Append(words0[h] + "Hundred ");
if (u > 0 || t > 0)
{
if (h == 0)
sb.Append("");
else
if (h > 0 || i == 0) sb.Append("and ");
if (t == 0)
sb.Append(words0[u]);
else if (t == 1)
sb.Append(words1[u]);
else
sb.Append(words2[t - 2] + words0[u]);
}
if (i != 0) sb.Append(words3[i - 1]);
}
return sb.ToString().TrimEnd() + " Rupees only";
}
protected void BtnConvert_Click(object sender, EventArgs e)
{
int price = Convert.ToInt32(TxtPrice.Text);
LblPriceinWords.Text = AmountToWord(price);
}
Example:-
Hpoe this will help you........
Download Sample Code :-
For this you need take a new website and add a textbox,label and button then add the cs code given below : -
aspx Page Code:-
TextBox
<asp:TextBox ID="TxtPrice" runat="server" MaxLength="9"></asp:TextBox>
Button
<asp:Button ID="BtnConvert" runat="server" Text="Convert In Words" ValidationGroup="val"
onclick="BtnConvert_Click" />
Label
<asp:Label ID="LblPriceinWords" runat="server" BackColor="#ccffff" ></asp:Label>
aspx.cs Page Code:-
public static string AmountToWord(int number)
{
if (number == 0) return "Zero";
if (number == -2147483648)
return "Minus Two Hundred and Fourteen Crore Seventy Four Lakh Eighty Three Thousand Six Hundred and Forty Eight";
int[] num = new int[4];
int first = 0;
int u, h, t;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
if (number < 0)
{
sb.Append("Minus ");
number = -number;
}
string[] words0 = {"" ,"One ", "Two ", "Three ", "Four ",
"Five " ,"Six ", "Seven ", "Eight ", "Nine "};
string[] words1 = {"Ten ", "Eleven ", "Twelve ", "Thirteen ", "Fourteen ",
"Fifteen ","Sixteen ","Seventeen ","Eighteen ", "Nineteen "};
string[] words2 = {"Twenty ", "Thirty ", "Forty ", "Fifty ", "Sixty ",
"Seventy ","Eighty ", "Ninety "};
string[] words3 = { "Thousand ", "Lakh ", "Crore " };
num[0] = number % 1000; // units
num[1] = number / 1000;
num[2] = number / 100000;
num[1] = num[1] - 100 * num[2]; // thousands
num[3] = number / 10000000; // crores
num[2] = num[2] - 100 * num[3]; // lakhs
//You can increase as per your need.
for (int i = 3; i > 0; i--)
{
if (num[i] != 0)
{
first = i;
break;
}
}
for (int i = first; i >= 0; i--)
{
if (num[i] == 0) continue;
u = num[i] % 10; // ones
t = num[i] / 10;
h = num[i] / 100; // hundreds
t = t - 10 * h; // tens
if (h > 0) sb.Append(words0[h] + "Hundred ");
if (u > 0 || t > 0)
{
if (h == 0)
sb.Append("");
else
if (h > 0 || i == 0) sb.Append("and ");
if (t == 0)
sb.Append(words0[u]);
else if (t == 1)
sb.Append(words1[u]);
else
sb.Append(words2[t - 2] + words0[u]);
}
if (i != 0) sb.Append(words3[i - 1]);
}
return sb.ToString().TrimEnd() + " Rupees only";
}
protected void BtnConvert_Click(object sender, EventArgs e)
{
int price = Convert.ToInt32(TxtPrice.Text);
LblPriceinWords.Text = AmountToWord(price);
}
Example:-
Hpoe this will help you........
Download Sample Code :-

Show Hide div using JQuery in asp .net
==>> In this article I am posting how to show and hide div using JQuery. Some time we need to hide and show div for show hide information on page so this post will heplfull for you.
.ASPX Code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#show").click(function() {
$(".mydiv").show(1000);
});
$("#hide").click(function() {
$(".mydiv").hide(1000);
});
});
</script>
<title>Show-Hide div using JQuery</title>
<style type="text/css">
.mydiv
{
margin:10px;padding:12px;
border:2px solid #666;
width:100px;
height:100px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="mydiv">
This is test div
</div>
<input id="show" type="button" value="Show" />
<input id="hide" type="button" value="Hide" />
</form>
</body>
</html>
Show-Hide div using JQuery
.ASPX Code.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function() {
$("#show").click(function() {
$(".mydiv").show(1000);
});
$("#hide").click(function() {
$(".mydiv").hide(1000);
});
});
</script>
<title>Show-Hide div using JQuery</title>
<style type="text/css">
.mydiv
{
margin:10px;padding:12px;
border:2px solid #666;
width:100px;
height:100px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div class="mydiv">
This is test div
</div>
<input id="show" type="button" value="Show" />
<input id="hide" type="button" value="Hide" />
</form>
</body>
</html>
DEMO:-
Show Hide test div
Friday, June 21, 2013
Get highest and lowest salary of an employee using Top,MAX and CTE in SQLServer
==>> One of most interview question Get highest and lowest salary of an employee using Top and without Top ,Using Max without Max. So I am posting the all solution for get salary according question :----
EMP table:
SELECT * FROM dbo.EMP ORDER BY Salary
For Get 3rd Highest Salary :
SELECT TOP 1 EName,salary FROM (SELECT DISTINCT TOP 3 EName,salary FROM dbo.EMP ORDER BY Salary DESC) a ORDER BY salary ASC
For Get 3rd Lowest Salary
SELECT TOP 1 EName,salary FROM(SELECT DISTINCT TOP 3 EName,salary FROM emp ORDER BY Salary ASC ) a ORDER BY salary DESC
EMP table:
SELECT * FROM dbo.EMP ORDER BY Salary
Query for Get 3rd Highest and 3rd Lowest Salary using TOP Keyword in Sql Server
For Get 3rd Highest Salary :
SELECT TOP 1 EName,salary FROM (SELECT DISTINCT TOP 3 EName,salary FROM dbo.EMP ORDER BY Salary DESC) a ORDER BY salary ASC
For Get 3rd Lowest Salary
SELECT TOP 1 EName,salary FROM(SELECT DISTINCT TOP 3 EName,salary FROM emp ORDER BY Salary ASC ) a ORDER BY salary DESC
Query for Get 2rd Highest using MAX in Sql Server
SELECT MAX(Salary) as Salary
FROM dbo.EMP
WHERE Salary NOT IN ( SELECT MAX(Salary)
FROM dbo.EMP ) ;
Query for Get Nth Highest and Nth Lowest salary using CTE in Sql Server
WITH Salaries
AS ( SELECT Salary ,
EName ,
ROW_NUMBER() OVER ( ORDER BY Salary ASC ) AS 'RowNum'
FROM dbo.EMP
)
SELECT Salary ,
EName
FROM Salaries
WHERE RowNum = 5So in this way can select value using different-2 manner.The best way you can use CTE and find Nth number Value from table.
Hope thei post will helpfull.....
Delete Remove duplicate records or rows in sql server
==>> Some time we need Delete or Remove the duplicate rows in sql server this type of problem when occur our data table does not contain any primary
key column because of that it contains duplicate records that would be like
this:----
:- For get duplicate records you need to run this query this query return how many records are multiple The RowNumber column indicate the number of rows .......
SQLQuery:-
WITH tempTable as
(
SELECT ROW_NUMBER() Over(PARTITION BY EName,dptName ORDER BY EName) As RowNumber,* FROM dbo.EMP
)
SELECT * FROM tempTable
Result:-
:-Now You See we having the two row are multiple in RowNumber column greater then 1 mean the row in this table exist more then one time.
Now we need to execute another query for unique value from datatable for that we need write sql query like :-----
SQLQuery:-
WITH tempTable as
(
SELECT ROW_NUMBER() Over(PARTITION BY EName,dptName ORDER BY EName) As RowNumber,* FROM EMP
)
DELETE FROM tempTable where RowNumber >1
SELECT * FROM EMP order by EId asc
Result:-
So in this way we can remove the duplicate rows from sql table .
Hope this will help you for find your solution.
:- For get duplicate records you need to run this query this query return how many records are multiple The RowNumber column indicate the number of rows .......
SQLQuery:-
WITH tempTable as
(
SELECT ROW_NUMBER() Over(PARTITION BY EName,dptName ORDER BY EName) As RowNumber,* FROM dbo.EMP
)
SELECT * FROM tempTable
Result:-
:-Now You See we having the two row are multiple in RowNumber column greater then 1 mean the row in this table exist more then one time.
Now we need to execute another query for unique value from datatable for that we need write sql query like :-----
SQLQuery:-
WITH tempTable as
(
SELECT ROW_NUMBER() Over(PARTITION BY EName,dptName ORDER BY EName) As RowNumber,* FROM EMP
)
DELETE FROM tempTable where RowNumber >1
SELECT * FROM EMP order by EId asc
Result:-
So in this way we can remove the duplicate rows from sql table .
Hope this will help you for find your solution.
Query for Delete All tables,procedures,views,function from database in SQL Server
==>> In this article I am posting SQL Query for Delete All tables,procedures,views,function from database in SQL Server. Some time we need to Delete All tables,procedures,views,function from database in SQL Server so this query will heplfull.
--For Delete Tables
DECLARE @Sql NVARCHAR(500)
DECLARE @Cursor CURSOR
SET
@Cursor = CURSOR FAST_FORWARD FOR
SELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + ']'
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1
LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAME
OPEN @Cursor
FETCH NEXT FROM @Cursor INTO @Sql
WHILE ( @@FETCH_STATUS = 0 )
BEGIN
EXEC SP_EXECUTESQL @Sql
FETCH NEXT FROM @Cursor INTO @Sql
END
CLOSE @Cursor
DEALLOCATE @Cursor
GO
EXEC sp_MSForEachTable 'DROP TABLE ?'
GO
--For Delete Procedures
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'p'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
IF @procName <> 'DeleteAllProcedures'
EXEC('drop procedure ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
--For Delete Views
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'v'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
EXEC('drop view ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
--For Delete functions
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'fn'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
EXEC('drop function ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
--For Delete Tables
DECLARE @Sql NVARCHAR(500)
DECLARE @Cursor CURSOR
SET
@Cursor = CURSOR FAST_FORWARD FOR
SELECT DISTINCT sql = 'ALTER TABLE [' + tc2.TABLE_NAME + '] DROP [' + rc1.CONSTRAINT_NAME + ']'
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS rc1
LEFT JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS tc2 ON tc2.CONSTRAINT_NAME =rc1.CONSTRAINT_NAME
OPEN @Cursor
FETCH NEXT FROM @Cursor INTO @Sql
WHILE ( @@FETCH_STATUS = 0 )
BEGIN
EXEC SP_EXECUTESQL @Sql
FETCH NEXT FROM @Cursor INTO @Sql
END
CLOSE @Cursor
DEALLOCATE @Cursor
GO
EXEC sp_MSForEachTable 'DROP TABLE ?'
GO
--For Delete Procedures
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'p'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
IF @procName <> 'DeleteAllProcedures'
EXEC('drop procedure ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
--For Delete Views
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'v'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
EXEC('drop view ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
--For Delete functions
GO
DECLARE @procName VARCHAR(500)
DECLARE cur CURSOR
FOR SELECT [name] FROM sys.objects WHERE type = 'fn'
OPEN cur
FETCH NEXT FROM cur INTO @procName
WHILE @@fetch_status = 0
BEGIN
EXEC('drop function ' + @procName)
FETCH NEXT FROM cur INTO @procName
END
CLOSE cur
DEALLOCATE cur
Subscribe to:
Posts (Atom)