Posts

Showing posts from July, 2016

LINQ :Querying in-memory collections/objects in ASP .NET

Image
  This article is about Querying in-memory collection/objects in ASP .NET(C#) Using LINQ. NOTE:"objects" in this article refers to any in-memory collection like array,list etc or class objects.   LINQ (Language Integrated Query) introduced from .NET 3.5 provides very important programming features to developers. Using LINQ developer can perform query on in-memory objects data,just like we query in database like SQL Server. All developers may face scenario where they want to query in-memory objects like selecting data from DataTable according to specific criteria. This also avoids to write database query/stored procedures for each and every criteria if the data retrieved from database. We can write the same query in C# for in-memory objects thanks to LINQ. Query can be performed only on objects which implements IEnumerable<T>. Here is simple LINQ query: int [] marks = { 20 , 55 , 34 , 89 , 70 , 60 }; var over60 = from m in marks where m >= 60

Dynamic Line Chart in ASP .NET from SQL database using Chart.js

Image
This article is about Chart in ASP .NET. Most of the web application's require data to be presented in graphical representation. Charts are easy to understand and gives clear idea about the data to the user. It is best to use chart for representing some data in web application. In this article we will use Line chart for data representation. The data will be retrieved from database and represented in graph on Web Page. Let's consider the example of shop system. The user requires the report to view daily sales. We can show it in tabular format. But it would be best to represent this report in line chart so that user can analyse the progress. Create simple system for this situation. We require database from which we will retrieve the data.Create the table tblProduct .   Insert dump data in the  tblProduct.    To get the quantity sold per day the query is SELECT CONVERT(VARCHAR,date,106) 'Date',SUM(quantity_sold) 'Qty' FROM tblProduct GROUP BY dat

Clean Code in PHP

This article is about Manageable,Clean coding in PHP. PHP is one of the most popular Web Development programming language. PHP code in requested file is executed by server, to create dynamic web page content. When I started to develop web sites in PHP, I just wanted things to work in web sites,No matter how I did it. My intention was to complete the task according to the user's requirement, That's all most of the beginners want initially,unless someone guide them. There is no problem in that. But you must start to develop yourself, each of your project must be more flexible,manageable than previous one. Developers thinking depends on how they implement the solution to the specific problem. For example, consider simple system for student register. Most of the beginner will just start the development on the go. Due to lack of experience or lack of good guidance, even the complete system will not be the flexible, Because of unplanned,messy code. Most of the User's don't a

Use of JavaScript in ASP .NET over AutoPostBack

This article is about using JavaScript in ASP .NET Web-form. Generally every ASP .NET Developer come across situation where they want to alter the value of OR change property (e.g CssClass ) OR enable/disable one web control depending upon one or more other web controls value.The solution for this type of situation is AutoPostBack property of web controls, AutoPostBack is very useful and widely used property. AutoPostBack posts the page to server based on the event of the web controls. When AutoPostBack property is set to true,it will send the request to the server when the event of web controls triggers.  AutoPostBack  actually calls JavaScript method which send request to the server,you can see some HTML code injected by ASP .NET when page is sent to the client. It is recommended to use AutoPostBack where database or some server side resource is needed for that operation. But for the operations such as mathematical calculation, enable/disable control or many other operations

Web Method call in ASP .NET using JQuery AJAX

In ASP .NET WebMethod is Attribute used for the method to be treated as Web Service. The method attached with WebMethod attribute is public which becomes part of XML web services. There is lot to talk about WebMethod, it's properties That I will cover in another blog coming soon. Here I will show you how can you call WebMethod using JQuery. Let's consider the simple example of Concatenation of two words,say your first name and last name. Here I will send this 2 words from two textbox's to the WebMethod which will return the concatenated string. <asp:TextBox id= "txtFirstName" runat= "server" ></asp:TextBox> <br /> <asp:TextBox ID= "txtLastName" runat= "server" ></asp:TextBox> <br /> <asp:Button ID= "btn" runat= "server" Text= "Send To WebMethod" /> <br /> <asp:TextBox ID= "txtResult