Skip to main content

Posts

Showing posts from May, 2013

Featured Post

How to use Tabs in ASP.NET CORE

I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component  public class AllViewComponent : ViewComponent     {         private readonly UserManager<ApplicationUser> _userManager;         public AllViewComponent(UserManager<ApplicationUser> userManager)         {             _userManager = userManager;         }         public async Task<IViewComponentResult> InvokeAsync()         {             List<StudentViewModel> allUsers = new List<StudentViewModel>();             var items = await _userManager.Users.ToListAsync();             foreach (var item in items)             {                 allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email });             }            

Computer Programming : Installing the ASP.NET AJAX control Toolkit, Example

The ASP.NET ACT is a shared source of projects created by the joint effort of Microsoft developers and ASP.NET and AJAX community; therefore it is not included within ASP.NET 3.5 Framework. In other words, the Toolkit is community supported and community driven . If you want avail the extended functionalities of the ASP.NET controls, you need to download and install the ASP.NET ACT manually. The ACT can be downloaded (available free of cost) with lots of additional AJAX controls and components. The Toolkit is continuously updated and a new release of Toolkit  is available every couple of months. Perform the following steps to install the ASP.NET AJAX control Toolkit. Step-1 : Download the compressed file from  http://ajaxcontroltoolkit.codeplex.com/releases/view/105897 Step-2 : Decompress the files to any location on your system and change its name to a desired name, say, AjaxControlToolKit. Step-3 : Create New WebSite in Visual Studio 2008 or later   Step-4 : Open

How to use Rating Control in AJAX

While surfing on the internet you see a lot of information and content , such as books , tutorials, songs ,movies,and the rest , which ask for user's feedback . This feedback provides a key metric to recognize the satisfaction of users. For this purpose , the owner of the materials provides a rating system that represents a set of stars , which can be used to receive feedback . The rating mechanism used by ASP.NET  needs a synchronous postback. However you can use the rating control that made client callback without refreshing the entire page . Properties of Rating Control : AutoPostBack : Set to true if you want to perform a postback by clicking a rating item . CurrentRating : Sets the initial rating value to display the selected rating item when the page is loaded. MaxRating : Sets the maximum rating value that you want to allow to rate an item. ReadOnly : Determine whether or not the rating can be changed. StarCssClass : Sets the css class for the visible star. W

Combo Box or List Box Binding with Database, Entity Framework 5

Most often when we have a list of items and want to select a single item at a time then we can use Combo Box or List Box in winforms application. The basic difference in both is: In List Box one can select an item only from existing list of items whether in Combo Box one can write his/her own new data that can be added to our binding list. There are some properties that are used to bind a list of items in c# programming i.e Data Source Display Member Value Member DataSource property will decide the list of data that is to be bind. It may be a Database, Web Service and an object. When this property is set, the item collection cannot be modified at run time. DisplayMember property indicates the name of an object contained in DataSource property. It denotes what object will be displayed to the user. The default value is empty string. ValueMember property is used to get the value associated with the control when we are accessing the selected item property.

How to Perform LINQ in C# Programming to Get Records using Entity Framework 5

LINQ stands for L anguage IN tegrated Q ueries in the context of sql programming. These are like SQL queries used to manipulate collection of objects through entity framework. LINQ are queries that can be directly written in c# programming language and will be translated to SQL statements and executed against the database. It simplify the complex process of database developer to query in databases. These type of queries are executed on collection of IEnumerable<T> or IQueryable<T> and as results are returned new collection of IEnumerable<T> objects.  In this post I will explain some example that show how to use LINQ on collection of objects in c# programming. Let’s suppose we have a c# class Student having two properties i.e. Name and Age and of course a primary key Id.   Now to get all records of students from database we have to write: var students = from student in dc.Student                 select student; In above code it will extract

How to Update and Delete record from database using EntityFramework in c# programming

Sometimes database developer have to change some of the properties of table, due to insertion mistakes. As we have inserted records into Database  using entity framework 5, it's time to modify that record and delete that if required through c# programming language. We (database developer) all know that update and delete query required a condition through which they retrieve an instance on which action is to be performed. Update: The update operation is quite simple in entity framework 5. First retrieve an instance of specified Entity object, then edit the properties of that instance and finally save the changes to that context and done. It have a little bit complex syntax in sql programming. Let’s suppose we have an entry of student named “Student 1” and we want to change his/her name and age then: DataContext dc = new DataContext(); Student student = dc.Student.First(s = > s.Name.Equals("Student 1")); student.Name = "Student 2"; student

Insert Entities into database Table using Entity Framework 5: C# programming

