Skip to main content

Posts

Showing posts from January, 2016

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 });             }            

ASP.NET GridView on JQuery Modal Popup

Introduction In this article, I will show you how to display GridView in modal Popup, you can say how to display a division in model popup. Here we have two javascript file, both working as reference in this example also we have a style sheet to display division in proper format. By using the dialog method we can display model popup on screen. Lets check the example of model Popup which consists of GridView. Source Code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="showgridviewinmodalpopup.aspx.cs" Inherits="showgridviewinmodalpopup" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>       <link href="http://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="http://code.jquery.co

JQuery ASP.NET GridView details on Modal Popup

In this article, I will show you how to show details of the grid view's row on modal popup. Before doing this article, I will show details of row in second page. You can say that  all information of particular data shown on modal popup. Lets take an example: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="GRIDVIEWDETAILS.aspx.cs" Inherits="GRIDVIEWDETAILS" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <link href="http://code.jquery.com/ui/1.11.4/themes/ui-lightness/jquery-ui.css" rel="stylesheet" type="text/css"/> <script type="text/javascript" src="http://code.jquery.com/jquery-1.8.2.js"></script> <script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>     <script>

Merge two Data Column and bind GridView in ASP.NET

In this article, I will show you how to merge two data column into single one. First of all, bind DataTable with four columns i.e SNO, FirstName, LastName and City. Bind the DataTable source with GridView. Now, You can change the binding view of Gridview using OnRowDataBound event. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default12.aspx.cs" Inherits="Default12" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>     <asp:GridView runat="server" ID="g1" AutoGenerateColumns="false" OnRowDataBound="g1_RowDataBound">         <Columns>             <asp:BoundField DataField="SNO" HeaderText="Serial Number" />             <asp

ASP.NET C# add Multiple table into DataSet

In this article, I will show you, How to add multiple Database tables in DataSet. I write many articles on DataSet. We all know that we can store multiple Database Table in it. To do this task, first of all add two Gridview control on web form, now your web form look like : Source Code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="addmultipletable.aspx.cs" Inherits="addmultipletable" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>         <asp:GridView ID="GridView1" runat="server">         </asp:GridView>         <br />         <asp:GridView ID="GridView2" runat="server">         </asp:GridView>     </div>     </form>

Change System date Format using c#

If you want to change Your system date format using c# then you must to use RegistryKey class. This class is available in Microsoft.Win32 namespace. By using this class you can change the short and long date format, Before any changes the Date format look like. Now, after the code you can change the Date format: using Microsoft.Win32; private void button1_Click(object sender, EventArgs e)         {             RegistryKey regkey = Registry.CurrentUser.OpenSubKey(@"Control Panel\International", true);             regkey.SetValue("sShortDate", "10/12/87");             regkey.SetValue("sLongDate", "10/12/87");         }

Export DataGridView to Excel using OpenXML and ClosedXML

