tag:blogger.com,1999:blog-8927126591005008762024-03-14T10:54:28.056+05:30Developers Code BlogDeveloperscode is Technology Blog For .Net and Mobile Developers.Tutorials on Asp.net,c#,sqlserver,ajax,asp.net controls,databases,Jquery,xml,webservices,window services,Android,Iphone,Blackberry,Phonegap,Jquery Mobile developmentUnknownnoreply@blogger.comBlogger126125tag:blogger.com,1999:blog-892712659100500876.post-57340657985301859112013-10-25T00:50:00.000+05:302013-10-25T00:50:14.938+05:30Dynamically Bind data to jquerymobile listview by passing parameters using c# and sqlserver<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="" height="200px" src="http://developerscodeapps.com/blogger/postimages/listview_withouparameters.png" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain how to Dynamically Bind data to jquerymobile listview by passing parameters using c# and sqlserver.In my previous jquerymobile articles, i have already explained "<a href="http://www.developerscode.com/2013/08/2-ways-to-bind-data-to-gridview-using.html"><b><span style="color: blue;">2 different ways to bind the data with clientside code</span></b></a> and <a href="http://www.developerscode.com/2013/10/bind-data-to-listview-from-database.html"><b><span style="color: blue;">Bind data to listview from database using jquerymobile,c# and sqlserver</span></b></a>" .</span><br />
<span style="font-family: Verdana, sans-serif;"></span><br />
<a name='more'></a><br />
<span style="font-family: Verdana, sans-serif;">Here i am going to explain, How to bind the data Dynamically to jquerymobile listview from sqlserver by passing parameters with csharp.
Let's start
First, Create a New asp.net website.
Next, Add one asmx webservice form from choose items dialog box and change the name as myservice.asmx
Next, Open the myservice.asmx.cs page and add the following namespaces.
</span><br />
<pre class="cpp" name="code">using System.Collections.Generic;
using System.Web.Services;
using System.Web.Script.Serialization;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using System.Collections;
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, Add one class and one Web method in order get the data from database. Following is the complete code.
</span><br />
<pre class="cpp" name="code">/// <summary>
/// Summary description for myservice
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
[System.Web.Script.Services.ScriptService]
public class myservice : System.Web.Services.WebService {
SqlConnection con = new SqlConnection();
SqlCommand com = new SqlCommand();
public myservice () {
//Uncomment the following line if using designed components
//InitializeComponent();
}
public class Questions
{
public string QuestionId { get; set; }
public string Question { get; set; }
public string CID { get; set; }
}
[WebMethod]
public string GetQuestions(string Category)
{
// Category = "1";
con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestQuiz"].ToString());
if (con.State != ConnectionState.Open)
{
con.Open();
}
com = new SqlCommand("select * from TestQuestions where CategoryId='" + Category + "' order by QuestionId asc", con);
SqlDataAdapter da = new SqlDataAdapter(com);
DataTable ds = new DataTable();
da.Fill(ds);
JavaScriptSerializer serializer = new JavaScriptSerializer();
List<questions> _data = new List<questions>();
string jsondata = " { " + "\"AllQuestion\"" + " : ";
foreach (DataRow dtRow in ds.Rows)
{
_data.Add(new Questions()
{
QuestionId = dtRow["QuestionId"].ToString(),
Question = dtRow["Questions"].ToString(),
CID = dtRow["Questions"].ToString()
});
}
string json = serializer.Serialize(_data.ToArray());
jsondata += json + "}";
//write string to file
//System.IO.File.WriteAllText(@"F:\Tanisha\Practice\Questions.json", jsondata);
return json;
}
}
</questions></questions></pre>
<span style="font-family: Verdana, sans-serif;">
Next, Select one new html page and one add div (Questions) inside the body tags
</span><br />
<pre class="cpp" name="code"> <div data-role="page" id="CategoryPage">
<div data-role="content">
<div id="Questions">
</div>
</div>
</div>
</pre>
<span style="font-family: Verdana, sans-serif;">
Next,Add the following script inside the HEAD tags.
</span><br />
<pre class="cpp" name="code"><script type="text/javascript">
// When the user views the Track Info page
function GetQuestions() {
var category="1";
var serviceURL = 'QuizService.asmx/GetQuestions';
$.ajax({
type: "POST",
url: serviceURL,
data: "{'Category':'" + category + "'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successFunc,
error: errorFunc
});
function successFunc(data, status) {
// parse it as object
var TotaQuestions = JSON.parse(data.d);
// creating html string
var listString = '';
// running a loop
$.each(TotaQuestions, function (index, value) {
if (questionindex == index) {
listString = "Question : " + this.Question;
localStorage.Question = this.QuestionId;
}
});
//appending to the div
$('#Questions').html(listString);
}
function errorFunc() {
alert('error');
}
}
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it. Happy coding...
</span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-892712659100500876.post-74814852153478944262013-09-15T18:59:00.000+05:302013-09-15T18:59:05.967+05:30Basic AngularJs tutorial for Beginners<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="" src="http://www.developerscodeapps.com/Blogger/PostImages/Angularjs.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">I would like to share articles related to Angularjs from basics especially for Asp.net developers.In this article i would like to share "What is Angularjs and basic example".
</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;"><b>Series</b> : </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">1. <b>What is Angularjs..?</b> </span><br />
<span style="font-family: Verdana, sans-serif;">AngularJS is an open-source JavaScript framework, that assists with running single-page applications. Its goal is to augment browser-based applications with model–view–controller (MVC) capability.
HTML is great for declaring static documents, but it falters when we try to use it for declaring dynamic views in web-applications. AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">URL : <a href="http://angularjs.org/" rel="nofollow" target="_blank"><span style="color: blue;"><b>AngularJs</b></span></a> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>2</b>. <b>Advantges of using AngularJs</b> : </span><br />
<span style="font-family: Verdana, sans-serif;"><b>a</b>.<b>Two Way Data-Binding</b> : AngularJS two-way data-binding handles the synchronization between the DOM and the model, and vice verse</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>b</b>.<b>Patterns</b>: Model View Controller and Dependency Injection are the two patterns that jump out at the start, but there are other comfortable, familiar patterns in Angular, including it's approach to view composition and dependency management. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>3</b>.<b>How to start ..?</b> </span><br />
<span style="font-family: Verdana, sans-serif;">First, Open the Angularjs site by using the url <a href="http://angularjs.org/"><b>http://angularjs.org/</b></a> .
Next, Download the latest script file for official site.
Next, Extract the files and add them in your project file.
Next, Check the Following the video tutorial for basics. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>4.Video tutorial from official site AngularJs
</b></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/uFTFsKmkQnQ?feature=player_embedded' frameborder='0'></iframe></div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-892712659100500876.post-63159710996412622332013-09-12T09:18:00.000+05:302013-09-12T09:18:53.541+05:30Trick to prevent print content on webpage<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Trick for prevent print content on webpage" src="http://www.developerscodeapps.com/Blogger/PostImages/HidedataFromPrint.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article, i would like to explain a simple trick to prevent print content on webpage.That means if any user trying to take the print of the webpage, the webpage data will not be print on the printed page.In my previous articles i have already explained some trick based on javascript. <a href="http://www.developerscode.com/2013/03/simple-way-to-display-information-from.html" rel="follow" target="_blank"><b><span style="color: blue;">Simple way to display information from another Website</span></b></a> , <a href="http://www.developerscode.com/2013/02/simple-way-to-create-timer-using.html" rel="follow" target="_blank"><span style="color: blue;"><b>Simple Way to create Timer using Javascript</b></span></a> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>1</b>. Add the following style in head section
</span><br />
<pre class="cpp" name="code"><style media="print" type="text/css">
BODY {display:none;visibility:hidden;}
</style>
<style type="text/css">
.unselect
{
user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
-o-user-select: none;
-ms-user-select: none;
}
</style>
</pre>
<span style="font-family: Verdana, sans-serif;"><b>2</b>. Add the following code in body section
</span><br />
<pre class="cpp" name="code"><div onselectstart="return false">
<asp:literal id="tempHtmlTable" runat="server"></asp:literal>
</div>
</pre>
<br />
<span style="font-family: Verdana, sans-serif;">That's it.. Happy coding
</span></div>
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-892712659100500876.post-4761536487907193692013-09-05T23:13:00.000+05:302013-09-11T08:56:14.825+05:30How to generate genuine excel report using string builder with C# code<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="How to generate genuine excel report using string builder with Asp.net and Csharp" src="http://www.developerscodeapps.com/Blogger/PostImages/AspnetExcelsheet.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article, I would like to explain "How to generate genuine excel report using string builder with <b>Asp.net and C#</b> code.In previous article i have already explained about PDF generation <a href="http://www.developerscode.com/2012/05/generate-random-password-for-pdf-with.html" rel="follow"><span style="color: blue;"><b>Generate Random Password for PDF with asp.net</b></span></a> and <a href="http://www.developerscode.com/2012/05/create-password-protected-pdf-using.html" rel="follow"><span style="color: blue;"><b>Create Password protected PDF using iTextsharp with asp.net and c#</b> </span></a>. </span><br />
<a name='more'></a>
<span style="font-family: Verdana, sans-serif;">Here I am going to explain about "Generation genuine excel report using string builder with <b>Asp.net and C#</b> code ". </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Please follow the steps</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Step 1</b>: Open visual studio from start menu. </span><br />
<span style="font-family: Verdana, sans-serif;"><b>Step 2</b>: In Visual studio in file menu create one new project </span><br />
<span style="font-family: Verdana, sans-serif;"><b>Step 3</b>: In Aspx page create on button using below tag
</span><br />
<pre class="cpp" name="code">
<asp:button id="btngenuineExcel" onclick="btngenuineExcel_Click" runat="server" text="GenerateGenuineExcel">
</asp:button></pre>
<span style="font-family: Verdana, sans-serif;"><b>
Step 4</b>: Call one method with the <b>GetGenuineExcelreport() btngenuineExcel_Click</b> event as below</span><br />
<div>
<br />
<br />
<pre class="cpp" name="code"> protected void btngenuineExcel_Click(object sender, EventArgs e)
{
GetGenuineExcelreport("Excelreport"); // here "Excelreport" means your excel file name
}
</pre>
<span style="font-family: Verdana, sans-serif;"><b>
Step 5</b>: Under GetGenuineExcelreport( string name) method write following code </span>
</div>
<span style="font-family: Verdana, sans-serif;"><b>Step 6</b>:Please add the following code in button click event</span><br />
<pre class="c#" name="code">
public void GetGenuineExcelr(string name)
{
string fileName = "attachment;fileName=" + name;
Response.ContentType = "application/vnd.ms-excel";
fileName = fileName + ".xls";
Response.AddHeader("Content-Disposition", fileName);
string[] font = new string[] {"Verdana", "Arial", "Sans-Serif" };
Response.Charset = "";
this.EnableViewState = false;
StringBuilder sb = new StringBuilder();
// Here we can find StringBuilder calss using using System.Text name space
sb.Append("Write your Text Here");
StringWriter strwiriter = new StringWriter();
strwiriter.Write(sb.ToString());
HtmlTextWriter ohtmltextwriter = new HtmlTextWriter(strwiriter);
Repeater rt = new Repeater();
rt.RenderControl(ohtmltextwriter);
Response.Write(strwiriter.ToString());
Response.End();
}
</pre>
<span style="font-family: Verdana, sans-serif;"><b>Step 7</b>: Now run the application and click on "GenerateGenuineExcel" button the excel report will generate..you can customize your own data or from data set data. </span>
<br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">That's it..Happy coding. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Please let me know if you any issues..
</span>
</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-892712659100500876.post-44386254152999711742013-08-28T00:02:00.000+05:302013-09-09T21:51:40.274+05:30How to Store Logout information when browser tab closed using asp.net c#.net and javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Logout_TabClosed" src="http://www.developerscodeapps.com/Blogger/PostImages/Logout_TabClosed.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article, i would like to explain "How to Store Logout information when browser tab closed using asp.net c#.net and javascript".So many requests we are receving from beginners.I hope it will helps for them.</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">I have checked in all browsers its working fine.I have already shared Some articles related to this.</span><div>
<span style="font-family: Verdana, sans-serif;"><br /></span><br />
<span style="color: blue; font-family: Verdana, sans-serif;"><a href="http://www.developerscode.com/2011/02/how-to-create-login-page-in-aspnet-with.html" target="_blank" rel='follow'><b>How to create a login page in Aspnet with sqlserver</b></a></span><br />
<span style="font-family: Verdana, sans-serif;"><b><br /></b></span>
<span style="font-family: Verdana, sans-serif;"><span style="color: blue;"><a href="http://www.developerscode.com/2011/02/how-to-create-logout-page-using.html" rel='follow'><b><span id="goog_121036881"></span>How to create a LOGOUT Page using Sessions<span id="goog_121036882"></span></b></a></span></span><br />
<span style="font-family: Verdana, sans-serif;"><b><br /></b></span>
<span style="font-family: Verdana, sans-serif;"><span style="color: blue;"><a href="http://www.developerscode.com/2012/03/journey-from-login-page-to-logout-page.html" rel='follow'><b>A journey from Login Page to Logout Page in Asp.net</b></a></span> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Now, "</span><span style="font-family: Verdana, sans-serif;">How to Store Logout information when browser tab closed using asp.net c#.net and javascript"</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Let's Start:</b> </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b><span style="color: red;">First Step </span></b>:
Write the following simple script to call logout button event
</span><br />
<pre class="cpp" name="code">
<script type="text/javascript">
window.onbeforeunload = function (e) {
document.getElementById('<%=btnLogout.ClientID%>').click();
};
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">
When you close the tab, beforeunload script function will be fire and then it calls necessary button event </span><div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><b><span style="color: red;">In Next Step</span></b>:</span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Write the necessary code in button Event</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span><pre class="cpp" name="code">protected void btnLogout_Click(object sender, EventArgs e)
{
Session.Abandon();
Session.Remove("Username");
//Save the Necessary logout information in Database.
Response.Redirect("Home.aspx");
}
</pre>
<span style="font-family: Verdana, sans-serif;"><div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
That's it.I hope it will helps.
</span>
</div>
</div>
</div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-892712659100500876.post-77991087574319262022013-08-15T19:46:00.000+05:302013-09-09T21:51:59.599+05:30Sorting the Data with String,Integers and Decimals using Javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Sorting the Data with String,Integers and Decimals using Javascript" src="http://www.developerscodeapps.com/Blogger/PostImages/sorting.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article,i would like to explain "How to sort data with String,Integers and Decimals values using javascript".In have already articles related javascript.
For example,<span style="color: blue;"> <a href="http://www.developerscode.com/2013/01/get-unique-values-from-json-using-jquery.html" rel='follow'><span style="color: blue;">Get unique values from json using jquery</span></a> </span>, <a href="http://www.developerscode.com/2013/02/simple-way-to-create-timer-using.html" rel='follow'><span style="color: blue;">Simple Way to create Timer using Javascript</span></a>.Here i am sharing article related to sorting technique using javascript. </span><br />
<a name='more'></a><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<a href="http://dcwork.atwebpages.com/" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<br />
<span style="color: red; font-family: Verdana, sans-serif;"><b>Main Logic for Sorting: </b></span><br />
<span style="font-family: Verdana, sans-serif;">
<br />
<b>Sorting with String :
</b></span><br />
<pre class="cpp" name="code">function SortByName(x, y) {
return ((x.winename == y.winename) ? 0 : ((x.winename > y.winename) ? 1 : -1));
}
</pre>
<span style="font-family: Verdana, sans-serif;"><b>
Sorting with Integers :
</b></span><br />
<pre class="cpp" name="code">function SortByPrice(x, y) {
return parseFloat(y.price) - (x.price);
}
</pre>
<span style="font-family: Verdana, sans-serif;"><b>
Sorting with Decimals:
</b></span><br />
<pre class="cpp" name="code">function SortByRating(x, y) {
return ((y.reviewstars == x.reviewstars) ? 0 : ((y.reviewstars > x.reviewstars) ? 1 : -1));
}
</pre>
<span style="color: red; font-family: Verdana, sans-serif;">
Complete Logic : </span><br />
<div>
<br /></div>
<div>
<span style="font-family: Verdana, sans-serif;">Following is the code to bind the data to listview based sorting requested from json.
</span><br />
<pre class="cpp" name="code">$('#BindWines').live('pageshow', function() {
$('#completeWines li').remove();
jQuery.getJSON("Js/newwinecurrent.json", function(data) {
wines = data.rows;
if (query_string[0] == "Price") {
wines.sort(SortByPrice);
}
else if (query_string[0] == "Rating") {
wines.sort(SortByRating);
}
else {
wines.sort(SortByName);
}
$.each(wines, function(index, wine) {
if (parseInt(wine.price) >= parseInt(subpar1) && wine.reviewstars >= subpar2) {
$('#completeWines').append('
<li><span style="color: black; font-family: Verdana; font-size: Medium;">ID:' + wine.uniqueid + '.</span>
' +
'<span style="color: black; font-family: Verdana; font-size: small;">Price :' + wine.price + '</span>
' +
'<span style="color: black; font-family: Verdana; font-size: small;">Review Stars :' + wine.reviewstars + '</span>
' +
'<span style="color: black; font-family: Verdana; font-size: small;">Review Text:' + wine.reviewtext + '</span>
' +
'</li>
');
}
$('#completeWines').listview('refresh');
});
});
});
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it. If you any queries.Please drop a message.
</span><br />
</div>
</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-892712659100500876.post-88445317910062011132013-08-15T11:37:00.000+05:302013-09-09T21:52:21.638+05:302 Ways to bind data to gridview using client side code with asp.net c# jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="2 Ways to bind data to gridview using client side code" src="http://www.developerscodeapps.com/Blogger/PostImages/2ways_grid_clientside.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article,I would like to explain "How to bind data to Gridview using Client Side Code in 2 ways with asp.net, c#, jquery</span><span style="font-family: Verdana, sans-serif;">".In my previous sections, i have already shared articles related to </span><a href="http://www.developerscode.com/search/label/Gridview" style="font-family: Verdana, sans-serif;" target="_blank" rel='follow'><span style="color: blue;">Gridview</span></a><span style="font-family: Verdana, sans-serif;">, </span><a href="http://www.developerscode.com/2012/02/two-ways-of-implementing-crud.html" style="font-family: Verdana, sans-serif;" target="_blank" rel='follow'><span style="color: blue;">Different binding techniques</span></a><span style="font-family: Verdana, sans-serif;">.</span><br />
<a name='more'></a><br /><br />
<span style="font-family: Verdana, sans-serif;">Here I am going to explain in simple way to bind data to gridview using client side in order to increase the performance of the application.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Please follow the steps: </b></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Here we need to create two sections, One is Server side and another one client side. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Lets start with server side. </span><br />
<span style="font-family: Verdana, sans-serif;">First, Select New aspx form and change the name as ServerSide.aspx. </span><br />
<span style="font-family: Verdana, sans-serif;">Next, Write the following code in serverside.cs file </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Add the following namespaces
</span><br />
<pre class="cpp" name="code">using System;
using System.Collections.Generic;
using System.Web.Services;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, Add the following two Web methods for two methods
</span><pre class="cpp" name="code">[WebMethod]
public static string GetStateInfo1()
{
string query = "select Stateid,StateName,StateCode from STATE";
string strConnString = ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString;
using (SqlConnection con = new SqlConnection(strConnString))
{
using (SqlCommand cmd = new SqlCommand(query, con))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataSet ds = new DataSet())
{
sda.Fill(ds);
return ds.GetXml();
}
}
}
}
}
[WebMethod]
public static StateDetails[] GetStateInfo2()
{
DataTable dt = new DataTable();
List<statedetails> details = new List<statedetails>();
string strConnString = ConfigurationManager.ConnectionStrings["dbConnection"].ConnectionString;
using (SqlConnection con = new SqlConnection(strConnString))
{
using (SqlCommand cmd = new SqlCommand("select Stateid,StateName,StateCode from STATE", con))
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
foreach (DataRow dtrow in dt.Rows)
{
StateDetails st = new StateDetails();
st.State_id = dtrow["Stateid"].ToString();
st.StateName = dtrow["StateName"].ToString();
st.StateCode = dtrow["StateCode"].ToString();
details.Add(st);
}
}
}
return details.ToArray();
}
public class StateDetails
{
public string State_id { get; set; }
public string StateName { get; set; }
public string StateCode { get; set; }
}
</statedetails></statedetails></pre>
<span style="font-family: Verdana, sans-serif;">
Next,Select New aspx form and change the name as Clientside.aspx </span><div>
<span style="font-family: Verdana, sans-serif;">Next,Open the aspx form and add two buttons and one Gridview. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Next,Change the button names as Method1 and Method2 and Gridview name as gvStates. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><b>Next,Write the two different scripts for two methods</b> </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><b><span style="color: red;">Method 1:
</span></b></span><pre class="cpp" name="code">
$("#btnMethod1").click(function () {
$.ajax({
type: "POST",
url: "ServerSide.aspx/GetStateInfo1",
data: '{}',
contentType: "application/json; charset=utf-8",
dataType: "json",
success: OnSuccess,
failure: function (response) {
alert("Failure : " + response.d);
},
error: function (response) {
alert("Error : " + response.d);
}
});
});
function OnSuccess(response) {
var xmlDoc = $.parseXML(response.d);
var xml = $(xmlDoc);
var users = xml.find("Table");
//create a new row from the last row of gridview
var row = $("[id*=gvStates] tr:last-child").clone(true);
//remove the lst row created by binding the dummy row from code behind on page load
$("[id*=gvStates] tr").not($("[id*=gvStates] tr:first-child")).remove();
var count = 1;
$.each(users, function () {
//var users = $(this);
$("td", row).eq(0).html($(this).find("Stateid").text());
$("td", row).eq(1).html($(this).find("StateName").text());
$("td", row).eq(2).html($(this).find("StateCode").text());
$("[id*=gvStates]").append(row);
//define the background stryle of newly created row
if (count == 1 || (count % 2 != 0)) {
$(row).css("background-color", "#ffffff");
}
else {
$(row).css("background-color", "#D2CDCD");
}
count = count + 1;
row = $("[id*=gvStates] tr:last-child").clone(true);
});
}
</pre>
<span style="color: red; font-family: Verdana, sans-serif;">
Method 2:
</span><pre class="cpp" name="code"> $("#btnMethod2").click(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "ServerSide.aspx/GetStateInfo2",
data: "{}",
dataType: "json",
success: function (data) {
for (var i = 0; i < data.d.length; i++) {
$("#gvStates").append("" + data.d[i].Stateid + "<br />
" + data.d[i].StateName + "<br />
" + data.d[i].StateCode + "<br />
");
}
},
error: function (result) {
alert("Error");
}
});
});
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, Add this script file and this following line before the script
</span><pre class="cpp" name="code"><script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/javascript"></script>
$(document).ready(function () {
});
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it.Please let me know if you have any queries.
</span>
</div>
</div>Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-892712659100500876.post-40050322309832325962013-08-05T23:39:00.000+05:302013-09-09T21:53:14.331+05:30Changing the order of Listview randomly on page refresh<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Changing the order of Listview randomly on page refresh" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfF6fbsPkK_g-8p4r68sCKeuTwi7_vLQCEDbKtjU0cFp8Jo1lg39Vh6ffzzLxVpCFnSkdC54zgefQydCFyrQtUi18zfgebhYc1J1G9QFSQyTHtJALdZh4z-vevcA-3fs7Ync5NSZlcVj4/s320/randomListview.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to share how to Change the order of Listview items randomly on page refresh using Jquerymobile and javascript.I have already shared based on jquery mobile and Javascrpt.
</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">First,Add this script files in Head Tag
</span>
<br />
<pre class="cpp" name="code">
<link href="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.css" rel="stylesheet">
</link>
<script src="http://code.jquery.com/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="http://code.jquery.com/mobile/1.0a4.1/jquery.mobile-1.0a4.1.min.js" type="text/javascript">
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">
Next,Add the Basic html code to display the listview items
</span><br />
<pre class="cpp" name="code">
<div data-role="page" id="Itemslistpage">
<div data-role="header">
Page Title
</div>
<!-- /header -->
<br />
<div data-role="content">
<div id="ItemsLists">
</div>
</div>
<!-- /content -->
<br />
<div data-role="footer">
<h4>
Page Footer</h4>
</div>
<!-- /footer -->
</div>
<!-- /page -->
</pre>
<span style="font-family: Verdana, sans-serif;">
Now, Use the following script to bind items in listview</span>.
<br />
<pre class="cpp" name="code">
$('#Itemslistpage').live('pageshow', function (event) {
var serviceURL = 'Service.asmx/GetList';
$.ajax({
type: "POST",
url: serviceURL,
data: param = "",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successFunc,
error: errorFunc
});
function successFunc(data, status) {
// parse it as object
var ItemsListArray = JSON.parse(data.d);
var ArrayRank = new Array();
// creating html string
var listString = '<ul data-role="listview" id="customerList">';
var k = 0;
// running a loop
$.each(ItemsListArray, function (index, value) {
ArrayRank[k] = k;
k++;
});
random(ArrayRank);
$.each(ItemsListArray, function (index, value) {
listString += '
<li>' + ItemsListArray[ArrayRank[index]].Desgination + '<table style="width: 100%px;"><tbody>
<tr><td><a href="http://www.blogger.com/blogger.g?blogID=892712659100500876#">' + ItemsListArray[ArrayRank[index]].Name + '</a></td><td>' + ItemsListArray[ArrayRank[index]].Rank + '</td></tr>
<tr><td></td></tr>
</tbody></table>
</li>
';
});
listString += '</ul>
';
//appending to the div
$('#ItemsLists').html(listString);
// refreshing the list to apply styles
$('#ItemsLists ul').listview();
}
function errorFunc() {
alert('error');
}
});
</pre>
<span style="font-family: Verdana, sans-serif;">
Now coming to Main Logic, that is changing the order of listview randomly using the following script
</span><br />
<pre class="cpp" name="code">
function random(list) {
var i, j, t;
for (i = 1; i < list.length; i++) {
j = Math.floor(Math.random() * (1 + i));
if (j != i) {
t = list[i];
list[i] = list[j];
list[j] = t;
}
}
}
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it.Now The listview items order will change on every time page refresh.See the below output
Here is the output
</span>
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-1011590352983181392013-08-05T23:23:00.000+05:302013-09-09T21:54:14.518+05:30Get Employees list using Jquery Ajax,WCF Restful Service and Entity Framework<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Get Employees list using Jquery Ajax,WCF Restful Service" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjZe8BwF8Y9s31OBMdzTn_QR4L2IESZXSZU9GEYlEQYpeTz49DTeEhKzroMbxohd1PMPLPNeOQCMT0bL00fv8YL8qxtCPT_d_WyByF_keaqGtEc1uxdeE7sV7tVSPIgioswqO34UOz5yFM/s1600/wcfrest.png" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain "How to get employees list using Jquery Ajax,Wcf Restful service and Entity Framework".This is our first article in this series
</span><br />
<a name='more'></a><b><span style="font-family: Verdana, sans-serif;">
Data Access Layer :</span> </b><br />
<br />
<span style="font-family: Verdana, sans-serif;">First, Open the Visual studio and select a new project
Next, Change the Name as SeriesEntity.(see the below pictures) </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikynL5YPP8gtWuNzV6CNgLuLsNOIJDOUOYiJsGm8HYBdxRyT5xPZuYL3mbVhKIl88IzNE2vFiuJOHmpbzsT5kwfqUAMIycL-12l7HngOiezR9NXi3T8AObSnzWCmHrMbeS5CgHNCsQZWA/s1600/SeriesEntity1.PNG" imageanchor="1"><img border="0" height="460" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikynL5YPP8gtWuNzV6CNgLuLsNOIJDOUOYiJsGm8HYBdxRyT5xPZuYL3mbVhKIl88IzNE2vFiuJOHmpbzsT5kwfqUAMIycL-12l7HngOiezR9NXi3T8AObSnzWCmHrMbeS5CgHNCsQZWA/s640/SeriesEntity1.PNG" width="640" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1DEzzHjLjLMa1jHpkn7ByGvMnUm8iADebrQGN-LUz5y74jcufYvmXM5T-qYbWEJqgHBA_hS1xCRE2QbuNCXtl7Tt6Z1MpqjdTCZC-YE_9crKstN9E5MXgZdk-HdMk5lZBHoW8m2isKd0/s1600/SeriesEntity10.PNG" imageanchor="1"><img border="0" height="406" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg1DEzzHjLjLMa1jHpkn7ByGvMnUm8iADebrQGN-LUz5y74jcufYvmXM5T-qYbWEJqgHBA_hS1xCRE2QbuNCXtl7Tt6Z1MpqjdTCZC-YE_9crKstN9E5MXgZdk-HdMk5lZBHoW8m2isKd0/s640/SeriesEntity10.PNG" width="640" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDN6G9d1owkuXzbNWS003DIX-yna3vThKKSpzeNp78_QLc8iyZvrdg0wv-vU4waAn0qlBTLAxwEway8K3mNLnKUvttnD0-NiBks0x00iTdgmF-nkK-XGqUQzsImYpjhymx25kkrrnxfXU/s1600/SeriesEntity2.PNG" imageanchor="1"><img border="0" height="460" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDN6G9d1owkuXzbNWS003DIX-yna3vThKKSpzeNp78_QLc8iyZvrdg0wv-vU4waAn0qlBTLAxwEway8K3mNLnKUvttnD0-NiBks0x00iTdgmF-nkK-XGqUQzsImYpjhymx25kkrrnxfXU/s640/SeriesEntity2.PNG" width="640" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2xNlhTR-yJUzech7_ShbKpoMazxIPAELmgVwe89sjHtseqv6s3w3pIr5wQK_lCGzXK2ZipWljo0IFf5Eeq9UHsKMW0g6wNIRRFxiGIgf4fX5t1qu3LwTwfnlMF7edVY6mGoOj1UBJ4Kg/s1600/SeriesEntity3.PNG" imageanchor="1"><img border="0" height="456" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg2xNlhTR-yJUzech7_ShbKpoMazxIPAELmgVwe89sjHtseqv6s3w3pIr5wQK_lCGzXK2ZipWljo0IFf5Eeq9UHsKMW0g6wNIRRFxiGIgf4fX5t1qu3LwTwfnlMF7edVY6mGoOj1UBJ4Kg/s640/SeriesEntity3.PNG" width="640" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkTgi0xkOnzMbHRFSsXMg6S6IPP4JY63EVI8B5mdQOo6OOZDDwPpD3IyneVrYNDyHTVFQ8HHYZ9VnUA5Ed4rgns_bjfFz5GU06UFd_ZlFu4eV91iS7kiycvRfWL-CHKtbQvM_zIi62xX8/s1600/SeriesEntity4.PNG" imageanchor="1"><img border="0" height="482" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkTgi0xkOnzMbHRFSsXMg6S6IPP4JY63EVI8B5mdQOo6OOZDDwPpD3IyneVrYNDyHTVFQ8HHYZ9VnUA5Ed4rgns_bjfFz5GU06UFd_ZlFu4eV91iS7kiycvRfWL-CHKtbQvM_zIi62xX8/s640/SeriesEntity4.PNG" width="640" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjECgaZ1n031PLFxssge1pHTGw8m_HYeKTfiUaYEix0QPovG3aBgF9KVw89qH4Jjw0sWEV-z3Hy7tNuMgqnUu_DWr-m8-VOwPPZQUoR3jre7u7c_mWHbzaZ0e51NeIhD5wv6XFffe_u8Sc/s1600/SeriesEntity5.PNG" imageanchor="1"><img border="0" height="486" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjECgaZ1n031PLFxssge1pHTGw8m_HYeKTfiUaYEix0QPovG3aBgF9KVw89qH4Jjw0sWEV-z3Hy7tNuMgqnUu_DWr-m8-VOwPPZQUoR3jre7u7c_mWHbzaZ0e51NeIhD5wv6XFffe_u8Sc/s640/SeriesEntity5.PNG" width="640" /></a><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfXgUCh1sfOl5H1s7SZ4Ieq6Bt_5uSh1l2hYDMgXphuoEctoL1nZkEZJNyVDPIElzZpL3f0xMe9ArU6sQbdJ5ZcPlRc1AAwEOQo4OOmvBDmXmaelMukZTXG3UCOyo8DGCWXXm5xmKZGaQ/s1600/SeriesEntity7.PNG" imageanchor="1"><img border="0" height="330" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgfXgUCh1sfOl5H1s7SZ4Ieq6Bt_5uSh1l2hYDMgXphuoEctoL1nZkEZJNyVDPIElzZpL3f0xMe9ArU6sQbdJ5ZcPlRc1AAwEOQo4OOmvBDmXmaelMukZTXG3UCOyo8DGCWXXm5xmKZGaQ/s640/SeriesEntity7.PNG" width="640" /></a><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFbL74dzppgsxvxixTzxRz2zeSx_nO3JvjAcd9EJ7vHWFSKBlyulyd24h0d87qrObWiUg_VrWZs8GzPfLrm6BGO2oyRkmIbqCXIT-oUPW73CV7pH_42nGjD7yk7vO_J1ciOJeL3BXr2ig/s1600/SeriesEntity8.PNG" imageanchor="1"><img border="0" height="348" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFbL74dzppgsxvxixTzxRz2zeSx_nO3JvjAcd9EJ7vHWFSKBlyulyd24h0d87qrObWiUg_VrWZs8GzPfLrm6BGO2oyRkmIbqCXIT-oUPW73CV7pH_42nGjD7yk7vO_J1ciOJeL3BXr2ig/s640/SeriesEntity8.PNG" width="640" /></a><br />
<br />
<span style="font-family: Verdana, sans-serif;">
Next, Delete the default class (class1.cs)
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Right click on the project and select Add new item
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Select ADO.NET Entity data model.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Change the name as EmployeeModel.edmx</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">After successfully adding the project.
Business Layer
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">RightClick on the solution and select new class library </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, change the name as SeriesBO</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Change the class name as EMP </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> Next, Add the SeriesEntity dll reference to this SeriesBO project(for this you need to rightclick on the project and select
Add reference Tab and then select Seriesentity dll file)
and write the following code inside the class </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><span style="color: red;">---------------------------------------------------------------------------------------------</span></span><br />
<span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span>
<span style="font-family: Verdana, sans-serif;">using System; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.Collections.Generic; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.Linq; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.Text; </span><br />
<span style="font-family: Verdana, sans-serif;">using SeriesEntity; </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> namespace SeriesBO </span><br />
<span style="font-family: Verdana, sans-serif;">{</span><br />
<span style="font-family: Verdana, sans-serif;"> public class Emp </span><br />
<span style="font-family: Verdana, sans-serif;"> { </span><br />
<span style="font-family: Verdana, sans-serif;"> public List<employee> GetAllEmployee() </employee></span><br />
<employee><span style="font-family: Verdana, sans-serif;"> { </span></employee><br />
<employee><span style="font-family: Verdana, sans-serif;"> dbInvent db = new dbInvent();</span></employee><br />
<employee><span style="font-family: Verdana, sans-serif;"> List<employee> boemp = new List<employee>(); </employee></employee></span></employee><br />
<employee><employee><employee><span style="font-family: Verdana, sans-serif;"> return boemp = db.Employees.ToList<employee>(); </employee></span></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> }</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> }</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> } </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> Now, Build the project of seriesBO </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><b>Service Integration Layer</b> :
</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">Right click on the solution and select new WCF service application project.
Next, Change the project name as SeriesService</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> Next, Add SeriesBO dll to SeriesService project </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> Next, Open te Service1.svc file and write the following code </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Collections.Generic;</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Linq; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Runtime.Serialization; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.ServiceModel; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.ServiceModel.Web; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Text;</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.ServiceModel.Activation; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using SeriesBO;</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using SeriesEntity; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using Newtonsoft.Json; </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">namespace SeriesService </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">{ </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in code, svc and
config file together.</span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> [ServiceBehavior(InstanceContextMode = InstanceContextMode.Single)] </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee>
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> public class Service1 : IService1 </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> { </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> Emp emps = new Emp(); </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> public string GetEmployees() </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> { </span></employee></employee></employee></employee><br />
<employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> IList<employee> list = emps.GetAllEmployee();</employee></span></employee></employee></employee></employee><br />
<br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> string json = JsonConvert.SerializeObject(list.Select(m =>
new
{ CustomerID = m.EmployeeID,
FirstName = m.FirstName,
LastName = m.LastName,
Status = m.Status
}
)); </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> return json;</span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> } </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"> } </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">} </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee></employee>
<employee><employee><employee><employee><employee><span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span></employee></employee></employee></employee></employee>
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">Note : Here we have added Newtonsoft.json library file to our project.</span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">you can download this file source code </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee></employee><employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">Now,Open the Iservice.cs file and write the following code </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><br /></span></employee></employee></employee></employee></employee>
<employee><employee><employee><employee><employee><span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span></employee></employee></employee></employee></employee>
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Collections.Generic; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Linq; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Runtime.Serialization; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.ServiceModel; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.ServiceModel.Web; </span></employee></employee></employee></employee></employee><br />
<employee><employee><employee><employee><employee><span style="font-family: Verdana, sans-serif;">using System.Text; </span></employee></employee></employee></employee></employee><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">namespace SeriesService </span><br />
<span style="font-family: Verdana, sans-serif;">{
// NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code
and config file together. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> [ServiceContract]
public interface IService1
{
[OperationContract] </span><br />
<span style="font-family: Verdana, sans-serif;"> [WebGet(UriTemplate = "GetEmployees", BodyStyle = WebMessageBodyStyle.Bare)] </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> string GetEmployees(); </span><br />
<span style="font-family: Verdana, sans-serif;"> } </span><br />
<span style="font-family: Verdana, sans-serif;"> } </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span>
<b><span style="font-family: Verdana, sans-serif;"> Most Important part : </span></b><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> Open the web config file and replace the following code in between the system.servicemodel </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> <system .servicemodel=""><servicehostingenvironment multiplesitebindingsenabled="true"><behaviors><endpointbehaviors><behavior name="webhtttpbehavior"><datacontractserializer maxitemsinobjectgraph="2147483647"><webhttp automaticformatselectionenabled="false" defaultoutgoingresponseformat="Json" helpenabled="true"></webhttp></datacontractserializer></behavior></endpointbehaviors><servicebehaviors><behavior name="mexhttpbehavior"><servicemetadata httpgetenabled="true"><datacontractserializer></datacontractserializer></servicemetadata></behavior><behavior name=""><servicemetadata httpgetenabled="true"><servicedebug includeexceptiondetailinfaults="false"></servicedebug></servicemetadata></behavior></servicebehaviors></behaviors><bindings><webhttpbinding><binding maxbuffersize="2147483647" maxreceivedmessagesize="2147483647" name="webhttpSecurity"><readerquotas maxarraylength="2147483647" maxstringcontentlength="2147483647"></readerquotas></binding></webhttpbinding></bindings><services><service behaviorconfiguration="mexhttpbehavior" name="SeriesService.Service1"><endpoint address="" behaviorconfiguration="webhtttpbehavior" binding="webHttpBinding" contract="SeriesService.IService1"><endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange"></endpoint></endpoint></service></services></servicehostingenvironment></system>Now build the project. That's it we have successfully created the service. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">you can check the output in browser by using the
following url
http://localhost/Service1.svc/GetEmployees
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<b><span style="font-family: Verdana, sans-serif;">Client Application : </span></b><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"> Now, its time to create a client application </span><br />
<span style="font-family: Verdana, sans-serif;">Right click on the solution and select new asp.net website or web application as per your requirement. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Open the Default.aspx page and add one gridview </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next, Open the default.aspx.cs page and Add the following namespaces </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span><br />
<span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span>
<span style="font-family: Verdana, sans-serif;">using System;</span><br />
<span style="font-family: Verdana, sans-serif;">using System.Net; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.IO; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.Web.Script.Serialization; </span><br />
<span style="font-family: Verdana, sans-serif;">using System.Data;
using Newtonsoft.Json; </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Next,write the following code in page load </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">string URL = "http://localhost:4850/Service1.svc/GetEmployees"; </span><br />
<span style="font-family: Verdana, sans-serif;">string ResponseType = "Json"; </span><br />
<span style="font-family: Verdana, sans-serif;">WebClient client = new WebClient(); </span><br />
<span style="font-family: Verdana, sans-serif;">Stream data = client.OpenRead(URL); </span><br />
<span style="font-family: Verdana, sans-serif;">client.Headers["Content-type"] = @"application/" + ResponseType; </span><br />
<span style="font-family: Verdana, sans-serif;">StreamReader reader = new StreamReader(data); </span><br />
<span style="font-family: Verdana, sans-serif;">string str = string.Empty;
str = reader.ReadLine(); </span><br />
<span style="font-family: Verdana, sans-serif;">JavaScriptSerializer ser = new JavaScriptSerializer(); </span><br />
<span style="font-family: Verdana, sans-serif;">DataTable dt = JsonConvert.DeserializeObject<datatable>(ser.DeserializeObject(str).ToString());
GridView1.DataSource = dt;
GridView1.DataBind();
</datatable></span><br />
<datatable><span style="font-family: Verdana, sans-serif;"><br /></span></datatable>
<datatable><span style="color: red; font-family: Verdana, sans-serif;">---------------------------------------------------------------------------------------------</span></datatable><br />
<datatable><span style="font-family: Verdana, sans-serif;"><span style="color: red;"><br /></span></span></datatable>
<datatable><span style="font-family: Verdana, sans-serif;">Now build the project and run the default.aspx page.
That's it..</span>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-85930750121867315122013-03-14T00:45:00.000+05:302013-09-09T21:56:54.397+05:30Simple way to display information from another Website<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Simple way to display information from another Website" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh_ZXfJS_nP1ka17BKu1Rh0RDI7uixZLRE9cx_PrpH6ruZvqBCFMhY6YnJ9zGYGG833Wefqtp4DtgBcoamgjKZm4llx2XA-kXnoGwPRfk8YLq0hQ6Y-HFt_jmosdTTWmSFI9qmrQa2M6hE/s1600/TrickWebsite.png" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">Here i would like to share a simple trick to display information from another website using Web response.By using this trick we can display information from others website using the website URL either statically or dynamically. Already i have shared some </span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">articles
"<a href="http://www.developerscode.com/2013/01/how-to-get-images-with-pagination-using.html" target="_blank"><span style="color: blue;"><b>How to get Images from others wesbite using url</b></span></a>" and "<a href="http://www.developerscode.com/2013/01/how-to-get-title-and-meta-tags-with-url.html" target="_blank"><span style="color: blue;"><b>How to get title and meta tags from others website using URL</b></span></a>".
So lets start how to implement this trick
First, Select one New asp.net website
Next, Add one Label in design page
Code :
</span><br />
<pre class="cpp" name="code"><span style="font-family: Verdana, sans-serif;">
<asp:label id="lblDisplay" runat="server">
</asp:label></span></pre>
<span style="font-family: Verdana, sans-serif;">
Next, Add the following namespaces in code behind
</span><br />
<pre class="cpp" name="code">using System;
using System.Net;
using System.IO;
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, Write the following code in Page load
</span><br />
<pre class="cpp" name="code">
WebRequest wReq = WebRequest.Create("http://www.developerscode.com");
WebResponse mRes = wReq.GetResponse();
StreamReader sr = new StreamReader(mRes.GetResponseStream());
string sHTML = sr.ReadToEnd();
sr.Close();
mRes.Close();
if (sHTML != string.Empty && sHTML != null)
{
lblDisplay.Text = sHTML;
}
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it.Happy coding
</span>
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-28115845824483344142013-02-10T13:13:00.000+05:302013-09-09T21:57:47.846+05:30Simple Way to create Timer using Javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Timer_Javascript" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiY-Sk-wOEsMdJUxs4FiLyQ54v__lIP1876riRBKxn_2-JkSNRwkK9WQ4ASUl5xZ34KeboCsFxAVLw-k5hnTfQ0JORxvGE6PWEc0GxjhXn6e66nEyLtKX-qTZD_crhv1hqrz8IEn8g7-HM/s400/Timer.png" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain how to create a simple timer control using javascript.In my previous article's i already explained about
Get Title and meta Tags using Asp.net and c#, and How to track user information while and Login and Logout using Asp.net and c#.
Here I am going to share the trick for creation of Javascript Timer control.</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">
Following is the main logic to display dynamic timer using javascript.</span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5HNiIIpODwwQmsAT-JbJOL3E-FULs3_Y2zxlSvAty4LW8zO8vIDBsBwz7ESnIj-i94lO_lWDrs8I97ClL-iRMy-cv26Wj7So0HiSeJ7xjAUt-l4DgrkEmdEu8Yo8_eh_cixlvfIggMVg/s1600/Timeroutput.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg5HNiIIpODwwQmsAT-JbJOL3E-FULs3_Y2zxlSvAty4LW8zO8vIDBsBwz7ESnIj-i94lO_lWDrs8I97ClL-iRMy-cv26Wj7So0HiSeJ7xjAUt-l4DgrkEmdEu8Yo8_eh_cixlvfIggMVg/s1600/Timeroutput.png" /></a></div>
<br />
<span style="font-family: Verdana, sans-serif;"><b>
Main Logic in Javascript:
</b></span>
<br />
<a href="http://developerscode.somee.com/Timer/default.aspx" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<a href="https://www.box.com/s/7ke9nzfs40zcuprpzqyj" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a>
<br />
<pre class="cpp" name="code">
function display() {
if (seconds > 60) {
minutessplit = seconds / 60;
minutes = [(minutessplit > 0) ? Math.floor(minutessplit) : Math.ceil(minutessplit)];
seconds = (minutes * 60) - seconds;
}
gettime();
}
function gettime() {
if (milisec <= 0) {
milisec = 9;
seconds -= 1;
}
if (seconds <= -1) {
seconds = 60;
milisec = 0;
minutes -= 1;
}
if (minutes <= -1) {
seconds = 0;
minutes += 1;
}
else
milisec -= 1
document.getElementById('d2').value = minutes + ":" + seconds + " : " + milisec;
if (minutes == 0 && seconds == 0 && milisec == 0) {
alert("Time Out");
}
else {
setTimeout("gettime()", 100)
}
}
</pre>
<span style="font-family: Verdana, sans-serif;"><b>
Design part in Html
</b></span><br />
<pre class="cpp" name="code">
<ul data-divider-theme="d" data-inline="false" data-inset="true" data-role="listview" data-theme="d" id="categorydetaillist">
<li><span style="color: black; font-family: Verdana; font-size: Medium;">Timer : 10-Secs</span></li>
<li><span style="color: black; font-family: Verdana; font-size: Medium;">Timer : 30-Secs</span></li>
<li><span style="color: black; font-family: Verdana; font-size: Medium;">Timer : 1-Min</span></li>
<li><span style="color: black; font-family: Verdana; font-size: Medium;">Timer : 2-Mins</span></li>
<li><span style="color: black; font-family: Verdana; font-size: Medium;">Timer : 3-Mins</span></li>
</ul>
</pre>
<span style="font-family: Verdana, sans-serif;">That's it..Please let me know if you have any issues.
</span><br />
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-42300247858436429882013-01-23T00:02:00.001+05:302013-09-09T21:59:36.433+05:30How to get Images with pagination using live url, asp.net and c#<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="GetImages" height="200px" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaRdx4jEvQzRQBCRCIas7NTlgOOD_gWTwsjw434jIyfnLC5T7xzvGdSavLXsNF__qjyabUuTZey_ASu_guCrocj0sCipCunZ73bAnS0EXY5pQqdJ1-TsLtBv7g1mxtfJKQKP7wgMvArCk/s1600/GetImages.png" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain the procedure of how to get Images with url using <a href="http://www.developerscode.com/search/label/Aspnet" target="_blank"><b><span style="color: blue;"> asp.net</span></b> </a> and <a href="http://www.developerscode.com/search/label/C%23" target="_blank"><span style="color: blue;">c#</span></a>
In my previous articles i already explained about <span style="color: blue;"><b><a href="http://www.developerscode.com/2013/01/how-to-get-title-and-meta-tags-with-url.html" target="_blank"><span style="color: blue;">How to get the Title and Meta Tags with url using asp.net and c#</span></a> </b></span>, <a href="http://www.developerscode.com/2013/01/create-basic-comments-section-with.html" target="_blank"><b><span style="color: blue;">Basic comments section using Asp.net and c#</span></b></a> ,
<a href="http://www.developerscode.com/2013/01/track-user-login-information-using.html" target="_blank"><b><span style="color: blue;">Tracking User information using Asp.net and c#</span></b></a> and <a href="http://www.developerscode.com/2013/01/simple-steps-to-create-currency.html" target="_blank"><b><span style="color: blue;">Currency converter application using Asp.net and c#</span></b></a> </span><br />
<span style="font-family: Verdana, sans-serif;"></span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">Here i am going to explain how to fetch the images with live url, just like in facebook.</span><br />
<span style="font-family: Verdana, sans-serif;">So lets start
</span><br />
<a href="http://developerscode.somee.com/fetchimages/default.aspx" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<a href="https://www.box.com/s/v55tyucqv6thvlxfaqz2" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a>
<br />
<span style="font-family: Verdana, sans-serif;">First Open the visual studio asp.net and select one new website </span><br />
<span style="font-family: Verdana, sans-serif;">Next,Add 1 Textbox control to Default.aspx page for URL entry </span><br />
<span style="font-family: Verdana, sans-serif;">Next,Add the Listview in order to display the images </span><br />
<span style="font-family: Verdana, sans-serif;">Next Add the following code in default.aspx for listview pagination
</span><br />
<pre class="cpp" name="code">
<asp:listview id="lvImages" runat="server">
<layouttemplate>
</layouttemplate>
</asp:listview>
<div class="datatable">
<table cellpadding="0" cellspacing="0" class="grid" enableviewstate="false" id="products" runat="server">
<tbody>
<tr>
<th></th>
</tr>
<tr id="itemPlaceholder" runat="server">
</tr>
</tbody></table>
<div class="pager">
<span style="font-family: Verdana, sans-serif;">
<asp:datapager id="pagerBottom" onprerender="pagerTop_OnPrerender" pagedcontrolid="lv" pagesize="1" runat="server">
<fields>
<asp:nextpreviouspagerfield buttoncssclass="command" firstpagetext="«" previouspagetext="‹" renderdisabledbuttonsaslabels="true" showfirstpagebutton="true" showlastpagebutton="false" shownextpagebutton="false" showpreviouspagebutton="true">
<asp:numericpagerfield buttoncount="1" currentpagelabelcssclass="current" nextpreviousbuttoncssclass="command" numericbuttoncssclass="command">
<asp:nextpreviouspagerfield buttoncssclass="command" lastpagetext="»" nextpagetext="›" renderdisabledbuttonsaslabels="true" showfirstpagebutton="false" showlastpagebutton="true" shownextpagebutton="true" showpreviouspagebutton="false">
</asp:nextpreviouspagerfield>
</asp:numericpagerfield>
</asp:nextpreviouspagerfield>
</fields>
</asp:datapager>
</span>
</div>
</div>
<span style="font-family: Verdana, sans-serif;">
<itemtemplate>
<asp:image height="200px" id="pictureControlID" imageurl="<%#Eval("Name") %>" runat="server" width="200px">
</asp:image>
</itemtemplate>
</span>
</pre>
Next,Call the following method in textchanged Event of URL textbox
<br />
<pre class="cpp" name="code"> protected void txtFetchURL_TextChanged(object sender, EventArgs e)
{
//Get the url
String url = txtURL.Text;
//Method to get Meta Tags
GetImages();
}
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, write the following code in GetImages Method
</span><br />
<pre class="cpp" name="code">private void GetImages()
{
//Get Images
lvImages.DataSource = SampleData();
lvImages.DataBind();
}
</pre>
<span style="font-family: Verdana, sans-serif;">
Next,Add the following code in sample data
</span><br />
<pre class="cpp" name="code"> List<product> SampleData()
{
List<product> p = new List<product>();
ImageButton[] imgval = new ImageButton[50];
int i = 0;
foreach (string image in FetchImages(txtFetchURL.Text))
{
imgval[i] = new ImageButton();
imgval[i].ImageUrl = image;
if (imgval[i] != null)
{
p.Add(new Product() { Name = image });
}
i++;
}
return p;
}
public class Product
{
public string Name { get; set; }
}
public List<string> FetchImages(string Url)
{
List<string> imageList = new List<string>();
//Append http:// if necessary
if (!Url.StartsWith("http://") && !Url.StartsWith("https://"))
Url = "http://" + Url;
string responseUrl = string.Empty;
string htmlData = ASCIIEncoding.ASCII.GetString(DownloadData(Url, out responseUrl));
if (responseUrl != string.Empty)
Url = responseUrl;
if (htmlData != string.Empty)
{
string imageHtmlCode = "<img -1="-1" brackedend="htmlData.IndexOf(" data="data" emove="emove" htmldata="htmlData.Substring(index);" image="image" imagesrccode="@" ind="ind" index="index" int="int" location="location" mark="mark" of="of" previous="previous" quotes="quotes" s="s" src="" string="string" that="that" the="the" two="two" while="while" />'); //make sure data will be inside img tag
int start = htmlData.IndexOf(imageSrcCode) + imageSrcCode.Length;
int end = htmlData.IndexOf('"', start + 1);
//Extract the line
if (end > start && start < brackedEnd)
{
string loc = htmlData.Substring(start, end - start);
//Store line
imageList.Add(loc);
}
//Move index to next image location
if (imageHtmlCode.Length < htmlData.Length)
index = htmlData.IndexOf(imageHtmlCode, imageHtmlCode.Length);
else
index = -1;
}
//Format the image URLs
for (int i = 0; i < imageList.Count; i++)
{
string img = imageList[i];
string baseUrl = GetBaseURL(Url);
if ((!img.StartsWith("http://") && !img.StartsWith("https://")) && baseUrl != string.Empty)
img = baseUrl + "/" + img.TrimStart('/');
imageList[i] = img;
}
}
return imageList;
}
</pre>
<pre class="cpp" name="code">
private byte[] DownloadData(string Url)
{
string empty = string.Empty;
return DownloadData(Url, out empty);
}
private byte[] DownloadData(string Url, out string responseUrl)
{
byte[] downloadedData = new byte[0];
try
{
//Get a data stream from the url
WebRequest req = WebRequest.Create(Url);
WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
responseUrl = response.ResponseUri.ToString();
//Download in chuncks
byte[] buffer = new byte[1024];
//Get Total Size
int dataLength = (int)response.ContentLength;
//Download to memory
//Note: adjust the streams here to download directly to the hard drive
MemoryStream memStream = new MemoryStream();
while (true)
{
//Try to read the data
int bytesRead = stream.Read(buffer, 0, buffer.Length);
if (bytesRead == 0)
{
break;
}
else
{
//Write the downloaded data
memStream.Write(buffer, 0, bytesRead);
}
}
//Convert the downloaded stream to a byte array
downloadedData = memStream.ToArray();
//Clean up
stream.Close();
memStream.Close();
}
catch (Exception)
{
responseUrl = string.Empty;
return new byte[0];
}
return downloadedData;
}
private System.Drawing.Image ImageFromURL(string Url)
{
byte[] imageData = DownloadData(Url);
System.Drawing.Image img = null;
try
{
MemoryStream stream = new MemoryStream(imageData);
img = System.Drawing.Image.FromStream(stream);
stream.Close();
}
catch (Exception)
{
}
return img;
}
private string GetBaseURL(string Url)
{
int inx = Url.IndexOf("://") + "://".Length;
int end = Url.IndexOf('/', inx);
string baseUrl = string.Empty;
if (end != -1)
return Url.Substring(0, end);
else
return string.Empty;
}
</pre>
<span style="font-family: Verdana, sans-serif;">
Next, write the following code in MetaTags Method
For pagination, </span><br />
<div>
<span style="font-family: Verdana, sans-serif;">Add the following event
</span><br />
<pre class="cpp" name="code">protected void pagerTop_OnPrerender(object sender, EventArgs e)
{
GetImages();
}
</pre>
<span style="font-family: Verdana, sans-serif;">I hope this article will helps you..if you need any help share your valuable comments..Happy coding
</span><br />
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-28309233485900021912013-01-22T23:48:00.001+05:302013-09-09T22:00:53.625+05:30Auto Email misspell Checker using Mail Check<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="EmailChecker" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgP30BKIzUssnjgbTQmbIZtposEfQqqPX_m0rMIGzZMRAXlOojADbXYqFG082P4idmW9l3mw4JBDSn_kHnWFPf3NWx9kEF09dkyZ1CGI8zLAG2UTJsKAmUCoe8dUNl518GBm6NbMP7jNM/s1600/EmailChecker.png" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article I would like to share the Auto Email Misspell Checker feature Using <a href="http://kicksend.com/join" target="_blank"><b><span style="color: blue;">Mail Check</span></b></a>
In previous article i have already explain the articles <a href="http://www.developerscode.com/2013/01/create-basic-comments-section-with.html" target="_blank"><b><span style="color: blue;">Basic comments section using asp.net and c#</span></b></a> , <a href="http://www.developerscode.com/2013/01/simple-logic-to-display-tooltip-in.html" target="_blank"><b><span style="color: blue;">Display Tooltip using Javascript</span></b></a>
The main feature of Auto Email Misspell Checker is,it reduces the typos in email addresses during sign ups.</span><br />
<a name='more'></a><br />
<img border="0" height="203" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJk2sM_iTr2rgLX29iUixb5_JOW4NwTuzEwrMd7FORIMpOYfscKUSRe-8tzU1fNnaEbgqr2Qd3b7AXVMndXQZn7Hr9BYiBOd8ndprqinLiyw86nCp1cz5gckc5YHSw0nAchCic7StshcM/s640/Email+Checker.png" width="640" />
<a href="https://github.com/Kicksend/mailcheck" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a>
<a href="http://kicksend.com/users/sign_in" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<br />
<span style="font-family: Verdana, sans-serif;">So lets start,</span><br />
<span style="font-family: Verdana, sans-serif;">How to use this functionality in our web applications
first include 2 jquery files
</span><br />
<pre class="cpp" name="code"><script src="jquery.min.js"></script>
<script src="mailcheck.min.js"></script>
</pre>
<span style="font-family: Verdana, sans-serif;">Next,Add one text box in default.aspx </span><br />
<span style="font-family: Verdana, sans-serif;"> Next,Add the javascript
</span><br />
<pre class="cpp" name="code"><script>
var domains = ['yahoomail.com', 'gmail.com', 'hotmail.com'];
var topLevelDomains = ["com", "net", "org"];
var superStringDistance = function (string1, string2) {
// a string distance algorithm of your choosing
}
$('#email').on('blur', function () {
$(this).mailcheck({
domains: domains, // optional
topLevelDomains: topLevelDomains, // optional
distanceFunction: superStringDistance, // optional
suggested: function (element, suggestion) {
// callback code
},
empty: function (element) {
// callback code
}
});
});
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">That's it..I hope this article will helps you..Happy coding
</span><br />
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-54754181572630697892013-01-22T00:38:00.001+05:302013-09-09T22:01:44.337+05:30How to get Title and Meta Tags with url using asp.net and c#<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="titleandmetatags" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgQY7S8jHUuQPZNoda7NbZoAlMnYjfpBoHddcfHzDNR0Xk5yWAlR8bwb38KqxIPskcRv9808yDc9Bxt_GGEEzhyoemt8m3vKel6wl-5iaxUg8_ngLHji7TCtwnPpPEjUpVtyqmtcrq110s/s1600/titleandmetatags.png" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain the procedure of getting the Title and Meta Tags with url using <a href="http://www.developerscode.com/search/label/Aspnet" target="_blank"><span style="color: blue;"><b> asp.net</b></span> </a> and <a href="http://www.developerscode.com/search/label/C%23" target="_blank"><b><span style="color: blue;">c#</span></b></a>
In my previous articles i already explained about <a href="http://www.developerscode.com/2013/01/create-basic-comments-section-with.html" target="_blank"><b><span style="color: blue;">Basic comments section using Asp.net and c#</span></b></a> , <a href="http://www.developerscode.com/2013/01/track-user-login-information-using.html" style="color: blue; font-weight: bold;" target="_blank">Tracking User information using Asp.net and c#</a><span style="color: blue; font-weight: bold;"> </span>and<span style="color: blue; font-weight: bold;"> </span><a href="http://www.developerscode.com/2013/01/simple-steps-to-create-currency.html" target="_blank"><b><span style="color: blue;">Currency converter application using Asp.net and c#</span></b></a>
Here i am going to explain how to fetch the title and meta tags with live url, just like in Facebook.</span><br />
<a name='more'></a><br />
<a href="http://developerscode.somee.com/FetchTitle/default.aspx" style="clear: left; display: inline !important; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<a href="https://www.box.com/s/o29qejiqu6gyx2ocpj13" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a>
<br />
<br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">So lets start...</span><br />
<span style="font-family: Verdana, sans-serif;">First Open the visual studio asp.net and select one new website</span><br />
<span style="font-family: Verdana, sans-serif;">Next,Add 3 Textbox controls to Default.aspx page. </span><br />
<span style="font-family: Verdana, sans-serif;">One Textbox for URL entry </span><br />
<span style="font-family: Verdana, sans-serif;">Second Textbox to display Title from url
and </span><br />
<span style="font-family: Verdana, sans-serif;">last Textbox to display Meta Description from url </span><br />
<span style="font-family: Verdana, sans-serif;">Next,Call the following methods in textchanged Event of URL textbox
</span><br />
<pre class="cpp" name="code">
protected void txtFetchURL_TextChanged(object sender, EventArgs e)
{
//Get the url
String url = txtURL.Text;
//Method to get Title
GetTitle();
//Method to get Meta Tags
GetMetaTags();
}
</pre>
<span style="font-family: Verdana, sans-serif;">Next, write the following code in Title Method
</span>
<br />
<pre class="cpp" name="code">
private void GetTitle()
{
//Get Title
WebClient x = new WebClient();
string source = x.DownloadString(url);
}
</pre>
<span style="font-family: Verdana, sans-serif;">Next, write the following code in MetaTags Method
</span><br />
<pre class="cpp" name="code">private void GetMetaTags()
{
//Get Meta Tags
var webGet = new HtmlWeb();
var document = webGet.Load(url);
var metaTags = document.DocumentNode.SelectNodes("//meta");
if (metaTags != null)
{
foreach (var tag in metaTags)
{
if (tag.Attributes["name"] != null && tag.Attributes["content"] != null)
{
if (tag.Attributes["name"].Value == "description")
{
txtDescription.Text = tag.Attributes["content"].Value;
}
}
}
}
}
</pre>
<span style="font-family: Verdana, sans-serif;">In the above method we are getting only description meta tag.</span><br />
<span style="font-family: Verdana, sans-serif;">if you want any thing else just add the MetaTag name. </span><br />
<span style="font-family: Verdana, sans-serif;"><b><span style="color: red;">For Example :</span></b> <b>tag.Attributes["name"].Value == "keywords"</b></span><br />
<br />
<span style="font-family: Verdana, sans-serif;">I hope this article will helps you..if you need any help share your valuable comments..Happy coding
</span><br />
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-57175933764703831782013-01-09T22:16:00.000+05:302013-09-09T22:36:50.817+05:30Simple logic to display tooltip in Asp.net using Jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvASwxmgCCkMx77XB0OM4mOXsfg-nC4zRKzR2czthJPhPf2Mw5dD2yJ_dTlOEpyQGEXAIDaBLrOo4I6EQ2cTJ9IHJFLNZWxWDNvsVR9bO_YMapSJMDx6jmac4W5ySdgGX1E-5PPDf6TFU/s1600/Tooltip_Aspnet.PNG" height="200px" width="200px" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to share a simple logic to display tooltip in asp.net using Jquery. I have already shared articles related tooltips Example:
How to display Tooltip in gridview <a href="http://www.developerscode.com/2011/02/how-to-display-data-in-tooltip-in_3418.html"><span style="color: blue;"><b>http://www.developerscode.com/2011/02/how-to-display-data-in-tooltip-in_3418.html</b></span></a></span><span style="font-family: Verdana, sans-serif;">. This time, I would like to share a simple logic to display a tooltip for any control of asp.net applications.</span><br />
<span style="font-family: Verdana, sans-serif;"></span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">So lets start the implementation
First,Add these script files in your head section
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<a href="http://www.developerscode.somee.com/tooltip/default.aspx" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<br />
<pre class="cpp" name="code"><link href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" rel="stylesheet"></link>
<script src="http://code.jquery.com/jquery-1.8.3.js" type="text/javascript"></script>
<script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$(document).tooltip();
});
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">Next,Add the message to the controls in order to display in tooltips.
Check the following code.
</span><br />
<pre class="cpp" name="code">
FirstName: <asp:textbox id="TextBox1" runat="server" title="Please Enter FirstName"></asp:textbox>
LastName: <asp:textbox id="TextBox2" runat="server" title="Please Enter LastName"></asp:textbox>
Email: <asp:textbox id="TextBox3" runat="server" title="Please Enter Email"></asp:textbox>
Phone:&nbsp <asp:textbox id="TextBox4" runat="server" title="Please Enter Phone"></asp:textbox>
</pre>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-14309675982557008352013-01-08T00:11:00.002+05:302013-09-09T22:37:14.742+05:30Track user login information using Asp.net,c# and javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="user Information" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiseAqw6mTXEII72zn3v2IriTM0t1nYD9lVBHD2zynKHwiOg0NDzXujJyDbjmB1UxF0DS718gPNGY-26Yygn4NtJBkUVPd4BlbeBGmJNnzs4kzuGOM0myezL2EGj-Jmp-5rXbGlLly2fPc/s400/TrackUserInformation.PNG" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;"></span><br />
<span style="font-family: Verdana, sans-serif;">In this article, i would like to explain the process of tracking user information using asp.net,c# and javascript.In my previous article i already explained <a href="http://www.developerscode.com/2011/02/how-to-create-login-page-in-aspnet-with.html" target="_blank"><span style="color: blue;"><b>how to create a login page using asp.net,c# and sqlserver</b></span></a> and <a href="http://www.developerscode.com/2011/02/how-to-create-logout-page-using.html" target="_blank"><span style="color: blue;"><b>how to create logout using asp.net</b></span></a>.this time i would like to explain the tracking of user login and logout information</span><br />
<br />
<a name='more'></a><br />
<span style="font-family: Verdana, sans-serif;">Lets start
Here is the list we are going to track user information</span><br />
<br />
<ul style="text-align: left;">
<li><span style="font-family: Verdana, sans-serif;">IP Address </span></li>
<li><span style="font-family: Verdana, sans-serif;">Location </span></li>
<li><span style="font-family: Verdana, sans-serif;">User </span></li>
<li><span style="font-family: Verdana, sans-serif;">Computer/Server </span></li>
<li><span style="font-family: Verdana, sans-serif;">Date
Time </span></li>
</ul>
<span style="font-family: Verdana, sans-serif;">First start with IP Address :</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>How to get client IP..?</b></span><br />
<b style="font-family: Verdana, sans-serif;"><br /></b>
<b style="font-family: Verdana, sans-serif;">Solution :</b><br />
<b style="font-family: Verdana, sans-serif;"><br /></b>
<br />
<pre class="cpp" name="code"> string ipaddress = GetIPAddress();
public string GetIPAddress()
{
try
{
string ipAdd;
HttpRequest currentRequest = HttpContext.Current.Request;
ipAdd = currentRequest.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (ipAdd == null || ipAdd.ToLower() == "unknown")
ipAdd = currentRequest.ServerVariables["REMOTE_ADDR"];
return ipAdd;
}
catch (Exception ex)
{
throw ex;
}
}
</pre>
<div>
<br /></div>
<span style="font-family: Verdana, sans-serif;">Next,How to get Location of user.?</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b>Solution :</b></span><br />
<pre class="cpp" name="code"> <script type="text/javascript">
function getloc() {
alert("Your location is: " + geoplugin_countryName());
}
</script>
</pre>
<span style="font-family: Verdana, sans-serif;">That's it, We successfully tracked the IP address and Location.</span><br />
<div>
<span style="font-family: Verdana, sans-serif;">Now,Get the Server Information.
Call the following method to get the computer information
</span><br />
<pre class="cpp" name="code">string Serverinfo = GetServerInfo();
public string GetServerInfo()
{
try
{
string Sinfo;
HttpRequest currentRequest = HttpContext.Current.Request;
Sinfo = currentRequest.ServerVariables["HTTP_X_FORWARDED_FOR"];
if (Sinfo == null || Sinfo.ToLower() == "unknown")
{
Sinfo = currentRequest.ServerVariables["REMOTE_ADDR"];
Sinfo += "/" + currentRequest.ServerVariables["LOGON_USER"];
}
string[] computerinfo = Sinfo.Split('/');
return computerinfo[1];
}
catch (Exception ex)
{
throw ex;
}
}
</pre>
<span style="font-family: Verdana, sans-serif;">Main part of the functionality is over.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Now its time to get the username,date and time.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;">For getting username,just read user session value like this
</span><br />
<pre class="cpp" name="code">string UserInfo = Session["UserName"].ToString();
</pre>
<span style="font-family: Verdana, sans-serif;">For date and time
Write the following line
</span><br />
<pre class="cpp" name="code">string Datetime = Convert.ToString(DateTime.Now);
</pre>
<span style="font-family: Verdana, sans-serif;">Now we have all the information of the user.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Now its time to store the data in database. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">For this ,First we need to create an table called <b>Employeeinformation </b></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Following are the columns. </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">TrackId int primaryKey </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">IPAddress varchar(15) </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Location varchar(15) </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">User varchar(20) </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Server varchar(20) </span></div>
<div>
<span style="font-family: Verdana, sans-serif;">DateandTime datetime
Save the Table...!!! </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Next,Again come back to .cs page and write the following logic inorder to insert the user information
before this, call the method from page load
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<br />
<pre class="cpp" name="code"> protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
string ipaddress = GetIPAddress();
string Location=GetLocation();
string Serverinfo = GetServerInfo();
string UserInfo = Session["UserName"].ToString();
string Datetime = Convert.ToString(DateTime.Now);
InsertInformation(ipaddress)
}
}
Public void InsertInformation(ipaddress,Location,Serverinfo,UserInfo,Datetime)
{
string ConString = System.Configuration.ConfigurationManager.ConnectionStrings["dbconnection"].ConnectionString;
SqlConnection con = new SqlConnection(ConString);
SqlCommand com=new SqlCommand("insert into Employeeinformation(IPAddress,Location,User,Server,Datetime) values('"+ipaddress+"','"+Location+"','"+Serverinfo+"','"+UserInfo+"','"+Datetime+"')",con);
com.ExecuteNonQuery();
}
</pre>
<span style="color: red; font-family: Verdana, sans-serif;"><b>Click on the image to enlarge
</b></span><br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUS4HM5Aq81NuEFiISIQpeMHgmtwvgFGziuh3Rnw9VTDN4wLuQm9iA2j7QWsbwTrNXLZlRE-_86-44qNtUYziaSWWbGC_KcIAGj7Npi58R9K3osh6gLMWjGmjk4LxKSf-7T3JJ5THAa38/s1600/EmpInfo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="248" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhUS4HM5Aq81NuEFiISIQpeMHgmtwvgFGziuh3Rnw9VTDN4wLuQm9iA2j7QWsbwTrNXLZlRE-_86-44qNtUYziaSWWbGC_KcIAGj7Npi58R9K3osh6gLMWjGmjk4LxKSf-7T3JJ5THAa38/s640/EmpInfo.png" width="640" /></a></div>
<span style="font-family: Verdana, sans-serif;">That's it,Finally we have completed the coding part. </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><b><span style="color: red;">Note :</span></b> For explanation purpose i have called these methods in page load..for real time scenario we need to call these methods in button click event of login page.
Check this tutorial. and call these methods.
Now bind this information in Gridview then output will be look like this..
</span></div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-45212652901434340402013-01-06T19:09:00.000+05:302013-09-09T22:38:11.915+05:30Simple steps to create Currency converter application using Asp.net and c#<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjl3FWiWPw3qDtznrlmu0MW0dimfuNXOHpXMvn9AzGwUfahb6hkf7JiTn1VWqR6A9Jf90lQ8m9ww8NYzNDIW4_ysEf1P8t-EggLfxXO5Cn8yWoiyLKUJD_O5m9PIN1Bi1JRNZ2LWzHcBls/s400/CurrencyConverter.JPG" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">In this article i would like to explain how to create a currency converter application using Asp.net and c#.Here we are taking
the help of webservice.net in order to get the live currency values through webservice. So lets start how to implement currency converter
application.</span><br />
<br />
<a name='more'></a><br /><br />
<a href="http://currencyconverter.developerscodeapps.com/default.aspx" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="facebook_login_button" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsE3UAkjKJtKfBSsn8PZaLq3-IHhK5soWAL-pOSoxZQLLvvI06n9b8nkMoCSY72ic0Jg226ObqCQbEypdtrX0tBNQ7HOtA6us7ZE-ptjU_i-OZqKyp-M0JaytbBd98hLnL9HBYcOSTBYs/s1600/demo.gif" /></a>
<br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">First,Add one aspx page Ex: Default.aspx
Next, Drag and Drop two dropdownlists,two text boxes and one button in aspx page.
Controls :
2 Dropdownlists - One for Dropdownlist to bind From Country Currency list
</span><br />
<pre class="cpp" name="code">Properties :
ID="ddlFromCurrency"
DataSourceID="countries"
DataTextField="countrycode"
DataValueField="Id"
</pre>
<span style="font-family: Verdana, sans-serif;">
and another Dropdownlist for to bind To Country Currency list
</span><br />
<pre class="cpp" name="code">Properties :
ID="ddlToCurrency"
DataSourceID="countries"
DataTextField="countrycode"
DataValueField="Id"
</pre>
<span style="font-family: Verdana, sans-serif;"></span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><span style="font-family: Verdana, sans-serif;"><br /></span></span></div>
<span style="font-family: Verdana, sans-serif;">
2Textboxes - one textbox to accept currency value and another one to display result
One button to get result in click event.</span><br />
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<div>
<span style="font-family: Verdana, sans-serif;">Next,We need xml file which contains countries list example countries.xml.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Next,We need to bind this countries.xml file to dropdownlists </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">check this tutorial <a href="http://www.developerscode.com/2011/05/add-xml-datasource-to-gridview-dropdown.html"><span style="color: blue;">http://www.developerscode.com/2011/05/add-xml-datasource-to-gridview-dropdown.html</span></a>.</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Now coming to main part of application logic.Open the Default.aspx.cs </span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">In button click Event create one method <b>Ex : getValue(); </b></span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span></div>
<div>
<span style="font-family: Verdana, sans-serif;">Next,Write the following logic in getvalue method</span></div>
<div>
<span style="font-family: Verdana, sans-serif;"><br /></span>
<pre class="cpp" name="code"> //Get live currency values
try
{
string Result = null;
string url;
double CurrencyAmount = Convert.ToDouble(txtValue.Text);
url = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate?FromCurrency=" + ddlFromCurrency.SelectedValue + "&ToCurrency=" + ddlToCurrency.SelectedValue + "";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader Stream = new StreamReader(response.GetResponseStream());
XmlDocument doc = new XmlDocument();
Result = Stream.ReadToEnd();
doc.LoadXml(Result);
string CR = doc.GetElementsByTagName("double").Item(0).InnerText;
double ConvR = double.Parse(CR);
double ConvAmt = CurrencyAmount * ConvR;
txtresult.Text = Convert.ToString(ConvAmt);
}
catch (Exception ex)
{
lblResult.Text = ex.Message;
}
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it..If you have any doubts please share your comments
</span><br />
</div>
</div>
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-81127529439517954722013-01-01T10:22:00.000+05:302013-09-09T22:38:32.435+05:30Get unique values from json using jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="Get Unique values" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq8SHgDSeVs26HKuXdSnG3UL-QtcajAYy1NDmE5dGEDYC7fNikcHMndj-uzpEQYwaMTp_Jea-9JpQV5vBMbpV9-Ukm1Km2aZPr_qK32yMZ51M0qDJz12YkenlMqonY3FYdUNSTksSSs0A/s1600/json_records.JPG" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">Hi..In this article i would like to share a simple logic to get unqiue values from json array using jquery..
Normally we are using jquery ajax in order to bind the data.In some cases, we need to bind unqiue records from json file.
Here i would like to share two logics.First logic is the way to bind the data and another one is ,to bind the unique records</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">
</span><br />
<pre class="cpp" name="code">Consider Following is the example file of JSON.
[
{
"category": "Movie",
"type": "English"
},
{
"category": "Movie",
"type": "Hindi"
},
{
"category": "Movie",
"type": "teulgu"
},
{
"category": "games",
"type": "Cricket"
},
{
"category": "games",
"type": "chess"
},
{
"category": "games",
"type": "Cricket"
},
{
"category": "games",
"type": "chess"
},
{
"category": "hobbies",
"type": "chating"
},
{
"category": "hobbies",
"type": "singing"
},
{
"category": "hobbies",
"type": "chating"
},
{
"category": "hobbies",
"type": "singing"
}
]
</pre>
<span style="font-family: Verdana, sans-serif;">
Save this file as mydata.js..
Next write the following logic in between the script tags
Here is the logic
</span><br />
<pre class="cpp" name="code"><script type="text/javascript">
$(document).ready(function() {
var list = "";
jQuery.getJSON("mydata.json", function(data) {
//Without unique records
$.each(data, function(index, element) {
$("#Beforelogic").append("<table border='1px solid' width='400px'>
<tr><td width='200px'>" + element.category + "</td></tr>
</table>
");
});
//Apply simple logic to get unique records
$.each(data, function(index, element) {
// alert(element.category);
if (element.category != list) {
$("#AfterLogic").append("<table border='1px solid' width='400px'>
<tr><td width='200px'>" + element.category + "</td></tr>
</table>
");
list = element.category;
}
});
});
});
</script>
</pre>
<pre class="cpp" name="code"><div style="font-family: Verdana; font-size: large;">
<h1>
Display Unique Records</h1>
<table>
<tbody>
<tr>
<td><div style="color: green; font-family: Verdana; font-size: xx-large;">
Before Logic</div>
</td>
</tr>
<tr>
<td><div id="Beforelogic">
</div>
</td></tr>
<tr><td><div style="color: green; font-family: Verdana; font-size: xx-large;">
After Logic</div>
</td></tr>
<tr><td><div id="AfterLogic">
</div>
</td>
</tr>
</tbody></table>
</div>
</pre>
<span style="font-family: Verdana, sans-serif;">
That's it..Following is the output you will get
</span><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhq5bNa1Huw5qGbDCnz5FzhAlayxvgLOb3Lg26Hv4d4k3fMruTNhimN4N9dJQWL-Qz2ez49IPxvXl3B-CArda_-bOxYs0VL6tS_adPfYkyBX8z4Vsjk4nTMY8RxodgVqdie8K8DmTIeY1o/s1600/output.png" />
<br />
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-40651877255675202222012-09-02T10:31:00.002+05:302013-09-09T22:39:00.061+05:30jQuery Phone Tutorial - Making a Location Picker Web Application.<div dir="ltr" style="text-align: left;" trbidi="on"><div class="fl pic"><span style="font-family: Verdana, sans-serif;"><img alt="Locationpickerapp" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5Wr64FXuDD9ukeYTBif4o7C-xZGcSeW-Xfp1pfYLo1YRAYWWgfCGWJlXaGuNEHNYFwxrQAO9zAcoB1hNhsaINfDLp-mfpPnIhKC3L5hcAtk99xFUG7vbTEvsFkoOXl541Gs5VPKk8Lkg/s400/Locationpickerapp.jpg" style="height: 200px; width: 200px;" /></span></div><b><u><span style="font-family: Verdana, sans-serif;">Need of mobile apps</span></u></b><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">There has been change in the trend of developing mobile applications for the companies at their own. In fact, the business owners will need huge budget, special skills and good software developers to create their own </span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">niche in the mobile marketing. The ways of designing mobile apps have gone complex and sophisticated and typical. That is what most of the companies are afraid of! On the other hand, mobile apps have always played important role in the mobile marketing and it also allows the mobile owners to taste differently with a wide variety of applications available to them. Nonetheless, applications like location picker, date picker and time picker have been greatly used in the mobile apps to know the current marketing and audience position.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <b><u><span style="font-family: Verdana, sans-serif;">Elements required for Location Picker web application – jQuery</span></u></b><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">No doubt, developing native mobile applications will be a tough job for the companies but if you are interested in creating one, you will need some sort of software like jQuery. There is no denying the fact that the developer should have the appropriate skills, coding tools and the knowledge of the mobile platform on which it suitably runs. These platforms may differ from BlackNerrt, Windows, iOs and Android to other such platforms that are most common to the use in this world. Here, we will discuss the best jQuery Phone Tutorial which will help you in developing the location picker web application. Today, web applications are used in place of the native mobile apps because they act as the cross device and cross-platform for the user. These</span><br />
<span style="font-family: Verdana, sans-serif;">apps can be readily accessed from the mobile browsers.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <b><u><span style="font-family: Verdana, sans-serif;">Creating Location Picker Web Application with jQuery – tutorial</span></u></b><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">With the help of location picker application in web, the mobile users will love to find the exact </span><span style="font-family: Verdana, sans-serif;">location in the world. At the same time, they can also develop the form text input with saving </span><span style="font-family: Verdana, sans-serif;">the latitudes and longitudes.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">· To start with, the users must be able to search for the defined address in the address. It should be noted here that search button may be added automatically.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">·After this, you will get a small map which lies below which can be further moved or tuned to a fine position.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">·The developer should further note it here that location picker will be impossible to develop without the help of Google Maps API. At the same time, you will also need to have the Location Picker plug-in and the jQuery Library. Google Maps API can be used today without having the key.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;">·The time is to call for the .locationPicker function () on the object of jQuery. It can </span><span style="font-family: Verdana, sans-serif;">be simply used as pasting the coding –</span><br />
<pre class="cpp" name="code"><script src="http://maps.google.com/maps/api/js?
sensor=false" type="text/javascript"></script><span style="font-family: Verdana, sans-serif;">
<script ajax.googleapis.com="ajax.googleapis.com" ajax="ajax" http:="http:" jquery.min.js="jquery.min.js" jquery="jquery" libs="libs" type="text/javascript’src="></script>
<script src="jquery.locationpicker.js" type="text/javascript"></script>
<script type="text/javascript">
jQuery(document).ready(function(){
jQuery('input.lnglat').locationPicker();
});
</script>
</span></pre><span style="font-family: Verdana, sans-serif;">In this way, you will easily develop a mobile application in the name of Location Picker web application which will be really effective and quite comprehensive for different platforms. At the same time, you will love to use more jQuery plugins.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;"><b> Summary</b> : - jQuery is known as a popular mobile app developer and its tutorial can be</span><br />
<span style="font-family: Verdana, sans-serif;">efficiently and authentically used to develop the location picker. The jQuery plug-in should be</span><br />
<span style="font-family: Verdana, sans-serif;">used along with the jQuery library and not to forget about the Google Maps.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <br />
</div>Unknownnoreply@blogger.com1tag:blogger.com,1999:blog-892712659100500876.post-91987873604695766922012-09-02T10:13:00.000+05:302013-09-09T22:40:24.080+05:30How to find Your Desired Apps from Apps Store<div dir="ltr" style="text-align: left;" trbidi="on"><div class="fl pic"><span style="font-family: Verdana, sans-serif;"><img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjYig7inshMMv9ykOjpm8VTJvLZn8mcvppF5uOKu5dnKybCOlUFIzv1CgNjN3nvqWUyW3QUAbYvMwK-G6jsP1UBX70T4yKmEbxzqMtehV1jYzSOJKtqJ-67rihvZyqkvzbQCHFOQ5FGJpc/s400/Appsfromappstore.jpg" style="height: 200px; width: 200px;" /></span></div><span style="font-family: Verdana, sans-serif;">According to the statistics, the total number of applications currently available in the Apps store is more than 650,000. Because of this reason, finding the desired application apparently seems difficult for the users. But actually, there is not any problem which demands the</span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;"> careful attention of the users. People can simply utilize the application store available at their handheld devices and download the desired application by availing the facility of search bars. The information related to the keywords presented to the store by the users will be displayed and they can easily select their desired option. Overall a seriesof steps could be used for getting the desired application from the application store. The details of this process are presented as follows in the form of steps.<br />
<br />
<b> Gathering Preliminary information regarding Application</b><br />
<br />
• First of all, it is important that the person must be clear about the application which aims to be installed. There are several platforms which provide the online information about the latest applications and their unique characteristics. Services of any of these platforms could be acquired in the case when a person has ambiguities.<br />
<br />
• Click on to the application store which is available on the handheld devices. For the secure transfer of information from device to the application store, the device demands internet connection which helps in developing the interface.<br />
<br />
• Once the internet connection is provided, the link displays on the handheld device which provide several options to the clients. Here the people need to decide about the nature of application.<br />
<br />
• Application Store Interface<br />
<br />
Some of the applications on the mobile devices are installed on the handsets and does not demand internet connection in future. However there are some applications which need internet connection in order to provide constant updates and up to date information. Therefore if the Wi-Fi systems are available then a person can select any of the available applications.<br />
<br />
• The application store provides detailed review of the applications when the person clicks on to the desired link. The person must read the information clearly so that any possible uncertainties could be avoided.<br />
<br />
• Some applications are available free of cost while some of them demand money from the user. In case when payment is necessary, online billing mechanisms can be used and after the verification process, the application is provided to the user.<br />
<br />
<b> Making the Application available on Mobile Device</b><br />
<br />
The device might take some time to install the application on it. Another alternative available to the people for finding their desired application from the application store is the use of online mechanisms.People can simply visit the application stores by using their personal computers and follow the same steps mentioned above. </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span> <span style="font-family: Verdana, sans-serif;"> For making the application available on the devices, people can utilize the data cables, Bluetooth or the infrared connectivity options. As a result, the desired application will be successfully installed to the mobile communication devices. Both the methods are very easy to follow and the final choice of selecting any of these options rests with the user.<br />
</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-892712659100500876.post-78084514685860381192012-08-23T18:02:00.000+05:302013-09-09T22:40:48.050+05:30Playing mp4 video using jquery jwplayer in Asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic" style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><img alt="Jwplayer" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgRfzBqV6B99Pg9RjgL0VbsLL1xy6mgfbnbaSxdCbrXS_EykMlkG0JdeOxWFAiQt-LklQPjb6_Ur2qElVFHKPLQe4H78UEcsMLESjbNFVoCE_YFFXONuS52yqTKMSwfpDp89Jtoxbov1pg/s1600/jwplayer.jpg" style="height: 200px; width: 200px;" /></span>
</div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Hi Friends,In this article I would like to explain how to play mp4 video using jquery jwplayer in our
asp.net applications.In previously, we are already discussed about the " <b style="color: blue;"><a href="http://www.developerscode.com/2012/03/simple-steps-to-create-custom-video.html" target="_blank">creation of custom video control in Asp.net</a></b>"
this time we try to play mp4 video using jquery jwplayer in asp.net applications.Lets Start...</span></div>
<a name='more'></a><span style="font-family: Verdana,sans-serif; font-size: small;">
First,In order play mp4 video using jwplayer we need add the following files, they are: </span><br />
<div style="font-family: Verdana,sans-serif;">
<br /></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">1.jwplayer.js </span></b></div>
<div style="font-family: Verdana,sans-serif;">
<br /></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">2.player.swf </span></b></div>
<div style="font-family: Verdana,sans-serif;">
<br /></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Add these two files into your application and also add the mp4 video which you want to play. </span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Note:
You can download the above 2 files from the internet OR I am attached the files below you can download.
<br /><a href="https://www.box.com/s/21efec4f564f9ffd15ef" target="_blank"><img alt="download" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a></span>
<span style="font-size: small;">
<br /> </span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> For better understanding please go through the below screenshot:
</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /><img alt="Solution explorer" border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIJvEyBt0D7k-cuhpsNglZYzs8MmRdOUZVEOyTaiZ3n-WCcWiPkV5LVV38CDE-59KRJXAsNU_NAmin5VPkuSU5odxC7-7BG0v1MkE1Wt6fQnDvU4WnIUNA9q_jt0yx5EAZmyEeiWQwKZs/s400/SolutionExplorer.jpg" width="264" /></span>
<span style="font-size: small;">
<br /> </span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> Next,Open the aspx page and switch to source mode
Next Write the following code inside the head </span></div>
<div style="font-family: Verdana,sans-serif;">
<br /></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;"><span style="font-size: small;">
</span><title></title><script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script><script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script><link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css"></link><span style="font-size: small;">
</span><script src="jwplayer.js" type="text/javascript"></script><script type="text/javascript">
$(document).ready(function() {
jwplayer("PlayMP4Video").setup({
file: "SampleVideo.mp4",
flashplayer: "player.swf"
});
});
</script></pre>
<span style="font-size: small;"><span style="font-family: Verdana,sans-serif;">
Next,Add the following code inside the body section
</span></span><br />
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;"><span style="font-size: small;">
</span><form id="form2" runat="server">
</form>
<span style="font-size: small;">
</span></pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">
That's it.Almost done
In the above code I took a div called (PlayMP4Video) and passed that div id to the jwplayer function. </span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">With the help of above files it will automatically set up the video into the div.
Then build your application and run. It will generate an output screen as below: </span></div>
<div style="font-family: Verdana,sans-serif;">
<br /></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><img alt="MP4 video" border="0" height="341" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOypLH5O1IwxqfGsAFcN5TuJ80mSgxvTsisL9bh78tVnoca8W3JUgCQ8NcmS-GisxmVUmgJNGjRB4WlgJPeyC7hHPn8FpqRQL6sh2lOpWfQZBM7CCfM-AJS8PioFVea_LxgVE92b2ZXk0/s400/MP4VideoOutPut.jpg" width="400" /></span>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-29592916163715214452012-08-16T17:45:00.000+05:302013-09-09T22:41:12.754+05:30Integartion of Linkedin Login button in Asp.net Web applications<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic" style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><img alt="Linkedinlogintitle" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4M_Ik1pjRC_9EdqC7dLkssiZoNJx7UGe8m02ktmOSCxgxz2gZRPDSzTn1wK2Gs0np-0dxZD6nwmPSV4W692G_SYXqmH9dKd833RLNYv5OCzLo7SEWpcB_dSAOqqqBTMII3x3LDqbAlB4/s1600/Linkedinlogintitle" style="height: 200px; width: 200px;" /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Hi,In this article i would like to explain the procedure of integrating Linkedin Login button in asp.net.In the previous
article's i am explained about the <a href="http://www.developerscode.com/2011/03/simple-way-to-integrate-facebook-login.html" style="color: blue;" target="_blank" title="Facebook button integration">integration of facebook login button</a> and <a href="http://www.developerscode.com/2012/03/integration-of-third-party-loginslike.html" style="color: blue;" target="_blank">intergaton of google login button</a> in asp.net applications
Integration of linkedin login button in asp.net applications is very easy compare to previous one.</span><br />
<a name='more'></a></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Please follow the steps.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><img alt="Linkedin Login" border="0" height="384" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqSlijJfND44eHIIsjo3ciqirjDr5q9Ju-F_ebqIKh1ybLxvNwQp2RJ4e1VFjnKhnZyWAfOqvoYv7eiEmYJY2wSlhKxwSgsX69BTYYaH8P5RHByI72ee5E1vmKWvpTV9kul4XY_3UPtso/s640/linkedinlogin" width="640" /> </span><br />
<br />
<a href="https://www.box.com/s/019a56870b541e3b1f30" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiih0KttnJFcRCGXK9ur7hp5Ma8zh_aFnH22CEqYe14fa1uhlSi4nOIblkYPb6sb9b8W914hC_ip1LouLyqHPRnMV-gcVM39joTTcnpaSGNWVNIC0zwG_GMQ3Zd4khp0lLhLhWql5EAcqY/s1600/downlo%0A%0Aad.gif" /></a>
<span style="font-size: small;"> </span><br />
<br />
<span style="font-size: small;">The Overall procedure is divided in to two parts</span><br />
</div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">1.Creating application in Linkedin</span><br />
</div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">2.Integrating login button in Asp.net application</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">1.Creating application in Linkedin :</span></b></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> First, We need to create a application in linkedin inorder to get the API Key and API Secret Key</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Lets start..</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">1.First create a account in Linkedin</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">2.Open this url
<a href="https://www.linkedin.com/secure/developer" style="color: blue;" target="_blank" title="linkedin developer">https://www.linkedin.com/secure/developer</a></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">3.Next,Click on the Add new application link</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">4.Fill the following fields with necessary data
Example:</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Company Name : <b>DemoAppsTesting</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Application Name : <b>Login Button</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Description : <b>Integrating login button in Asp.net applications</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Website URL : <b>http://localhost:4613/Linkedin/Default.aspx</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="color: red; font-family: Verdana,sans-serif;">
<span style="font-size: small;">Note: you can replace you're actually site url like www.domain.com or use local host for testing
Application use: other</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Live status : <b>Development</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Developer Contact Email : <b>use working email id</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Phone : <b>use working mobile no</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>OAuth Redirect URL</b> : After successfull login user will be redirected to application main page</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Ex: http://localhost:4613/Linkedin/Welcome.aspx</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>Agreement Language</b>:Browser Locale Setting is recommended</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Select the Terms and conditions checkbox and click on Add application button</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">That's it you have successfully created the application</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Now you will get the Oauth Keys</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">OAuth Keys</span></b></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>API Key</b>: aaaaaaaaaa</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>Secret Key</b>: ssssssssss</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="color: red; font-family: Verdana,sans-serif;">
<span style="font-size: small;">Note: Don't share this secret with anyone.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">That's it.First part is successfully completed.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Now its time for login button integration in Asp.net application</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">First,Select one new Asp.net website and Add two forms</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">1.Default.aspx</span></b></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<b><span style="font-size: small;">2.Welcome.aspx</span></b></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Open the design mode of Default.aspx form</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Drag and drop one button from Toolbox.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Change the Properties of the button</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Text : <b>Login</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">ID:<b>btnLogin</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Add click event for the button</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Open the Default.aspx.cs page and write the following code</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Add the following line code before the page load</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">private oAuthLinkedIn _oauth = new oAuthLinkedIn();</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next, Copy the following code in the page load :</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;">protected void Page_Load(object sender, EventArgs e)
{
string oauth_token = Request.QueryString["oauth_token"];
string oauth_verifier = Request.QueryString["oauth_verifier"];
if (oauth_token != null && oauth_verifier != null)
{
Application["oauth_token"] = oauth_token;
Application["oauth_verifier"] = oauth_verifier;
}
}
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Next,Copy the following code in the button click event :</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;">protected void btn_linkedinLogin_Click(object sender, EventArgs e)
{
string authLink = _oauth.AuthorizationLinkGet();
Application["reuqestToken"] = _oauth.Token;
Application["reuqestTokenSecret"] = _oauth.TokenSecret;
Application["oauthLink"] = authLink;
Response.Redirect(authLink);
}
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">That's it you almost done..Now coming to the important part of the Task.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">That is Adding secret key and API Key in application </span><br />
<br />
<span style="font-size: small;">Open the Web config file,Add the following code</span></div>
<br />
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;"><appsettings>
<add key="LiApiKey" value="aaaaaaaa">
<add key="LiSecretKey" value="sssssssss">
</add></add></appsettings>
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">That's it.We have successfully integrated the login button .Now its time for testing </span><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTmd0kO_X1fAZEJvZcS__FAVdgyfm4ZeUyMFYuTjKYE7r2eI4jutvw8saoBBltJ1jxusm-38mWF5Y26tzNLcPenSRXUOJaZB9oftuIDACntu3lAGgsdsu0FxFnvn2hwNNl0FnKF2c3PY0/s1600/step2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="443" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTmd0kO_X1fAZEJvZcS__FAVdgyfm4ZeUyMFYuTjKYE7r2eI4jutvw8saoBBltJ1jxusm-38mWF5Y26tzNLcPenSRXUOJaZB9oftuIDACntu3lAGgsdsu0FxFnvn2hwNNl0FnKF2c3PY0/s640/step2.png" width="640" /></a></div>
</div>
</div>
Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-59565734755486078762012-08-07T09:21:00.000+05:302013-09-09T22:41:33.835+05:30How to use Treeview control in Asp.net applications<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic" style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><img alt="" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRGs6XnRQNYbaMgRKo3P8u1vC81a2sLc3E2QLDmV453L-i_L9djg_FhfhgOhkIGuYp4sv8PadJcoxyCyLDsUrWbBjBC0BFq5ysQGAyxKy4mxqFb2EVfDDrfKk1Xyzwtkyhuc6Kefh18Nw/s400/treeviewcontrols.jpg" style="height: 200px; width: 200px;" /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Hi friends, in this article I would like to explain how to bind data to Tree View control in asp.net using c#. From last few weeks we are getting so many requests about tree view control example in asp.net applications. This time we are going to explain a basic tutorial about treeview control for beginner’s.</span></div>
<a name='more'></a><br />
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Please follow the steps</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>Step :1</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> In this article I am considered States and its districts as nodes and its child nodes. Let us consider a sql table as below:
</span></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;">
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[ExampleOnTreeView](
[Id] [int] NULL,
[StateId] [int] NULL,
[StateName] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
</pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> Please find the below screen shot(ExampleTreeViewTable.jpg) for sample data that I shown in tree view output.</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"> <img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEibgTpdXWX40yRwiU22hAlixG-0XE1uX-usQ7hi6T0h3aRx08aiG08Vr1hgCZh-7Ti9wBpEkJ9QuLJf26fVZfiexNXOiWQwsJ9ggFiW_mYGvKPXyg7Acj_1LelqAcLlwYoZoWXyRnWlVV8/s640/ExampleTreeViewTable.jpg" width="605" /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>Step 2:</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">Then,coming to code for TreeView control in asp.net:
In .aspx page:</span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;"><%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="TreeViewExample.aspx.cs" Inherits="Year" %><title></title><form id="form1" runat="server">
<span style="font-size: small;">Tree View Example : <asp:treeview id="TreeViewStatesAndDistricts" imageset="Msdn" runat="server">
</asp:treeview>
</span></form>
<span style="font-size: small;">
</span></pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><b>Step 3:</b></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">In .aspx.cs page:
</span></div>
<pre class="cpp" name="code" style="font-family: Verdana,sans-serif;"><span style="font-size: small;">
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
public partial class TreeViewExample : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
try
{
con = new SqlConnection(ConfigurationManager.ConnectionStrings["TestConnection"].ConnectionString);
if (!Page.IsPostBack)
{
//Getting State Names from the database table(ExampleOnTreeView).
SqlCommand cmdStates = new SqlCommand("Select Id,StateName from ExampleOnTreeView where StateId is null", con);
DataSet dsStates = new DataSet();
SqlDataAdapter daStates = new SqlDataAdapter(cmdStates);
daStates.Fill(dsStates);
int StatesCount = dsStates.Tables[0].Rows.Count;
string[] Names = new string[StatesCount];
int i = 0;
foreach (DataRow drStates in dsStates.Tables[0].Rows)
{
TreeViewStatesAndDistricts.Nodes.Add(new TreeNode(drStates["StateName"].ToString(), drStates["Id"].ToString()));
Names[i] = drStates["id"].ToString();
i++;
}
if (i > 0)
{
// Getting District Names from the existing state.
string DistrictsQuery = "";
i = 0;
for (int j = 0; j < StatesCount; j++)
{
if (j == 0)
DistrictsQuery = "StateId = " + Names[j];
else
DistrictsQuery += " or StateId = " + Names[j];
}
SqlCommand cmdDistricts = new SqlCommand("Select Id,StateId,StateName from ExampleOnTreeView where " + DistrictsQuery, con);
DataSet dsDistricts = new DataSet();
SqlDataAdapter daDistricts = new SqlDataAdapter(cmdDistricts);
daDistricts.Fill(dsDistricts);
StatesCount = dsDistricts.Tables[0].Rows.Count;
Names = new string[StatesCount];
foreach (DataRow drDistricts in dsDistricts.Tables[0].Rows)
{
TreeViewStatesAndDistricts.FindNode(drDistricts["StateId"].ToString()).ChildNodes.Add(new TreeNode(drDistricts["StateName"].ToString(), drDistricts["Id"].ToString()));
}
}
}
}
catch
{
}
}
}
</span></pre>
<div style="font-family: Verdana,sans-serif;">
<span style="font-size: small;">After executing the above code by pressing (F5) it will generate the States & districts in Tree View format as below (ExampleOnTreeView.jpg): </span><br />
<br />
<span style="font-size: small;"><img border="0" height="640" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWUThoUrzgu841Bi4xqicywvv13IvdhstTtLF-VchJ7kZ67D2w-ItZ_kYdWCBVFh8OLmW6Lv22O9_CfwhDJepOGr7dZVEuzVfILSoY4SKueKLejmLmeZfAedIFocTJz9FKth4b44NwkLo/s640/ExampleOnTreeView.jpg" width="380" /></span>
</div>
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-56205427778696236242012-08-05T22:04:00.000+05:302013-09-09T22:41:50.451+05:30How to select only year from JQuery datepicker<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<img alt="jqueryCalendar" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgrYRsNvcBwZfyg1yiYp3U2eAypPMHLhyphenhyphentIvy1GJs0zStBrXRPdTZwD4zlyzJxoZ82mO5SuPlbYhw-XZFjZfPRM5ZxYLGhExkylVKmsk0bQcZz4Zt1XvouE4e_deE49HZBhVtpAvmsDabU/s400/Jquerycalendar.png" style="height: 200px; width: 200px;" /></div>
<span style="font-family: Verdana, sans-serif;">Hi Friends,
In this article I would like to explain how to select only year from J-Query datepicker.
Introduction about J-Query datepicker:
The J-Query datepicker is attached to a standard form input field. By clicking on the input field or by using the tab key it will open an interactive calendar in a small overlay. Select a date from the date picker, after </span><br />
<a name='more'></a><span style="font-family: Verdana, sans-serif;">selection click elsewhere on the page or hit the ESC key from the key board to close. Then automatically selected date will be displayed in the input field</span>.<br />
<span style="font-family: Verdana, sans-serif;"><b><br /></b></span><br />
<span style="font-family: Verdana, sans-serif;"><b>Code for selecting only year from the datepicker:
</b></span><br />
<pre class="cpp" name="code">
<title>Select Year From Date</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js" type="text/javascript"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type="text/javascript"></script>
<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="Stylesheet" type="text/css"></link>
<script type="text/javascript">
$(function () {
$("#txtYear").datepicker(
{
changeMonth: true,
changeYear: true,
showButtonPanel: true,
dateFormat: 'yy',
onClose: function (dateText, inst) {
var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
$(this).datepicker('setDate', new Date(year, month, 1));
}
});
$("txtYear.ClientID").click(function () {
$(".ui-datepicker-calendar").hide();
});
});
</script>
<form id="form1" runat="server">
<div>
Year : <input id="txtYear" size="12" type="text" />
</div>
</form>
</pre>
<span style="font-family: Verdana, sans-serif;">
After executing the above code, it will display an input field. If you click on the input field it will open date picker. Then by selecting any date it displays only year in the input field.
Please go through the below screen</span> shot for better <span style="font-family: Verdana, sans-serif;">understanding.</span>
<img border="0" height="638" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgcV59HdDu78FpFB2SwqCEY8rBtgz8TxZWsTl3DerRTJFtucMiEfn-sr0AK9F6JA_J7BV7ManbfpQ2aUg98uY-jXc2tozNVcUqG51hwQkPdBUadOXhdIC5freDNZT1p7uWhhwjjdckj2kc/s640/YearFromDate.jpg" width="640" />
<br />
</div>Unknownnoreply@blogger.comtag:blogger.com,1999:blog-892712659100500876.post-30724297442806530422012-07-30T22:55:00.000+05:302013-09-09T22:42:14.902+05:30Using a VPN for Encrypted Browsing<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="fl pic">
<span style="font-family: Verdana, sans-serif;"><img alt="vpn browsing" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjXRUcW3XJ3omXaAY1pRQO3RykIn9v-wsiJ8zRmNUp76vg8nEncZVFcPcAuazXtq04iaX_2M1MClA5_ySQoVnYOGBfSPbflyLZcev0nfSsWRGp4fX-3y_aJwEKackuvH-ch_vsrkc3mlJo/s400/vpn.png" style="height: 200px; width: 200px;" /></span></div>
<span style="font-family: Verdana, sans-serif;">With the number of people accessing the Internet growing by leaps and bounds, the threat from hackers is also increasing. In addition to this there is the threat of identity theft, malware, and virus attacks. Unencrypted access to sites over the Internet is the key reason for such harmful cyber-attacks. Wi-fi hot spots and open connections from hotels and airports also aggravate the threat.</span><br />
<span style="font-family: Verdana, sans-serif;"></span><br />
<a name='more'></a><br />
<span style="font-family: Verdana, sans-serif;">Restrictions imposed by the government also add to an unpleasant experience of restricted Internet access.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">Users can overcome this by using a Virtual Private Network (VPN). A Chinese VPN uses a tunneling technology to provide unrestricted encrypted browsing to users who subscribe to the service. Chinese VPNs are implemented on desktops, laptops, mobile devices, and tablets.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<b><span style="font-family: Verdana, sans-serif;"> What is encryption?</span></b><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">When a user does not use a VPN for iPad for iPhone, information is unencrypted. Internet service providers can trace the IP address being used to access the sites. If the IP address is blocked for use from outside of China, the user is unable to access a Chinese website.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">With a VPN for your iPad, iPhone or Android, the data is encrypted. The IP address that is used is a Chinese IP address. The user can then access Chinese websites as if from within China. In addition, for sensitive data, VPN technology with the appropriate protocol scrambles information and encrypts it, making it indecipherable for hackers to read and use for malicious intent.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">A user can select from different protocols when choosing a Chinese VPN:</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">• PPTP – (Point-to-Point Tunneling Protocol) - PPTP provides 128-bit encryption, which is not the most secure, but can be used for data that is not sensitive. As encryption is less, it is a faster protocol as compared to some other available VPN protocols. Most operating systems and devices support PPTP.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">• L2TP/IPsec (Layer 2 Tunneling protocol/IP Security) – This is also a tunneling protocol that uses IP security to provide confidentiality. It encrypts data twice over, thus providing 256-bit encryption, but reduces the transfer speed in the process.</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">• OpenVPN provides 256-bit encryption of data - OpenVPN uses SSL/TSL encryption protocols. It is the fastest currently available protocol, but is not built into operating systems and needs to be specifically installed on the user’s machine. </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">A VPN for China thus provides a user with the following: </span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">1. The ability to bypass restrictions implemented by the Chinese government</span><br />
<span style="font-family: Verdana, sans-serif;">2. Unrestrained Internet surfing</span><br />
<span style="font-family: Verdana, sans-serif;">3. Encryption of data for secure browsing and data transfer</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">Choosing a China VPN provider</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">A user needs to consider the following when choosing a VPN for China:</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">1. The protocols available with the provider and those supported by the user’s machine, as compatibility of the two are important for seamless data transfer - This also defines the security provided by data encryption</span><br />
<span style="font-family: Verdana, sans-serif;">2. How easy it is to setup the VPN service</span><br />
<span style="font-family: Verdana, sans-serif;">3. Bandwidth and speeds provided by the Provider</span><br />
<span style="font-family: Verdana, sans-serif;">4. The number and location of servers used by the VPN provider - The provider must give the user a choice of servers. In addition, if there are more servers, user and data traffic is monitored and catered to, resulting in increased speeds of data exchange</span><br />
<span style="font-family: Verdana, sans-serif;">5. Different options available to the user</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;">By using a Chinese VPN, the user experiences complete privacy and security while browsing the Internet. This is possible due to the encryption of data provided by VPN for China</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
<span style="font-family: Verdana, sans-serif;"><br />
</span><br />
</div>
Unknownnoreply@blogger.com