After creating databases with foreign key constraints in entity framework 5, its time to insert some records and save them for further references. In this article i will cover up, how to add entities and how entity framework processes these during saveChanges method. A database developer often use this method to insert records. As i have added Student  table which is a c# class in our solution, i will insert a record in the same table directly through code. I am using the same Winforms Application that we have used in previous article so make sure you have studied  Creating databases in entity framework 5 . Note : "You must create an object of DataContext class in Form1's Constructor in order to insert some data in Student class." To insert a record in database we will use the method i.e. EntityCollection<TEntity>.Add(). Lookout the c# programming code given below: DataContext dc = new DataContext(); Student newStudent = new Student(); newStudent.Nam

Create Foreign key in database using Entity Framework 5 in C# Programming

In the context of relational database management system (RDBMS), foreign key is a field in one table that uniquely identifies a row of another table. In sql programming, foreign key is a column which points to the primary key of another table. An entity can be related referenced with other entities through this foreign key, in entity framework. This can be done through an association between the tables.  As we have studied in our  Previous Post   how to create databases and tables in it. In this article i will create a foreign key in the table. Steps of creating foreign key in entity framework 5. Here above i have mentioned the version of entity framework, because it is the stable version currently. Follow these steps and it will add a reference of student in address class. In our Previous post we have created a table Student. We will use this table here.  In that same project add a new class Address  and create some properties (fields in context of databases). In the

Computer Programming : How to use RoundedCornerExtender in ASP.NET with Example

Computer Programming: As the name suggest , RoundedCornerExtender attaches and makes the corners of any ASP.NET controls round . It adds a background panel to any ASP.NET control so that the control appears with rounded corners. The overall height of the original control changes slightly . RoundedCornersExtender has only three important properties such as: TargetControlId : Set the ID of the control whose corners are to be modified . Radius : Set the Radius of the control corners . By default the value is 5 pixel. Corners : Set the corners of the target control , which you want to round. Before copy this code please add ajax ControlToolkit to your website/project Lets Take an Example <% @ Page Language ="C#" AutoEventWireup ="true" CodeFile ="Roundcorneraspx.aspx.cs" Inherits ="Roundcorneraspx" %> <% @ Register Assembly ="AjaxControlToolkit" Namespace ="AjaxControlToolkit" TagPrefix =&

Intranet system project in ASP.NET

What is the mean of Intranet here : "group of computer share information between student and faculty" This web application is developed to provide the facilities to various users. In this developed application there are three main users, which have the different privileges. These users can perform the various operations through this application. Ø Administrator — Administer can add new faculty. — Administer can add new faculty member. Administer can provide username and password to faculty member to change their accounts. — Administer can delete the existing faculty account. — Administer can edit the existing faculty account. — Administer can chat with other faculty members. Ø Ø Faculty — Faculty can edit its account. — Faculty can upload the documents to give the students. — Faculty can chat with administer or other faculty member. — Faculty can view their profile. Ø User — User can view the particular faculty me

Create Databases using EntityFramework 5 in C# programming

Entity Framework is an open source object-relational (ORM) framework for ADO.NET. It allows user to create a model by writing code in EF designer. The releases are improving from entity framework 3.5 and onwards. Entity Framework 5 is the stable version for visual studio 2010 and 2012 and updated soon with the latest features. The main advantages of using Entity Framework 5 are: Speed - You do not have to worry about creating a DB you just start coding. Good for developers coming from a programming background without much DBA experience. Simple - you do not have a edmx model to update or maintain. Entity framework 5 released with some advanced features like enum support, table-valued functions and performance improvements. In this article we will create a database using entity framework 5 code first approach. Steps of Creating Database through Entity Framework Create a Project ClassLibrary in Visual Studio. Install EntityFramework from Package Manager Console (requi

Computer Programming : How to use DropShadowExtender in AJAX with Example

DropShadowExtender enables you to add a drop shadow to an ASP.NET panel control . Using this extender , you can specify the width and opacity of the drop shadow as well  as make the corners of the panel rounded to give the panel looks more attractive and professional . Lets take an Example <%@ Page Language="C#" AutoEventWireup="true" CodeFile="dropshadow.aspx.cs" Inherits="dropshadow" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>         <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>         <asp:Panel ID="Panel1&quo

How to use UpdatePanelAnimationExtender in AJAX

UpdatePanelAnimationExtender enables you to display animation while the UpdatePanel  Control is performing an asynchronous postback . This extender applies animation to a very specific situation -- Where custom events need handling before and after an updatable region is refreshed . Therefore , this extender can be used only when the web page consists of an UpdatePanel control , UpdatePanelAnimationExtender has only three important properties. Properties of UpdatePanelAnimationExtender TargetControlID : Sets the ID of the UpdatePanel control whose updates results in animation effects. OnUpdating : Set an event to play animation when the update is in progress. OnUpdated : Sets an event to play the animation when the update is complete . The animation play if and only if there is some changes is the UpdatePanel control after the update.