tag:blogger.com,1999:blog-64055154417389967132024-02-07T10:24:35.996-08:00Asp.Netlearn asp.net c# vb free download demoAnonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.comBlogger166125tag:blogger.com,1999:blog-6405515441738996713.post-46307692731366912302014-09-12T00:32:00.001-07:002014-09-12T00:34:06.108-07:00How to Get Data From Wikipedia Using API and jQuery in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Get Data From Wikipedia Using API and jQuery in C#</b><br />
<br />
<b></b>
<b>.Aspx File</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><%@ Page Language="VB" AutoEventWireup="false" CodeFile="WikirRference.aspx.vb" Inherits="Default2" %><br /><br /><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br /><br /><html xmlns="http://www.w3.org/1999/xhtml"><br /><head runat="server"><br /> <script src="https://googledrive.com/host/0Bw4NrxH2nTVqMnliTHpSY0U4ZE0" type="text/javascript"></script><br /><br /> <script src="https://googledrive.com/host/0Bw4NrxH2nTVqYndKU2p0Z2s3M1E" type="text/javascript"></script><br /><br /> <script src="https://googledrive.com/host/0Bw4NrxH2nTVqX3VZazJtMmxSNW8" type="text/javascript"></script><br /> <title></title><br /> <script type="text/javascript"><br /> $(document).ready(function () {<br /> });<br /> function searchdata() {<br /><br /> var q = $("#searchterm").val();<br /> $.getJSON("http://en.wikipedia.org/w/api.php?callback=?",<br /> {<br /> srsearch: q,<br /> action: "query",<br /> list: "search",<br /> format: "json"<br /><br /> },<br /> function (data) {<br /> $("#results").empty();<br /> $("#results").append("Results for <b>" + q + "</b> </br>");<br /> $("#results").append("<div>&nbsp;</div>");<br /> $.each(data.query.search, function (i, item) {<br /> $("#results").append("<div><a href='http://en.wikipedia.org/wiki/" + encodeURIComponent(item.title) + "'>" + item.title + "</a> : " + item.snippet + "</div>");<br /> });<br /> });<br /><br /><br /> }<br /><br /> </script><br /></head><br /><body><br /> <form id="form1" runat="server"><br /> <div style="border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300px; border-radius: 25px; height: 60px; text-align: left;"><br /> <b>Wikipedia API Search Using jQuery By http://fantasyaspnet.blogspot.in/</b><br /><br /> (This Wikipedia API will give the search results and references more than one.)<br /> </div><br /> <div style="padding-left: 75px; padding-top: 15px;"><br /> <input id="searchterm" type="text" /><br /> <input id="search" type="button" value="Search" onclick="searchdata();" /><br /> </div><br /> <div>&nbsp;</div><br /> <div id="results" style="width: 300px; box-shadow: 10px 10px 5px #888888;"><br /> </div><br /> </form><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<b>Live Demo</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>
<script src="https://googledrive.com/host/0Bw4NrxH2nTVqMnliTHpSY0U4ZE0" type="text/javascript"></script>
<script src="https://googledrive.com/host/0Bw4NrxH2nTVqYndKU2p0Z2s3M1E" type="text/javascript"></script>
<script src="https://googledrive.com/host/0Bw4NrxH2nTVqX3VZazJtMmxSNW8" type="text/javascript"></script>
<title></title>
<script type="text/javascript">
$(document).ready(function () {
});
function searchdata() {
var q = $("#searchterm").val();
$.getJSON("http://en.wikipedia.org/w/api.php?callback=?",
{
srsearch: q,
action: "query",
list: "search",
format: "json"
},
function (data) {
$("#results").empty();
$("#results").append("Results for <b>" + q + "</b> </br>");
$("#results").append("<div> </div>");
$.each(data.query.search, function (i, item) {
$("#results").append("<div><a href='http://en.wikipedia.org/wiki/" + encodeURIComponent(item.title) + "'>" + item.title + "</a> : " + item.snippet + "</div>");
});
});
}
</script>
<form id="form1" runat="server">
<div style="border: 2px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 300px; border-radius: 25px; height: 60px; text-align: left;">
<b>Wikipedia API Search Using jQuery By http://fantasyaspnet.blogspot.in/</b><br />
(This Wikipedia API will give the search results and references more than one.)
</div>
<div style="padding-left: 75px; padding-top: 15px;">
<input id="searchterm" type="text" />
<input id="search" type="button" value="Search" onclick="searchdata();" />
</div>
<div> </div>
<div id="results" style="width: 300px; box-shadow: 10px 10px 5px #888888;">
</div>
</form>
</td>
</tr>
</tbody>
</table>
<br />
<br />
<b>
</b>
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"><br /></ins></b></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-49689014684148326272014-09-11T23:54:00.001-07:002014-09-12T00:09:04.363-07:00How to Call C# Method/Function Using jQuery Ajax<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Call C# Method/Function Using jQuery Ajax</b><br />
<br />
pageUrl = '<%= ResolveUrl("~/Default.aspx/jqueryAjaxCall") %>';<br />
<b> Default.aspx = Page Name and jqueryAjaxCall= c# method This is static web method.</b><br />
firstName = $("#<%= txtFirstName.ClientID %>").val(); <b>First Name parameters </b><br />
lastName = $("#<%= txtLastName.ClientID %>").val(); <b>Second Name parameters </b><br />
parameter = { "firstName": firstName, "lastName": lastName }<br />
<b>Json format here first name and last name will we pass as the parameters to my jqueryAjaxCall method</b><br />
<b><br /></b>
<b>.Aspx File</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<html xmlns="http://www.w3.org/1999/xhtml"><br />
<head runat="server"><br />
<title>Call C# method/function using JQuery Ajax</title><br />
<br />
<script src="Script/jquery-1.11.0.min.js" type="text/javascript"></script><br />
<br />
<script type="text/javascript" language="javascript"><br />
<br />
function JqueryAjaxCall() {<br />
var pageUrl = '<%= ResolveUrl("~/Default.aspx/jqueryAjaxCall") %>';<br />
var firstName = $("#<%= txtFirstName.ClientID %>").val();<br />
var lastName = $("#<%= txtLastName.ClientID %>").val();<br />
var parameter = { "firstName": firstName, "lastName": lastName }<br />
<br />
$.ajax({<br />
type: 'POST',<br />
url: pageUrl,<br />
data: JSON.stringify(parameter),<br />
contentType: 'application/json; charset=utf-8',<br />
dataType: 'json',<br />
success: function(data) {<br />
onSuccess(data);<br />
},<br />
error: function(data, success, error) {<br />
alert("Error : " + error);<br />
}<br />
});<br />
<br />
return false;<br />
}<br />
<br />
function onSuccess(data) {<br />
alert("welcome " + data.d + " to http://fantasyaspnet.blogspot.in/");<br />
}<br />
<br />
</script><br />
<br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<table cellpadding="3" cellspacing="0" style="width: 25%;"><br />
<tr><br />
<td><br />
First Name:<br />
</td><br />
<td><br />
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
Last Name:<br />
</td><br />
<td><br />
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
</td><br />
<td><br />
</td><br />
</tr><br />
<tr><br />
<td><br />
</td><br />
<td><br />
<asp:Button ID="btnSubmit" runat="server" OnClientClick="return JqueryAjaxCall();"<br />
Text="Submit" /><br />
</td><br />
</tr><br />
</table><br />
</div><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<b>C#</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>using System;<br />
using System.Collections.Generic;<br />
using System.Linq;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.Services;<br />
<br />
public partial class _Default : System.Web.UI.Page <br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
<br />
[WebMethod]<br />
public static string jqueryAjaxCall(string firstName, string lastName)<br />
{<br />
return firstName + " " + lastName;<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEho7j_G4qVTyoPdrtNexMPvPOJ4__K9rVkFir2p1UTNER_OU5-UtaL_sH5lw2KLwA0PfYtkarFtfI4lpzQwzOZXJYZ1lRpLdJmXMGW41LZVnpyUyRVFSd1sWNZNbPqOVchIrC9hR2Ddhko/s1600/How+to+Call+C%23+Method+Function+Using+jQuery+Ajax.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEho7j_G4qVTyoPdrtNexMPvPOJ4__K9rVkFir2p1UTNER_OU5-UtaL_sH5lw2KLwA0PfYtkarFtfI4lpzQwzOZXJYZ1lRpLdJmXMGW41LZVnpyUyRVFSd1sWNZNbPqOVchIrC9hR2Ddhko/s1600/How+to+Call+C%23+Method+Function+Using+jQuery+Ajax.PNG" height="315" width="640" /></a></div>
</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-76910822376922008662014-09-11T23:23:00.001-07:002014-09-11T23:26:21.824-07:00How to Print DIV Content with CSS using jQuery Print Plugin in JavaScript jQuery<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Print DIV Content with CSS using jQuery Print Plugin in JavaScript jQuery</b><br />
<br />
<b>.Aspx File</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html data-ng-app="myApp"><br /><head><br /> <title>demo</title><br /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br /><script type="text/javascript" src="https://googledrive.com/host/0Bw4NrxH2nTVqbmVOVkdOenhDU0U"></script><br /><script type="text/javascript"><br /> $(function () {<br /> $("#hrefPrint").click(function () {<br /> $("#printdiv").print();<br /> return (false);<br /> });<br /> });<br /></script><br /><style type="text/css"><br />body {<br />font-family: verdana ;<br />font-size: 14px ;<br />}<br />h1 {<br />font-size: 180% ;<br />}<br />h2 {<br />border-bottom: 1px solid #999999 ;<br />}<br />.printable {<br />border: 1px dotted #CCCCCC ;<br />padding: 10px 10px 10px 10px ;<br />}<br />img {<br />background-color: #E0E0E0 ;<br />border: 1px solid #666666 ;<br />padding: 5px 5px 5px 5px ;<br />}<br />a {<br />color: red ;<br />font-weight:bold;<br />}<br /></style><br /></head><br /><body><br /> <div><br /> <div id="printdiv" class="printable"><br /><h2><br />fantasyaspnet.blogspot.in<br />&nbsp;&nbsp;&nbsp;<a href="#" id="hrefPrint">Print DIV</a><br /></h2><br /><p><br />Welcome to fantasyaspnet.blogspot.in. It will provide many articles relating asp.net, c#, sql server, jquery, json etc...<br /></p><br /><p><br /></p><br /></div><br /> </div><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script>
<script type="text/javascript" src="https://googledrive.com/host/0Bw4NrxH2nTVqbmVOVkdOenhDU0U"></script>
<script type="text/javascript">
$(function () {
$("#hrefPrint").click(function () {
$("#printdiv").print();
return (false);
});
});
</script>
<style type="text/css">
body {
font-family: verdana ;
font-size: 14px ;
}
h1 {
font-size: 180% ;
}
h2 {
border-bottom: 1px solid #999999 ;
}
.printable {
border: 1px dotted #CCCCCC ;
padding: 10px 10px 10px 10px ;
}
img {
background-color: #E0E0E0 ;
border: 1px solid #666666 ;
padding: 5px 5px 5px 5px ;
}
a {
color: red ;
font-weight:bold;
}
</style>
<div>
<div id="printdiv" class="printable">
<h2>
fantasyaspnet.blogspot.in
<a href="#" id="hrefPrint">Print DIV</a>
</h2>
<p>
Welcome to fantasyaspnet.blogspot.in. It will provide many articles relating asp.net, c#, sql server, jquery, json etc...
</p>
<p>
</p>
</div>
</div>
</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-20720808072657524482014-03-14T23:46:00.001-07:002014-03-14T23:46:50.448-07:00How to Get All Files from Directory and Sub directories and Display it in Grid view C# <div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Get All Files from Directory and Sub directories and Display it in Grid view C# </b><br />
<br />
<b>C# Code:</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> protected void BindGridview()<br />
{<br />
string strpath = @"C:\personal\asp.net\";<br />
string[] folders = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories);<br />
gvDetails.DataSource = folders;<br />
gvDetails.DataBind();<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>VB Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> Protected Sub BindGridview()<br />
Dim strpath As String = "C:\personal\asp.net\"<br />
Dim folders As String() = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories)<br />
gvDetails.DataSource = folders<br />
gvDetails.DataBind()<br />
End Sub</td>
</tr>
</tbody>
</table>
<br />
<b>.Aspx Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>How to Get All Files from Folder and Subfolders & Display it in Gridview in C# asp.net</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<asp:Button ID="btnGetFiles" Text="Get Files From Folder & Sub Folders" runat="server" onclick="btnGetFiles_Click" /><br />
<asp:GridView ID="gvDetails" CellPadding="5" runat="server"><br />
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" /><br />
</asp:GridView><br />
</div><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<b>C# Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>using System;<br />
using System.IO;<br />
<br />
public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
protected void btnGetFiles_Click(object sender, EventArgs e)<br />
{<br />
BindGridview();<br />
}<br />
protected void BindGridview()<br />
{<br />
string strpath = @"C:\personal\asp.net\";<br />
string[] folders = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories);<br />
gvDetails.DataSource = folders;<br />
gvDetails.DataBind();<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>VB Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> Imports System.IO<br />
Partial Class VBCode<br />
Inherits System.Web.UI.Page<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)<br />
End Sub<br />
' insert files in folder<br />
Protected Sub btnGetFiles_Click(ByVal sender As Object, ByVal e As EventArgs)<br />
BindGridview()<br />
End Sub<br />
' Bind Data to Gridview<br />
Protected Sub BindGridview()<br />
Dim strpath As String = "C:\personal\asp.net\"<br />
Dim folders As String() = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories)<br />
gvDetails.DataSource = folders<br />
gvDetails.DataBind()<br />
End Sub<br />
End Class</td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOe_Oj1ZbkMbXLO0Yr_axLS0zHXPKwpHq3koh3q8hDqpY_5npAMZhybMd4yKBIkr00COqFlsegq6z7t14o7LQOQdZT47fCyb1hgsha2wofyjimzz7NtqvOZLcyNFSOL2xJefesHsEFxE/s1600/How+to+Get+All+Files+from+Folder+and+Subfolders+&+Display+it+in+Gridview+in+C%23++asp.net.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOe_Oj1ZbkMbXLO0Yr_axLS0zHXPKwpHq3koh3q8hDqpY_5npAMZhybMd4yKBIkr00COqFlsegq6z7t14o7LQOQdZT47fCyb1hgsha2wofyjimzz7NtqvOZLcyNFSOL2xJefesHsEFxE/s1600/How+to+Get+All+Files+from+Folder+and+Subfolders+&+Display+it+in+Gridview+in+C%23++asp.net.PNG" height="400" width="600" /></a></div>
</td>
</tr>
</tbody>
</table>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-33357854206870951412014-03-14T23:41:00.003-07:002014-03-14T23:44:00.553-07:00How to Get All Files from Folder and Subfolders & Display it in Gridview in C# asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Get All Files from Folder and Subfolders & Display it in Gridview in C# asp.net</b><br />
<br />
<b>C# Code:</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> protected void BindGridview()<br />
{<br />
string strpath = @"C:\personal\asp.net\";<br />
string[] folders = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories);<br />
gvDetails.DataSource = folders;<br />
gvDetails.DataBind();<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>VB Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> Protected Sub BindGridview()<br />
Dim strpath As String = "C:\personal\asp.net\"<br />
Dim folders As String() = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories)<br />
gvDetails.DataSource = folders<br />
gvDetails.DataBind()<br />
End Sub</td>
</tr>
</tbody>
</table>
<br />
<b>.Aspx Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>How to Get All Files from Folder and Subfolders & Display it in Gridview in C# asp.net</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<asp:Button ID="btnGetFiles" Text="Get Files From Folder & Sub Folders" runat="server" onclick="btnGetFiles_Click" /><br />
<asp:GridView ID="gvDetails" CellPadding="5" runat="server"><br />
<HeaderStyle BackColor="#df5015" Font-Bold="true" ForeColor="White" /><br />
</asp:GridView><br />
</div><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<b>C# Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>using System;<br />
using System.IO;<br />
<br />
public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
<br />
}<br />
protected void btnGetFiles_Click(object sender, EventArgs e)<br />
{<br />
BindGridview();<br />
}<br />
protected void BindGridview()<br />
{<br />
string strpath = @"C:\personal\asp.net\";<br />
string[] folders = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories);<br />
gvDetails.DataSource = folders;<br />
gvDetails.DataBind();<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>VB Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> Imports System.IO<br />
Partial Class VBCode<br />
Inherits System.Web.UI.Page<br />
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)<br />
End Sub<br />
' insert files in folder<br />
Protected Sub btnGetFiles_Click(ByVal sender As Object, ByVal e As EventArgs)<br />
BindGridview()<br />
End Sub<br />
' Bind Data to Gridview<br />
Protected Sub BindGridview()<br />
Dim strpath As String = "C:\personal\asp.net\"<br />
Dim folders As String() = Directory.GetFiles(strpath, "*", SearchOption.AllDirectories)<br />
gvDetails.DataSource = folders<br />
gvDetails.DataBind()<br />
End Sub<br />
End Class</td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOe_Oj1ZbkMbXLO0Yr_axLS0zHXPKwpHq3koh3q8hDqpY_5npAMZhybMd4yKBIkr00COqFlsegq6z7t14o7LQOQdZT47fCyb1hgsha2wofyjimzz7NtqvOZLcyNFSOL2xJefesHsEFxE/s1600/How+to+Get+All+Files+from+Folder+and+Subfolders+&+Display+it+in+Gridview+in+C%23++asp.net.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOe_Oj1ZbkMbXLO0Yr_axLS0zHXPKwpHq3koh3q8hDqpY_5npAMZhybMd4yKBIkr00COqFlsegq6z7t14o7LQOQdZT47fCyb1hgsha2wofyjimzz7NtqvOZLcyNFSOL2xJefesHsEFxE/s1600/How+to+Get+All+Files+from+Folder+and+Subfolders+&+Display+it+in+Gridview+in+C%23++asp.net.PNG" height="400" width="600" /></a></div>
</td>
</tr>
</tbody>
</table>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-27284778195251398832014-03-14T23:20:00.002-07:002014-03-14T23:20:27.469-07:00How to Convert 12 Hour AM/PM Time to 24 Hours Time Format JavaScript<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Convert 12 Hour AM/PM Time to 24 Hours Time Format JavaScript</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><title>JavaScript Convert AM/PM to 24 Hours Time</title><br /><script type="text/javascript"><br />function Converttimeformat() {<br />// var time = $("#starttime").val();<br />var time = document.getElementById('txttime').value;<br />var hrs = Number(time.match(/^(\d+)/)[1]);<br />var mnts = Number(time.match(/:(\d+)/)[1]);<br />var format = time.match(/\s(.*)$/)[1];<br />if (format == "PM" && hrs < 12) hrs = hrs + 12;<br />if (format == "AM" && hrs == 12) hrs = hrs - 12;<br />var hours = hrs.toString();<br />var minutes = mnts.toString();<br />if (hrs < 10) hours = "0" + hours;<br />if (mnts < 10) minutes = "0" + minutes;<br />alert(hours + ":" + minutes);<br />}<br /></script><br /></head><br /><body><br /><div><br /><table><br /><tr><br /><td><b>Enter Time:</b></td><br /><td><input type="text" id="txttime" value="10:00 PM" /></td><br /></tr><br /><tr><br /><td></td><br /><td><input type="button" id="btnConvert" value="Convert to AM/PM" onclick="Converttimeformat()" /></td><br /></tr><br /></table><br /></div><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<div>
<table>
<tbody>
<tr>
<td>
<div>
<script type="text/javascript">
$(function () {
$('#btnConvert').click(function () {
var time = $("#txttime").val();
var hrs = Number(time.match(/^(\d+)/)[1]);
var mnts = Number(time.match(/:(\d+)/)[1]);
var format = time.match(/\s(.*)$/)[1];
if (format == "PM" && hrs < 12) hrs = hrs + 12;
if (format == "AM" && hrs == 12) hrs = hrs - 12;
var hours = hrs.toString();
var minutes = mnts.toString();
if (hrs < 10) hours = "0" + hours;
if (mnts < 10) minutes = "0" + minutes;
alert(hours + ":" + minutes);
})
})
</script>
<table>
<tr>
<td><b>Enter Time:</b></td>
<td>
<input type="text" id="txttime" value="10:00 PM" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="button" id="btnConvert" value="Convert to AM/PM" /></td>
</tr>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-50393188394991958562014-03-14T23:10:00.003-07:002014-03-14T23:15:04.434-07:00How to Convert AM PM Time to 24 Hour Time jQuery<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Convert AM PM Time to 24 Hour Time jQuery</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /> <title>jQuery Convert AM / PM time to 24 hours time</title><br /> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br /> <script type="text/javascript"><br /> $(function () {<br /> $('#btnConvert').click(function () {<br /> var time = $("#txttime").val();<br /> var hrs = Number(time.match(/^(\d+)/)[1]);<br /> var mnts = Number(time.match(/:(\d+)/)[1]);<br /> var format = time.match(/\s(.*)$/)[1];<br /> if (format == "PM" && hrs < 12) hrs = hrs + 12;<br /> if (format == "AM" && hrs == 12) hrs = hrs - 12;<br /> var hours = hrs.toString();<br /> var minutes = mnts.toString();<br /> if (hrs < 10) hours = "0" + hours;<br /> if (mnts < 10) minutes = "0" + minutes;<br /> alert(hours + ":" + minutes);<br /> })<br /> })<br /> </script><br /></head><br /><body><br /> <table><br /> <tr><br /> <td><b>Enter Time:</b></td><br /> <td><br /> <input type="text" id="txttime" value="12:00 PM" /></td><br /> </tr><br /> <tr><br /> <td></td><br /> <td><br /> <input type="button" id="btnConvert" value="Convert to AM/PM" /></td><br /> </tr><br /> </table><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><table>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<div>
<table>
<tbody>
<tr>
<td>
<div>
<script type="text/javascript">
$(function () {
$('#btnConvert').click(function () {
var time = $("#txttime").val();
var hrs = Number(time.match(/^(\d+)/)[1]);
var mnts = Number(time.match(/:(\d+)/)[1]);
var format = time.match(/\s(.*)$/)[1];
if (format == "PM" && hrs < 12) hrs = hrs + 12;
if (format == "AM" && hrs == 12) hrs = hrs - 12;
var hours = hrs.toString();
var minutes = mnts.toString();
if (hrs < 10) hours = "0" + hours;
if (mnts < 10) minutes = "0" + minutes;
alert(hours + ":" + minutes);
})
})
</script>
<table>
<tr>
<td><b>Enter Time:</b></td>
<td>
<input type="text" id="txttime" value="10:00 PM" /></td>
</tr>
<tr>
<td></td>
<td>
<input type="button" id="btnConvert" value="Convert to AM/PM" /></td>
</tr>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-11634571863239151092014-03-14T21:48:00.004-07:002014-03-14T22:09:12.451-07:00How to Check Given Date Greater than Current Date or Today Date JavaScript JQuery <div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Check Given Date Greater than Current Date or Today Date JavaScript JQuery </b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>How to Check Given Date Greater than Current Date or Today Date JavaScript JQuery </title><br />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br />
<script type="text/javascript"><br />
$(function () {<br />
$('#btnConvert').click(function () {<br />
var param1 = new Date();<br />
var ddate = $('#txtdate').val();<br />
var time = $('#txttime').val();<br />
var hours = Number(time.match(/^(\d+)/)[1]);<br />
var minutes = Number(time.match(/:(\d+)/)[1]);<br />
var format = time.match(/\s(.*)$/)[1];<br />
if (format == "PM" && hours < 12) hours = hours + 12;<br />
if (format == "AM" && hours == 12) hours = hours - 12;<br />
var sHours = hours.toString();<br />
var sMinutes = minutes.toString();<br />
if (hours < 10) sHours = "0" + sHours;<br />
if (minutes < 10) sMinutes = "0" + sMinutes;<br />
ddate = ddate + " " + sHours + ":" + sMinutes + ":00";<br />
var date1 = new Date(ddate);<br />
var date2 = new Date();<br />
if (date1 < date2) {<br />
alert('Please Enter Date time Greater than Current Date time');<br />
$('#txtdate').focus();<br />
return false;<br />
}<br />
})<br />
})<br />
</script><br />
</head><br />
<body><br />
<table><br />
<tr><br />
<td><b>Enter Date:</b></td><br />
<td><input type="text" id="txtdate" value="08/27/2013" /></td><br />
</tr><br />
<tr><br />
<td><b>Enter Time:</b></td><br />
<td><input type="text" id="txttime" value="10:00 PM" /></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td><input type="button" id="btnConvert" value="Convert to AM/PM" /></td><br />
</tr><br />
</table><br />
</body><br />
</html> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>jQuery Check Given Date Time Greater than Current Date time in JavaScript</title><br />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br />
<script type="text/javascript"><br />
$(function () {<br />
$('#btnConvert').click(function () {<br />
var param1 = new Date();<br />
var ddate = $('#txtdate').val();<br />
var time = $('#txttime').val();<br />
var hours = Number(time.match(/^(\d+)/)[1]);<br />
var minutes = Number(time.match(/:(\d+)/)[1]);<br />
var format = time.match(/\s(.*)$/)[1];<br />
if (format == "PM" && hours < 12) hours = hours + 12;<br />
if (format == "AM" && hours == 12) hours = hours - 12;<br />
var sHours = hours.toString();<br />
var sMinutes = minutes.toString();<br />
if (hours < 10) sHours = "0" + sHours;<br />
if (minutes < 10) sMinutes = "0" + sMinutes;<br />
ddate = ddate + " " + sHours + ":" + sMinutes + ":00";<br />
var date1 = new Date(ddate);<br />
var date2 = new Date();<br />
if (date1 < date2) {<br />
alert('Please Enter Date time Greater than Current Date time');<br />
$('#txtdate').focus();<br />
return false;<br />
}<br />
})<br />
})<br />
</script><br />
</head><br />
<body><br />
<table><br />
<tr><br />
<td><b>Enter Date:</b></td><br />
<td><input type="text" id="Text1" value="03/15/2013" /></td><br />
</tr><br />
<tr><br />
<td><b>Enter Time:</b></td><br />
<td><input type="text" id="Text2" value="10:00 PM" /></td><br />
</tr><br />
<tr><br />
<td></td><br />
<td><input type="button" id="Button1" value="Convert to AM/PM" /></td><br />
</tr><br />
</table><br />
</body><br />
</html</td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<tbody>
<tr>
<td>
<table>
<tbody>
<tr>
<td>
<script type="text/javascript">
$(function () {
$('#btnConvert').click(function () {
var param1 = new Date();
var ddate = $('#txtdate').val();
var time = $('#txttime').val();
var hours = Number(time.match(/^(\d+)/)[1]);
var minutes = Number(time.match(/:(\d+)/)[1]);
var format = time.match(/\s(.*)$/)[1];
if (format == "PM" && hours < 12) hours = hours + 12;
if (format == "AM" && hours == 12) hours = hours - 12;
var sHours = hours.toString();
var sMinutes = minutes.toString();
if (hours < 10) sHours = "0" + sHours;
if (minutes < 10) sMinutes = "0" + sMinutes;
ddate = ddate + " " + sHours + ":" + sMinutes + ":00";
var date1 = new Date(ddate);
var date2 = new Date();
if (date1 < date2) {
alert('Please Enter Date time Greater than Current Date time');
$('#txtdate').focus();
return false;
}
else {
alert('Given Date Time Greater Than Current Date time')
}
})
})
</script>
<table>
<tbody>
<tr>
<td><b>Enter Date:</b></td>
<td>
<input id="txtdate" type="text" value="08/27/2013" /></td>
</tr>
<tr>
<td><b>Enter Time:</b></td>
<td>
<input id="txttime" type="text" value="10:00 PM" /></td>
</tr>
<tr>
<td></td>
<td>
<input id="btnConvert" type="button" value="Convert to AM/PM" /></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</td></tr>
</tbody></table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-61633872787763026062014-03-01T03:49:00.002-08:002014-03-01T03:56:37.785-08:00How To Validate Email with Regular Expression C#<div dir="ltr" style="text-align: left;" trbidi="on">
<span id="goog_937844842"></span><span id="goog_937844843"></span><b>Email Validation with Regular Expression C#</b><br />
<br />
<b>Below is the Regular Expression to Validate Email Address </b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>bool isEmail = Regex.IsMatch(txtEmail.Text.Trim(), @"\A(?:[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?)\Z");</td>
</tr>
</tbody>
</table>
<br />
<b>Sample Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>Regular Expression to validate Email Address</title><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<table><br />
<tr><br />
<td><b>Enter Email:</b></td><br />
<td><br />
<asp:TextBox ID="txtEmail" runat="server" /><br />
</td><br />
</tr><br />
<tr><br />
<td></td><br />
<td><asp:Button ID="btnValidate" runat="server" Text="Validate Email"<br />
onclick="btnValidate_Click" /> </td><br />
</tr><br />
</table><br />
<asp:label id="lblerrormsg" runat="server" style=" font-weight:bold; " /><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br/>
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3S1Xuta_r5dYURUAtulpSgbHaTZYeEZvc5xn1aH8rW4rlrl131rQBLiZe1Cm4P6mFO-LtwPSJQK_VHXqWH0cKoEbldCutjTFzI6UMJ5WAe3XP0nj3Xcdp7gQGyZkFZDOXG1LF_Ph7BxE/s1600/How+To+Validate+Email+with+Regular+Expression+C%23.gif" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi3S1Xuta_r5dYURUAtulpSgbHaTZYeEZvc5xn1aH8rW4rlrl131rQBLiZe1Cm4P6mFO-LtwPSJQK_VHXqWH0cKoEbldCutjTFzI6UMJ5WAe3XP0nj3Xcdp7gQGyZkFZDOXG1LF_Ph7BxE/s6400/How+To+Validate+Email+with+Regular+Expression+C%23.gif" /></a></div>
<br/></td>
</tr>
</tbody>
</table>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-26408319921505635062014-03-01T03:34:00.001-08:002014-03-01T03:35:33.596-08:00How To Date Greater than From Date in JavaScript C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How To Date Greater than From Date in JavaScript C#</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><a href="http://fantasyaspnet.blogspot.in/2013/04/jquery-datepicker-example-or-jquery.html" target="_blank">http://fantasyaspnet.blogspot.in/2013/04/jquery-datepicker-example-or-jquery.html</a></td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-60227511853820011852014-03-01T00:03:00.001-08:002014-03-01T03:29:51.246-08:00How To Hide DIV Elements After 5 Seconds or Some Time Delay Using jQuery in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How To Hide DIV Elements After 5 Seconds or Some Time Delay Using jQuery in C#</b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>jQuery Hide DIV Elements after 10 seconds</title><br />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br />
<script type="text/javascript"><br />
$(function () {<br />
setTimeout(function () { $("#testdiv").fadeOut(1500); }, 5000)<br />
$('#btnclick').click(function () {<br />
$('#testdiv').show();<br />
setTimeout(function () { $("#testdiv").fadeOut(1500); }, 5000)<br />
})<br />
})<br />
</script><br />
<style type="text/css"><br />
.content<br />
{<br />
border: 2px solid Red;<br />
color: #008000;<br />
padding: 10px;<br />
width: 400px;<br />
font-family:Calibri;<br />
font-size:16pt<br />
}<br />
</style><br />
</head><br />
<body><br />
<input type="button" id="btnclick" value="Show DIV" /><br />
<div class="content" id="testdiv" class=""><br />
Hi, Welcome to http://fantasyaspnet.blogspot.com<br />
It will disappear in 5 seconds!<br />
</div><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
<script type="text/javascript">
$(function () {
setTimeout(function () { $("#testdiv").fadeOut(1500); }, 5000)
$('#btnclick').click(function () {
$('#testdiv').show();
setTimeout(function () { $("#testdiv").fadeOut(1500); }, 5000)
})
})
</script>
<style type="text/css">
.content1 {
border: 2px solid Red;
color: #008000;
padding: 10px;
width: 400px;
font-family: Calibri;
font-size: 16pt;
}
</style><input id="btnclick" type="button" value="Show DIV" />
<br />
<div class="content1" id="testdiv">
Hi, Welcome to http://fantasyaspnet.blogspot.com
It will disappear in 5 seconds!
</div>
</td></tr>
</tbody></table>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-57801348220500303282014-02-28T23:55:00.002-08:002014-02-28T23:55:49.360-08:00How to setTimeout Function Example JavaScript c#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to setTimeout Function Example JavaScript c#</b><br />
<br />
<b>Method 1:</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> setTimeout(yourfunction(), timeinterval);<br />
<br />
function yourfunction() {<br />
// your code here<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Method 2:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> setTimeout(function(){// your code here<br />
}, timeinterval);</td>
</tr>
</tbody>
</table>
<br />
<b>Sample Code:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><title>JavaScript display current time on webpage</title><br /><script type="text/javascript"><br /> function ShowCurrentTime() {<br /> var dt = new Date();<br /> document.getElementById("lblTime").innerHTML = dt.toLocaleTimeString();<br /> setTimeout("ShowCurrentTime()", 1000); // Here 1000(milliseconds) means one 1 Sec<br /> }<br /></script><br /></head><br /><body onload="ShowCurrentTime()"><br /><div><br />JavaScript Display current time second by second:<br /><label id="lblTime" style=" font-weight:bold"></label><br /></div><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<b>Live Demo</b>:<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><head>
<title>JavaScript display current time on webpage</title>
<script type="text/javascript">
function ShowCurrentTime() {
var dt = new Date();
document.getElementById("lblTime").innerHTML = dt.toLocaleTimeString();
setTimeout("ShowCurrentTime()", 1000); // Here 1000(milliseconds) means one 1 Sec
}
</script>
</head>
<body onload="ShowCurrentTime()">
<div>
JavaScript Display current time second by second:
<label id="lblTime" style="font-weight: bold;"></label>
</div>
</body></td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-47430150673167630872014-02-27T00:41:00.000-08:002014-02-27T00:42:35.879-08:00How to Get Query String Parameter Values with Spaces in C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Get Query String Parameter Values with Spaces in C#</b><br />
<br />
we have to use <b>decodeURIComponent</b> JavaScript function in our code.<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <script type="text/javascript"><br />
$(function () {<br />
var str = decodeURIComponent('Welcome%20To%20http%3A%2f%2ffantasyaspnet.blogspot.in%2f')<br />
alert(str);<br />
})<br />
</script></td>
</tr>
</tbody>
</table>
<br />
<b>Example:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>How to Get Query String Parameter Values with Spaces in C#</title><br />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br />
<script type="text/javascript"><br />
$(function () {<br />
var name = GetParameterValues('username');<br />
var id = GetParameterValues('name');<br />
$('#spn_UserName').html('<strong>' + name + '</strong>');<br />
$('#spn_UserId').html('<strong>' + id + '</strong>');<br />
});<br />
function GetParameterValues(param) {<br />
var url = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');<br />
for (var i = 0; i < url.length; i++) {<br />
var urlparam = url[i].split('=');<br />
if (urlparam[0] == param) {<br />
return decodeURIComponent(urlparam[1]);<br />
}<br />
}<br />
}<br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<p>UserName: <span id="spn_UserName"></span></p><br />
<p>Name: <span id="spn_UserId"></span></p><br />
</div><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<b>Demo: </b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwUazxk-nofw-TqSR7sGP1S0WyIP4yF3idMKQ39-lXuq0JzhX_sDQrBzITRDcqtZNeXciod6FVudReTPave6T-qg-omI12CHCYqsx8p3zPpfdDSIdCtT1biymTLVSUdEpRSCKfnTqEfsE/s1600/How+to+Get+Query+String+Parameter+Values+with+Spaces+in+C%23..PNG" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwUazxk-nofw-TqSR7sGP1S0WyIP4yF3idMKQ39-lXuq0JzhX_sDQrBzITRDcqtZNeXciod6FVudReTPave6T-qg-omI12CHCYqsx8p3zPpfdDSIdCtT1biymTLVSUdEpRSCKfnTqEfsE/s3200/How+to+Get+Query+String+Parameter+Values+with+Spaces+in+C%23..PNG" height="76" width="400" /></a></td>
</tr>
</tbody>
</table>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-57194484097784485382014-02-27T00:24:00.002-08:002014-02-27T00:24:51.621-08:00Using Statement Example OR Uses of Using Statement in C# <div dir="ltr" style="text-align: left;" trbidi="on">
<b>Using Statement Example OR Uses of Using Statement in C#</b><br />
<b> </b>
<br />
If we use <b>using statement</b> in our applications it will automatically create <b>try / finally</b> blocks for the objects and automatically runs <b>Dispose()</b> method for us no need to create any <b>try/finally</b> block and no need to run any Dispose() method.<br />
<br />
<b>C#</b><br />
<b> </b> <br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using (SqlConnection con = new SqlConnection(connectionString))<br />{<br />using (SqlCommand cmd = new SqlCommand (commandString, con))<br />{<br />con.Open();<br />cmd.ExecuteNonQuery();<br />}<br />}</td>
</tr>
</tbody>
</table>
<br />
<b>VB</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>Using con As New SqlConnection(connectionString)<br />Using cmd As New SqlCommand(commandString, con)<br />con.Open()<br />cmd.ExecuteNonQuery()<br />End Using<br />End Using</td>
</tr>
</tbody>
</table>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-16848975185905914292014-02-27T00:17:00.003-08:002014-02-27T00:17:52.767-08:00Add/Copy Rows from One Datatable to Another Datatable C#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Add/Copy Rows from One Datatable to Another Datatable C#</b><br />
<br />
<b>C# </b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>DataTable _dt=new DataTable();<br />_dt = _ds.Tables[0];<br />DataTable dt1 = ds1.Tables[0];<br />for (int i = 0; i < dt1.Rows.Count; i++)<br />{<br />_dt.ImportRow(dt1.Rows[i]);<br />}</td>
</tr>
</tbody>
</table>
<br />
<b>VB</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>Dim _dt As New DataTable()<br />_dt = _ds.Tables(0)<br />Dim dt1 As DataTable = ds1.Tables(0)<br />For i As Integer = 0 To dt1.Rows.Count - 1<br />_dt.ImportRow(dt1.Rows(i))<br />Next</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-82428333511184112182014-02-27T00:15:00.000-08:002014-02-27T00:15:12.696-08:00Difference between View and Stored Procedure <div dir="ltr" style="text-align: left;" trbidi="on">
<b>Difference between View and Stored Procedure </b><br />
<br />
<b>View </b>in SQL Server<br />
<br />
A view represents a virtual table. By using view we can join multiple tables and present the data as coming from a single table.<br />
<br />
For example consider we have two tables<br />
<br />
1) <b>UserInformation </b>table with columns userid, username<br />
2) <b>SalaryInformation </b>table with columns salid, userid, salary<br />
<br />
Create VIEW by joining above two tables<b> </b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>CREATE VIEW VW_UserInfo<br />
AS<br />
BEGIN<br />
SELECT a.userid,a.username,b.salary from UserInformation a INNER JOIN SalaryInformation b ON a.userid=b.userid<br />
END</td>
</tr>
</tbody>
</table>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> CREATE PROCEDURE GetUserInfo<br />
@uid INT<br />
AS<br />
BEGIN<br />
SELECT username from VW_UserInfo WHERE userid=@uid<br />
END</td>
</tr>
</tbody>
</table>
<br />
<b>Stored Procedure</b><br />
<br />
A stored procedure is a group of sql statements that has been created and stored in the database. Stored procedure will accept input parameters so that a single procedure can be used over the network by several clients using different input data. Stored procedure will reduce network traffic and increase the performance. If we modify stored procedure all the clients will get the updated stored procedure<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> USE AdventureWorks2008R2;<br />GO<br />CREATE PROCEDURE dbo.sp_who<br />AS<br /> SELECT FirstName, LastName FROM Person.Person;<br />GO<br />EXEC sp_who;<br />EXEC dbo.sp_who;<br />GO<br />DROP PROCEDURE dbo.sp_who;<br />GO</td>
</tr>
</tbody>
</table>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-60268469464627402102014-02-26T23:50:00.002-08:002014-02-26T23:50:18.227-08:00How to use Wiki Plugin to Show Wikipedia Description in Tooltips Using Jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to use Wiki Plugin to Show Wikipedia Description in Tooltips Using Jquery</b><br />
<br />
<b>.Aspx Page </b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>jQuery plugin to show wikipedia description in tooltips</title><br />
<link href="wikiUp.css" rel="stylesheet" type="text/css" /><br />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script><br />
<script src="wikiUp.js" type="text/javascript"></script><br />
</head><br />
<body><br />
<data data-wiki="Apple Inc."><b>Apple</b></data> was founded by <data data-wiki="Steve Jobs"><b>Steve Jobs</b></data>.<br />
<data data-wiki="Madrid" data-lang="es"><b>Madrid</b></data> es la capital de España.<br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
We have to add files “<b>wikiUp.css</b>” and “<b>wikiUp.js</b>” in our aspx file.You can download from <a href="http://pmtarantino.github.io/wikiUp/" target="_blank">hear</a><br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZSuAFuHB0kQQBRRM7NJQ2ZmXWVNiIr61jTt8pdxOmBior37JwSz_pI9p2TFYYvoU6p4U_W8tOPgB1YYTpkiPSeqswd-1ipK8u6QE9mO_VpE5ROFoCSK3EvYk1ENFnpHfAdfAASsMMvUc/s1600/How+to+use+Wiki+Plugin+to+Show+Wikipedia+Description+in+Tooltips+Using+Jquery.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiZSuAFuHB0kQQBRRM7NJQ2ZmXWVNiIr61jTt8pdxOmBior37JwSz_pI9p2TFYYvoU6p4U_W8tOPgB1YYTpkiPSeqswd-1ipK8u6QE9mO_VpE5ROFoCSK3EvYk1ENFnpHfAdfAASsMMvUc/s3600/How+to+use+Wiki+Plugin+to+Show+Wikipedia+Description+in+Tooltips+Using+Jquery.gif" height="205" width="400" /></a></div>
<br /></td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-58747982410829995052014-02-26T04:07:00.002-08:002014-02-26T04:07:33.184-08:00What is Delegates in C# Example | Use of Delegates in C# <div dir="ltr" style="text-align: left;" trbidi="on">
<b>What is Delegates in C# Example | Use of Delegates in C# </b><br />
<br />
In Simple Language A delegate is an object that can refer to a method. Thus, when you create a delegate, you are creating an object that can hold a reference to a method.<br />
<br />
<b>Syntax of Delegate & Methods Declaration</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> public delegate int Delegatmethod(int a,int b);<br />
<br />
public class Sampleclass<br />
{<br />
public int Add(int x, int y)<br />
{<br />
return x + y;<br />
}<br />
public int Sub(int x, int y)<br />
{<br />
return x + y;<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Example:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> public delegate int DelegatSample(int a,int b);<br />
public class Sampleclass<br />
{<br />
public int Add(int x, int y)<br />
{<br />
return x + y;<br />
}<br />
public int Sub(int x, int y)<br />
{<br />
return x - y;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Sampleclass sc=new Sampleclass();<br />
<br />
DelegatSample delgate1 = sc.Add;<br />
int i = delgate1(10, 20);<br />
Console.WriteLine(i);<br />
DelegatSample delgate2 = sc.Sub;<br />
int j = delgate2(20, 10);<br />
Console.WriteLine(j);<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><b><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";"> Add Result : 30<br />Sub Result : 10</span></b></td>
</tr>
</tbody>
</table>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Delegates
are two types </span></div>
<div class="MsoListParagraphCxSpFirst" style="margin-bottom: 0.0001pt; text-indent: -0.25in;">
<ul style="text-align: left;">
<li>
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: Verdana; mso-fareast-font-family: Verdana;"> </span><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Single Cast Delegates</span></li>
</ul>
</div>
<ul style="text-align: left;">
<li><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Multi Cast Delegates</span></li>
</ul>
<b>Syntax of Multicast Delegate & Method Declaration</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><b><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";"> </span></b>public delegate void MultiDelegate(int a,int b);<br />
public class Sampleclass<br />
{<br />
public static void Add(int x, int y)<br />
{<br />
Console.WriteLine("Addition Value: "+(x + y));<br />
}<br />
public static void Sub(int x, int y)<br />
{<br />
Console.WriteLine("Subtraction Value: " + (x - y));<br />
}<br />
public static void Mul(int x, int y)<br />
{<br />
Console.WriteLine("Multiply Value: " + (x * y));<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Example</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> public delegate void MultiDelegate(int a,int b);<br />public class Sampleclass<br />{<br />public static void Add(int x, int y)<br />{<br />Console.WriteLine("Addition Value: "+(x + y));<br />}<br />public static void Sub(int x, int y)<br />{<br />Console.WriteLine("Subtraction Value: " + (x - y));<br />}<br />public static void Mul(int x, int y)<br />{<br />Console.WriteLine("Multiply Value: " + (x * y));<br />}<br />}<br />class Program<br />{<br />static void Main(string[] args)<br />{<br />Sampleclass sc=new Sampleclass();<br />MultiDelegate del = Sampleclass.Add;<br />del += Sampleclass.Sub;<br />del += Sampleclass.Mul;<br />del(10, 5);<br />Console.ReadLine();<br />}<br />}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><b>Addition Value : 15<br />Subtraction Value : 5<br />Multiply Value : 50</b></td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-24771918720367716672014-02-26T03:56:00.004-08:002014-02-26T03:56:58.360-08:00Output Console Window Closing Automatically without Showing Output in c#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Output Console Window Closing Automatically without Showing Output c#</b><br />
<br />
<b> </b>we just need to add Console.ReadLine()at the end of your code.Below is the example<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> class Program<br />{<br />static void Main(string[] args)<br />{<br />Console.WriteLine("Welcome to http://fantasyaspnet.blogspot.in/");<br />Console.ReadLine();<br />}<br />}</td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-58493906434292447292014-02-26T03:51:00.003-08:002014-02-26T03:52:52.083-08:00Difference between Virtual Override New Keywords with Example c#<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Difference between Virtual Override New Keywords with Example c#</b><br />
<br />
Generally virtual and override keywords will occur in overriding method of polymorphism concept and new keyword will be used to hide the method. Here I will explain these keywords with example for that check below code.
I have one method Show() which exists in two classes SampleA and SampleB as shown below<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
class SampleA<br />
{<br />
public void Show()<br />
{<br />
Console.WriteLine("Sample A Test Method");<br />
}<br />
}<br />
class SampleB:SampleA<br />
{<br />
public void Show()<br />
{<br />
Console.WriteLine("Sample B Test Method");<br />
}<br />
}<br />
<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
SampleA a=new SampleA();<br />
SampleB b=new SampleB();<br />
a.Show();<br />
b.Show();<br />
a = new SampleB();<br />
a.Show();<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<b><br /></b>
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
A Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
B Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
A Test Method</span></div>
</td>
</tr>
</tbody>
</table>
<br />
<b>New Keyword Example or Method Hiding</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
class SampleA<br />
{<br />
public void Show()<br />
{<br />
Console.WriteLine("Sample A Test Method");<br />
}<br />
}<br />
class SampleB:SampleA<br />
{<br />
public new void Show()<br />
{<br />
Console.WriteLine("Sample B Test Method");<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
SampleA a=new SampleA();<br />
SampleB b=new SampleB();<br />
a.Show();<br />
b.Show();<br />
a = new SampleB();<br />
a.Show();<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<b><br />Virtual and Override Keywords Example or Method Overriding:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>using System;<br />
namespace ConsoleApplication3<br />
{<br />
class SampleA<br />
{<br />
public virtual void Show()<br />
{<br />
Console.WriteLine("Sample A Test Method");<br />
}<br />
}<br />
class SampleB:SampleA<br />
{<br />
public override void Show()<br />
{<br />
Console.WriteLine("Sample B Test Method");<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
SampleA a=new SampleA();<br />
SampleB b=new SampleB();<br />
a.Show();<br />
b.Show();<br />
a = new SampleB();<br />
a.Show();<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
A Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
B Test Method</span></div>
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
B Test Method</span></td>
</tr>
</tbody>
</table>
<br />
<b>Use Both Method Overriding & Method Hiding:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
class SampleA<br />
{<br />
public void Show()<br />
{<br />
Console.WriteLine("Sample A Test Method");<br />
}<br />
}<br />
class SampleB:SampleA<br />
{<br />
public new virtual void Show()<br />
{<br />
Console.WriteLine("Sample B Test Method");<br />
}<br />
}<br />
class SampleC : SampleB<br />
{<br />
public override void Show()<br />
{<br />
Console.WriteLine("Sample C Test Method");<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
SampleA a=new SampleA();<br />
SampleB b=new SampleB();<br />
SampleB c = new SampleC();<br />
a.Show();<br />
b.Show();<br />
c.Show();<br />
a = new SampleB();<br />
a.Show();<br />
b = new SampleC();<br />
b.Show();<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
A Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
B Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
C Test Method</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
A Test Method</span></div>
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
C Test Method</span><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";"></span></td>
</tr>
</tbody>
</table>
<br />
<b>
</b>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-48876806472654113732014-02-26T03:42:00.005-08:002014-02-26T03:42:57.275-08:00How to Select Deselect All Check boxes with Name Using jquery in c#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Select Deselect All Check boxes with Name Using jquery in c#</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br /><head><br /><title>jQuery Select Deselect all Checkboxes</title><br /><script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script><br /><script type="text/javascript"><br /> $(function () {<br /> $('input[name="chkUser"]').click(function () {<br /> if ($('input[name="chkUser"]').length == $('input[name="chkUser"]:checked').length) {<br /> $('input:checkbox[name="chkAll"]').attr("checked", "checked");<br /> }<br /> else {<br /> $('input:checkbox[name="chkAll"]').removeAttr("checked");<br /> }<br /> });<br /> $('input:checkbox[name="chkAll"]').click(function () {<br /> var slvals = []<br /> if ($(this).is(':checked')) {<br /> $('input[name="chkUser"]').attr("checked", true);<br /> }<br /> else {<br /> $('input[name="chkUser"]').attr("checked", false);<br /> slvals = null;<br /> }<br /> });<br /> })<br /></script><br /><style type="text/css"><br />li<br />{<br />list-style-type:none;<br />}<br /></style></head><br /><body><br /><ul><br /><li><label><input type="checkbox" name="chkAll" value="All"/><br />Select All<br /></label></li><br /><li><label><input type="checkbox" name="chkUser" value="3930"/>sizar</label></li><br /><li><label><input type="checkbox" name="chkUser" value="4049"/>sahil</label></li><br /><li><label><input type="checkbox" name="chkUser" value="4076"/>salim</label></li><br /><li><label><input type="checkbox" name="chkUser" value="4086"/>rameez</label></li><br /><li><label><input type="checkbox" name="chkUser" value="4087"/>nasir</label></li><br /><li><label><input type="checkbox" name="chkUser" value="4116"/>karim</label></li><br /><br /></ul><br /></body><br /></html></td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsIjRZgKk-oYtXb2F3-HD2sAIc2D64gMGY-0sDFneeJEcHrj7Y56kGEKDrejKbBm-bGbNXkBs_YNedmcAUHOadVEAXri7WE4QJPhfeJ9nyeNnjIMOcI0eOB8E6b5ZC_1adpgQFAehIug/s1600/Unchecked+All+Check+boxes+with+Header+in+using+jQuery.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiCsIjRZgKk-oYtXb2F3-HD2sAIc2D64gMGY-0sDFneeJEcHrj7Y56kGEKDrejKbBm-bGbNXkBs_YNedmcAUHOadVEAXri7WE4QJPhfeJ9nyeNnjIMOcI0eOB8E6b5ZC_1adpgQFAehIug/s1600/Unchecked+All+Check+boxes+with+Header+in+using+jQuery.PNG" height="320" width="312" /></a></div>
<br /></td>
</tr>
</tbody>
</table>
<br />
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script></div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-20807715142837452082014-02-26T03:38:00.000-08:002014-02-26T03:38:05.163-08:00How to Check Unchecked All Check boxes with Header in using jQuery c#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Check Unchecked All Check boxes with Header in using jQuery c#</b><br />
<br />
<b>.Aspx:</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br />
<head><br />
<title>jQuery Check uncheck all Checkboxes</title><br />
<script src="http://code.jquery.com/jquery-1.8.2.js" type="text/javascript"></script><br />
<script type="text/javascript"><br />
$(function () {<br />
$('input[name="chkUser"]').click(function () {<br />
if ($('input[name="chkUser"]').length == $('input[name="chkUser"]:checked').length) {<br />
$('input:checkbox[name="chkAll"]').attr("checked", "checked");<br />
}<br />
else {<br />
$('input:checkbox[name="chkAll"]').removeAttr("checked");<br />
}<br />
});<br />
$('input:checkbox[name="chkAll"]').click(function () {<br />
var slvals = []<br />
if ($(this).is(':checked')) {<br />
$('input[name="chkUser"]').attr("checked", true);<br />
}<br />
else {<br />
$('input[name="chkUser"]').attr("checked", false);<br />
slvals = null;<br />
}<br />
});<br />
})<br />
</script><br />
<style type="text/css"><br />
li<br />
{<br />
list-style-type:none;<br />
}<br />
</style></head><br />
<body><br />
<ul><br />
<li><label><input type="checkbox" name="chkAll" value="All"/><br />
Select All<br />
</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="3930"/>sizar</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="4049"/>sahil</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="4076"/>salim</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="4086"/>rameez</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="4087"/>nasir</label></li><br />
<li><label><input type="checkbox" name="chkUser" value="4116"/>karim</label></li><br />
</ul><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<b> </b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_mr8uTi07SgOS-wQuJ0_ZnELCgXNhnzL-jiGI6ah9YSrCSTk26R1sAXtwYRl4WMqHELChgi8s2jHeFFQ8_5BOyaCIr0MvA84akUG7A6cPvz0DXrucoOzVeDrtz07uoR2l0lwS-TdOuPA/s1600/Unchecked+All+Check+boxes+with+Header+in+using+jQuery.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_mr8uTi07SgOS-wQuJ0_ZnELCgXNhnzL-jiGI6ah9YSrCSTk26R1sAXtwYRl4WMqHELChgi8s2jHeFFQ8_5BOyaCIr0MvA84akUG7A6cPvz0DXrucoOzVeDrtz07uoR2l0lwS-TdOuPA/s1600/Unchecked+All+Check+boxes+with+Header+in+using+jQuery.PNG" height="320" width="312" /></a></div>
<br /></td>
</tr>
</tbody>
</table>
<br /></div>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-49878897357976467902014-02-26T03:15:00.003-08:002014-02-26T03:38:35.280-08:00Constructors in C# with Example, Types of Constructor in C# with Example<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Constructors in C# with Example, Types of Constructor in C# with Example</b><br />
<br />
Generally constructor name should be same as class name. If we want to create constructor in a class we need to create a constructor method name same as class name check below sample method for constructor<br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>class SampleA<br />
{<br />
public SampleA()<br />
{<br />
Console.WriteLine("Sample A Test Method");<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
Types of Constructors<br />
<br />
Basically constructors are 5 types those are<br />
<br />
1. Default Constructor<br />
2. Parametrized Constructor<br />
3. Copy Constructor<br />
4. Static Constructor<br />
5. Private Constructor<br />
<b><br /></b>
<b> 1. Default Constructor</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
using System;<br />
namespace ConsoleApplication3<br />
{<br />
class Sample<br />
{<br />
public string param1, param2;<br />
public Sample() // Default Constructor<br />
{<br />
param1 = "Welcome";<br />
param2 = "http://fantasyaspnet.blogspot.in/";<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Sample obj=new Sample(); // Once object of class created automatically constructor will be called<br />
Console.WriteLine(obj.param1);<br />
Console.WriteLine(obj.param2);<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Welcome</span></div>
http://fantasyaspnet.blogspot.in/<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";"></span></td>
</tr>
</tbody>
</table>
<br />
<b>Parametrized Constructors</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
using System;<br />
namespace ConsoleApplication3<br />
{<br />
class Sample<br />
{<br />
public string param1, param2;<br />
public Sample(string x, string y) // Declaring Parameterized constructor with Parameters<br />
{<br />
param1 = x;<br />
param2 = y;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Sample obj=new Sample("Welcome","http://fantasyaspnet.blogspot.in/"); // Parameterized Constructor Called<br />
Console.WriteLine(obj.param1 +" to "+ obj.param2);<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Welcome
to http://fantasyaspnet.blogspot.in/</span></div>
</td>
</tr>
</tbody>
</table>
<br />
<b>Constructor Overloading</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
using System;<br />
namespace ConsoleApplication3<br />
{<br />
class Sample<br />
{<br />
public string param1, param2;<br />
<br />
public Sample() // Default Constructor<br />
{<br />
param1 = "Hi";<br />
param2 = "I am Default Constructor";<br />
}<br />
public Sample(string x, string y) // Declaring Parameterized constructor with Parameters<br />
{<br />
param1 = x;<br />
param2 = y;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Sample obj = new Sample(); // Default Constructor will Called<br />
Sample obj1=new Sample("Welcome","http://fantasyaspnet.blogspot.in/"); // Parameterized Constructor will Called<br />
Console.WriteLine(obj.param1 + ", "+obj.param2);<br />
Console.WriteLine(obj1.param1 +" to " + obj1.param2);<br />
Console.ReadLine();<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Hi,
I am Default Constructor</span></div>
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Welcome
to http://fantasyaspnet.blogspot.in/</span></td>
</tr>
</tbody>
</table>
<br />
<b>Copy Constructor</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
class Sample<br />
{<br />
public string param1, param2;<br />
public Sample(string x, string y)<br />
{<br />
param1 = x;<br />
param2 = y;<br />
}<br />
public Sample(Sample obj) // Copy Constructor<br />
{<br />
param1 = obj.param1;<br />
param2 = obj.param2;<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
Sample obj = new Sample("Welcome", "http://fantasyaspnet.blogspot.in/"); // Create instance to class Sample<br />
Sample obj1=new Sample(obj); // Here obj details will copied to obj1<br />
Console.WriteLine(obj1.param1 +" to " + obj1.param2);<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Welcome
to http://fantasyaspnet.blogspot.in/</span></td>
</tr>
</tbody>
</table>
<br />
<b>Static Constructor</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
class Sample<br />
{<br />
public string param1, param2;<br />
static Sample()<br />
{<br />
Console.WriteLine("Static Constructor");<br />
}<br />
public Sample()<br />
{<br />
param1 = "Sample";<br />
param2 = "Instance Constructor";<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
// Here Both Static and instance constructors are invoked for first instance<br />
Sample obj=new Sample();<br />
Console.WriteLine(obj.param1 + " " + obj.param2);<br />
// Here only instance constructor will be invoked<br />
Sample obj1 = new Sample();<br />
Console.WriteLine(obj1.param1 +" " + obj1.param2);<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>Output:</b></div>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Static
Constructor</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
Instance Constructor</span></div>
<span style="font-family: "Verdana","sans-serif"; font-size: 10.0pt; mso-bidi-font-family: "Times New Roman"; mso-fareast-font-family: "Times New Roman";">Sample
Instance Constructor</span></td>
</tr>
</tbody>
</table>
<br />
<b>Private Constructor</b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />
namespace ConsoleApplication3<br />
{<br />
public class Sample<br />
{<br />
public string param1, param2;<br />
public Sample(string a,string b)<br />
{<br />
param1 = a;<br />
param2 = b;<br />
}<br />
private Sample() // Private Constructor Declaration<br />
{<br />
Console.WriteLine("Private Constructor with no prameters");<br />
}<br />
}<br />
class Program<br />
{<br />
static void Main(string[] args)<br />
{<br />
// Here we don't have chance to create instace for private constructor<br />
Sample obj = new Sample("Welcome","to http://fantasyaspnet.blogspot.in/");<br />
Console.WriteLine(obj.param1 +" " + obj.param2);<br />
Console.ReadLine();<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
Output
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
Welcome to http://fantasyaspnet.blogspot.in/
</td>
</tr>
</tbody>
</table>
<br />
In above method we can create object of class with parameters will work fine. If create object of class without parameters it will not allow us create.
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><br />
// it will works fine
Sample obj = new Sample("Welcome","to http://fantasyaspnet.blogspot.in/");<br />
// it will not work because of inaccessability<br />
Sample obj=new Sample();
</td>
</tr>
</tbody>
</table>
<br /></div>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-45508822616881094032014-02-26T02:55:00.001-08:002014-02-26T02:55:44.281-08:00Regex to Replace All Special Characters with Space in String c#<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Regex to Replace All Special Characters with Space in String c#</b><br />
<br />
<b>C#</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> using System;<br />using System.Text.RegularExpressions;<br /><br />namespace ConsoleApplication3<br />{<br />class Program<br />{<br />static void Main(string[] args)<br />{<br />string str = "http://fantasyaspnet.blogspot.in/";<br />string replacestr= Regex.Replace(str, "[^a-zA-Z0-9_]+", " ");<br />Console.WriteLine(replacestr);<br />Console.ReadLine();<br />}<br />}<br />}</td>
</tr>
</tbody>
</table>
<a href="https://www.blogger.com/blogger.g?blogID=6405515441738996713" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<b>VB</b><br />
<b> </b><br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> Imports System.Text.RegularExpressions<br />Module Module1<br />Sub Main()<br />Dim str As String = "http://fantasyaspnet.blogspot.in/"<br />Dim replacestr As String = Regex.Replace(str, "[^a-zA-Z0-9_]+", " ")<br />Console.WriteLine(replacestr)<br />Console.ReadLine()<br />End Sub<br />End Module</td>
</tr>
</tbody>
</table>
<br />
<b>Demo:</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td>http<span class="match0"> </span>fantasyaspnet<span class="match0"> </span>blogspot<span class="match0"> </span>in<span class="match0"> </span>
</td>
</tr>
</tbody>
</table>
</div><script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0tag:blogger.com,1999:blog-6405515441738996713.post-79804820115921851702014-02-26T02:46:00.001-08:002014-02-26T02:46:06.883-08:00How to Create Captcha with Refresh Button in C#, VB.NET <div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Create Captcha with Refresh Button in C#, VB.NET </b><br />
<br />
<b>.Aspx File</b><br />
<b> </b>
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><html xmlns="http://www.w3.org/1999/xhtml"><br />
<head id="Head1" runat="server"><br />
<title>Captcha Image with Refresh Button</title><br />
<script type="text/javascript"><br />
function RefreshCaptcha() {<br />
var img = document.getElementById("imgCaptcha");<br />
img.src = "Handler.ashx?query=" + Math.random();<br />
}<br />
</script><br />
</head><br />
<body><br />
<form id="form1" runat="server"><br />
<div><br />
<img src="Handler.ashx" id="imgCaptcha" /><br />
<a href="#" onclick="javascript:RefreshCaptcha();">Refresh</a><br />
</div><br />
</form><br />
</body><br />
</html></td>
</tr>
</tbody>
</table>
<br />
Now Right click on website<br />
-> Select Add New Item<br />
-> Select Generic Handler file and give name as Handler.ashx and click ok<br />
<br />
open <b>Handler.ashx</b><br />
<b> </b> <br />
<b>c#</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td> <%@ WebHandler Language="C#" Class="Handler" %><br />
<br />
using System;<br />
using System.Drawing;<br />
using System.Drawing.Imaging;<br />
using System.Web;<br />
<br />
public class Handler : IHttpHandler {<br />
<br />
public void ProcessRequest (HttpContext context) {<br />
using (Bitmap b = new Bitmap(150, 40, PixelFormat.Format32bppArgb))<br />
{<br />
using (Graphics g = Graphics.FromImage(b))<br />
{<br />
Rectangle rect = new Rectangle(0, 0, 149, 39);<br />
g.FillRectangle(Brushes.White, rect);<br />
<br />
// Create string to draw.<br />
Random r = new Random();<br />
int startIndex = r.Next(1, 5);<br />
int length = r.Next(5, 10);<br />
String drawString = Guid.NewGuid().ToString().Replace("-", "0").Substring(startIndex, length);<br />
<br />
// Create font and brush.<br />
Font drawFont = new Font("Arial", 16, FontStyle.Italic | FontStyle.Strikeout);<br />
using (SolidBrush drawBrush = new SolidBrush(Color.Black))<br />
{<br />
// Create point for upper-left corner of drawing.<br />
PointF drawPoint = new PointF(15, 10);<br />
<br />
<a href="https://www.blogger.com/blogger.g?blogID=6405515441738996713" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a>// Draw string to screen.<br />
g.DrawRectangle(new Pen(Color.Red, 0), rect);<br />
g.DrawString(drawString, drawFont, drawBrush, drawPoint);<br />
}<br />
b.Save(context.Response.OutputStream, ImageFormat.Jpeg);<br />
context.Response.ContentType = "image/jpeg";<br />
context.Response.End();<br />
}<br />
}<br />
}<br />
public bool IsReusable {<br />
get {<br />
return false;<br />
}<br />
}<br />
}</td>
</tr>
</tbody>
</table>
<br />
<b>VB</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><a href="https://www.blogger.com/blogger.g?blogID=6405515441738996713" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a><br />
<%@ WebHandler Language="VB" Class="Handler2" %><br />
Imports System.Drawing<br />
Imports System.Drawing.Imaging<br />
Imports System.Web<br />
<br />
Public Class Handler2 : Implements IHttpHandler<br />
<br />
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest<br />
Using b As New Bitmap(150, 40, PixelFormat.Format32bppArgb)<br />
Using g As Graphics = Graphics.FromImage(b)<br />
Dim rect As New Rectangle(0, 0, 149, 39)<br />
g.FillRectangle(Brushes.White, rect)<br />
<br />
' Create string to draw.<br />
Dim r As New Random()<br />
Dim startIndex As Integer = r.[Next](1, 5)<br />
Dim length As Integer = r.[Next](5, 10)<br />
Dim drawString As [String] = Guid.NewGuid().ToString().Replace("-", "0").Substring(startIndex, length)<br />
<br />
' Create font and brush.<br />
Dim drawFont As New Font("Arial", 16, FontStyle.Italic Or FontStyle.Strikeout)<br />
Using drawBrush As New SolidBrush(Color.Black)<br />
' Create point for upper-left corner of drawing.<br />
Dim drawPoint As New PointF(15, 10)<br />
<br />
' Draw string to screen.<br />
g.DrawRectangle(New Pen(Color.Red, 0), rect)<br />
g.DrawString(drawString, drawFont, drawBrush, drawPoint)<br />
End Using<br />
b.Save(context.Response.OutputStream, ImageFormat.Jpeg)<br />
context.Response.ContentType = "image/jpeg"<br />
context.Response.[End]()<br />
End Using<br />
End Using<br />
End Sub<br />
<br />
<a href="https://www.blogger.com/blogger.g?blogID=6405515441738996713" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"></a>Public ReadOnly Property IsReusable() As Boolean Implements IHttpHandler.IsReusable<br />
Get<br />
Return False<br />
End Get<br />
End Property<br />
<br />
End Class</td>
</tr>
</tbody>
</table>
<br />
<b> Demo</b><br />
<br />
<table style="border-style: dashed; width: 100%;">
<tbody>
<tr>
<td><div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6hBSIQV0RI3CTTzdunIuGF-zPTVY5USEfjSTo028tD1U4yp0RR4QPI5YgAgkG-Y4c4PgGYt-vm7AvG-YcpmNy4iF7dxW97hXpa9wFngHsgurBap4Vksoc0GGpCWLu9OeMjmi5icoP3F8/s1600/Create+Captcha+with+Refresh+Button.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6hBSIQV0RI3CTTzdunIuGF-zPTVY5USEfjSTo028tD1U4yp0RR4QPI5YgAgkG-Y4c4PgGYt-vm7AvG-YcpmNy4iF7dxW97hXpa9wFngHsgurBap4Vksoc0GGpCWLu9OeMjmi5icoP3F8/s1600/Create+Captcha+with+Refresh+Button.jpg" height="109" width="400" /></a></div>
<br /></td>
</tr>
</tbody>
</table><br /><b><Download Demo</b>
<script async="" src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><b>
</b><!-- ad me fast -->
<br />
<b><ins class="adsbygoogle" data-ad-client="ca-pub-1319157260815797" data-ad-slot="5526867051" style="display: inline-block; height: 90px; width: 728px;"></ins></b><script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
Anonymoushttp://www.blogger.com/profile/05144339500002026012noreply@blogger.com0