In this article, I will explain you, How to export data of DataGridView to Excel file. In this article, I will use OpenXML and ClosedXml libraries for export data. We can also export data of DataGridView using Foreach loop by fetching each row of it. To do this task, first of all Download two assemblies i.e : Open XML SDK 2.0 For Microsoft Office  Closed XML Now, Add windows form into your project. Add a DataGridView and single button on it. using System; using System.Windows.Forms; using System.IO; using System.Data; using System.Reflection; using ClosedXML.Excel; namespace Export_DataTable_Excel {     public partial class Form1 : Form     {         public Form1()         {             InitializeComponent();             this.BindData();         }         private void BindData()         {             DataTable dt = new DataTable();             dt.Columns.AddRange(new DataColumn[3] { new DataColumn("StudentId", typeof(int)),             new Da

Program x to power y in C Language

Introduction  The meaning of x to the power of y is , a variable x is multiply for y time. Lets take a simple example a variable x is hold 2 and y hold 5. Now the answer is 2 multiply for 5 times such as.. z=2*2*2*2*2; z=32 Method-1:  Design a Algorithm in c Step-1 : Take two value in variable x and y by user input. Step-2 :  Use pow function in  "C" , which is available in math.h header file. Step-3 :  Take another variable Z for holding answer of the x to the power of y. Step-4 : Print z  Step-5 : End of the program. Program : #include<conio.h> #include<stdio.h> #include<math.h> void main() { int x,y,z; printf("enter X value"); scanf("%d",&x); printf("Enter Y value"); scanf("%d",&y); z=pow(x,y); printf("output of the x power y is%d",z); getch(); } Output Method-2 : Using recursion Algorithm of the program Step-1: Step-1 : Take two value in variab

Structure of a C program

The structure of a C program is nothing but the way of framing the group of statements while writing a C program. We put the general structure of a C program first as shown below: [preprocessor directives] [global declarations] returning_type main ( ) { [Declaration Section (local)] [Executable Section] } [User defined functions] Note : The bold faced characters such as main( ) in one line along with the left parenthesis '(' and the right parenthesis ')' should be typed as they are. The Declaration section and Executable section enclosed within '{' and '}' is called the body of the main function. The data or value returned by the function main( ) is indicated by' returning_type'. Normally main( ) doesn't return any value. So, the returning type void is used. The function main( ) can be preceded by global declarations and preprocessor directives. Preprocessor directives : The preprocessor statements

Principles of Programming in C language

Introduction to Programming Remember your last visit to the super market. You might have purchased many items. What did you do after picking all the items and putting them into the carriage? Probably you met with the billing clerk to make the payment. Have you observed his way of preparing the bill? He picks the items one by one and enters something into the computer repeating the same task for all the items. Within a count of few minutes or even may be within few seconds he gives the bill , you pay and come out carrying all the required things. So what made him to process the bill so fast? It is nothing but the “program” running in the computer’s memory. If you want to become a billing clerk, then what is needed is to just learn the method to use the program that helps in the billing the items. Stop, don’t think in that way. You should dream something high! To design a program that helps the billing clerks to prepare the bill fast and in a most efficient way. Program Conce

Text to Image Conversion in ASP.NET C#

In this article, I will show you how to convert Text into image. I will take text from TextBoxes and convert it into image using Graphics class. Generated image will be show on image control. I have an example of it.  First of all add one TextBox, One Button and One image control on web form. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="texttoimage.aspx.cs" Inherits="texttoimage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>         Enter Name :         <asp:TextBox ID="TextBox1" runat="server" Width="192px"></asp:TextBox>         <br />         <br />         <asp:Button ID="Button1" runat="server" OnClick="Butt

Clear all form fields after submit data in ASP.NET C#

In this article, I will show you, How to clear all fields, I mean to say reset all control which is available on web page. I will give you an example of  it. Also, I will provide the message before clear the fields. When you submit your form then get a confirmation message on screen. If you pressed "ok" then form will be submitted and fields will be cleared. If you pressed cancel then you will be return last position (before pressing Button). Let's take an example: Source Code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="clearallfields.aspx.cs" Inherits="clearallfields" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <style type="text/css">         .auto-style1 {             width: 115px;         }     </style> </head> <body>     &l

Bind or Insert Data into DropDownlist using List and ArrayList in ASP.NET C#

In this article, I will show ou how to bind or insert items into Dropdownlist Using ArrayList or List in code behind file. ArrayList is a Collection of String items so it can contain string items Bydefault But in List<type> we have to specify type of items. In this article, I will take list as class type. I will give you an example of both. I am giving  you a youtube video: 1. Add two DropDownlist in the web form. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default11.aspx.cs" Inherits="Default11" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>         <asp:DropDownList ID="DropDownList1" runat="server" Height="39px" Width="212px">         </asp:

Introduction | Installation : Programming with Python

Python: Python is a programming language, through this we can design programs for Administrator. Basically, it is used for security reason and many more differences with other languages. Like, if you want to print " hello world" then you can use header files in c and c++ but in python, you don't need. So in python, you can reduce lots of codes.  Before preceding installation you must to know about programming and algorithm: Programming is a technique which is based on algorithms. Algorithms means, " Step by steps solving a problem".   How to install Python in your System: Consider the following steps Open http://www.python.org Download Desired package for your system software Currently, I am using windows operating system, so I download python package 3.5.1 for windows. After finish downloading you need to start installation by double clicking on executable file. Pick the installed file by using start menu also run python interpreter. If

DropDownlist Bootstrap Style in ASP.NET C#

In this article, I will show you, how to add checkBoxList in DropDownList as item. I mean to say when you drop it then display item in the form of CheckBox list. You can select multiple items from CheckBox list. Selected Items show in the DropDownList header. If you want to design this types of DropDownList then add these files into your head section of page. By using these files, we can convert our ListBox into DropDownList with CheckBox Item. I will Give you complete example of Bootstrap Dropdown Menu. <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default10.aspx.cs" Inherits="Default10" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title>     <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <link href="http://cd

JQuery: CheckBox show/Hide password when changed

In this article, I will show you, How to show password when we select "Show PassWord" checkbox. If check box is selected then show password otherwise hide. Also I will show you, when we enter some text into the password box then entered text write on the span tag. If you want to learn that how I design it, Follow the following steps: Step-1 :  Add two TextBox in the body section, also add one span tag and one button control. Step-2 :  Run Jquery function, get the Id property of  password textbox, apply keyup  function on password textbox. It means when you enter some text into password box then enter text printed together with the cursor.  Step-3 : Check whether CheckBox is checked or not. If check then write text on span tag. Complete Code: <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title></title>     <script src="http://code.jquery.com/jquery-1.10.2.js"></s

Example of NotifyIcon system tray in windows form c#

If you want to show your windows form application in NotifyIcon toolBar then you can use this example. When you press minimize button of windows form then your application should minimized in system tray.  Try these steps to minimized your application as System Tray: Step-1 : Add a new  windows form into your project Step-2 : Add a NotifyIcon control in currently added form. Step-3 : Select Show smart tag, add icon file in NotifyIcon control. Step-4 : Add the following code in code file with respective events using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication5 {     public partial class Form3 : Form     {         public Form3()         {             InitializeComponent();         }         private void Form3_Resize(object sender,