Skip to main content

Posts

Showing posts from June, 2015

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

How to transfer one listBox item to another listBox in WPF

Today, i would like to share something about ListBox. ListBox is a container which is available in System.windows namespace. In it we can add item in both way (Design time or Run time ). In this article we have to add item at run time also transfer items of listBox to another listBox item. So, lets to start it: 1. Add two listBox and two button control in the page. 2. When window is load first time then first left ListBox is loaded with ArrayList. <Window x:Class="WpfApplication2.transferlistitem"         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"         xmlns:local="clr-namespace:WpfApplication2"         mc:Ignorable="d"         Title="transferlistitem" H

How to insert data into database table in WPF application

After binding the DataGrid in wpf .  You can insert some item in the database table using WPF TextBox. So first of all add one label , TextBox and one button control in the grid container. Insert data in the table on button click so add button click event on button.   <Grid>         <Grid Margin="0,0,10,203">           <Label Content="Enter Name Here:" />  <TextBox Name="text1" Text="" Margin="112,4,228,0" Height="27" VerticalAlignment="Top" />         <Button Content="Add Data" Margin="76,46,310,22" Click="Button_Click" />         </Grid>         <DataGrid Name="g1" AutoGenerateColumns="False" Margin="110,121,137,57">             <DataGrid.Columns>                 <DataGridTextColumn Binding="{Binding Id}" Header="Id" Width="100"/>                 <DataGrid

How to bind DataGrid in WPF using Sql

DataGrid is a way to show the data items of database table in wpf application. So, first to design the database table by using Sql Server. I have a country table, which is mentioned below: CREATE TABLE [dbo].[country] (     [CountryId]    INT            IDENTITY (1, 1) NOT NULL,     [CountryName]  NVARCHAR (MAX) NULL,     [Countryimage] NVARCHAR (MAX) NULL,     PRIMARY KEY CLUSTERED ([CountryId] ASC) ); After design the table you need to insert some data in it. So you can show your table data in wpf application with the help of DataGrid. Make two column in DataGrid, i have done this , you can check by the mentioned below code: <DataGrid Name="g1" AutoGenerateColumns="False" Margin="110,121,137,57">             <DataGrid.Columns>                 <DataGridTextColumn Binding="{Binding Id}" Header="Id" Width="100"/>                 <DataGridTextColumn Binding="{Binding Name}" Header=

Dropdownlist with image in asp.net c#

If you want to make beautiful and attractive web application in asp.net then you think ahead. You can make each control attractive using some other technologies like JQuery, JavaScript etc. Today i am discussing with you on topic Dropdownlist. If you bind the list with simple text then your Dropdownlist not look beautiful but if you add some images with each item then your list becomes beautiful. Lets take a simple example of Dropdownlist with image. So first of all design database table and imsert some data in it , I have a table , which is mentioned below. Source page <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Dropdownlistwithimage.aspx.cs" Inherits="Dropdownlistwithimage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title>Bind DropDownlist With Image</title> <link href="style/dd.css" rel="sty

How to access application setting tag of web.config file in asp.net

Today i am writing ado.net code in code behind file, On that time i notice that if i take my connection string in the web.config file then we can access it easily. But how? So i have search in msdn library to access the web.config file then i found ConfigurationManager class which is available in System.Configuration Namespace. Through this class we can get all elements of web.config file. Lets take a simple example. Web.config file <appSettings>     <add key="jacob" value="My Name"/>       </appSettings> Source Code <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Readwebxmlfile.aspx.cs" Inherits="Readwebxmlfile" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> </head> <body>     <form id="form1" runat="server">     <div>

Print the asp.net webpage using button

Introduction Today i am talking about printing, and how to print the content or you can say selected content in asp.net. If you have a webpage and you want to print this then you have to choose command key (ctrl+p) for that. Also you want to print the selected part then you have to select the text first then you have to use command key. But sometimes your selected page could not printed. So many websites provide the printing facilities on the webpage. Today i am talking about the same topics here. Lets take a simple example to demonstrate the topic. Source code: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="printpage.aspx.cs" Inherits="printpage" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head>     <title></title> <script> function printpage() { var getpanel = document.getElementById("<%= Panel1.ClientID%>"); var MainWin

ToolTip on specific DropdownList item in asp.net c#

Today i am talking about tooltip, First of all i introduce you , what is tooltip? When our mouse cursor move over the object then appear a rectangle shape with text this things known as tooltip. When we work with particular item then easy set the tooltip on it. But when we work on collection then we put some ideas on it. Like first to access each item from the collection then apply tooltip on each accessed item. Today, i want to give a simple example on it. I have a database table with three columns, see below: Database table(country table) CREATE TABLE [dbo].[country] (     [CountryId]    INT            IDENTITY (1, 1) NOT NULL,     [CountryName]  NVARCHAR (MAX) NULL,     [Countryimage] NVARCHAR (MAX) NULL,     PRIMARY KEY CLUSTERED ([CountryId] ASC) ); First to add some item in the table after then you have to access items. If you want to add items in the table by the help visual studio server explorer then do the following. Right click on your table name --> Selec

How to create array using JQuery also insert item at run time

Array is a collection of similar item in programming language but is case of scripting language all variable treat as a variable type so we don't identify the type of it. In JQuery we have to create array at runtime, like var array_name=[]; If you want to insert some item in it then use push(var item ) method. <%@ Page Language="C#" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> <script src="Scripts/jquery-1.10.2.js"></script> <script> $(function(){ var array_name=[]; $('#Button1').click(function(){ var textbox_value=$('#Text1').val(); array_name.push(textbox_value); for(var i=0;i<array_name.length;i++) alert(array_name[i]) }); }) </script> </head> <body>     <form id="form1" runat="server">     <div>

How to convert decimal number to round off figure using JQuery

If you want to display decimal number to fix digit number. I mean to say i have a decimal number like 123.123 and i want to display round of number then use Jquery round method.  <%@ Page Language="C#" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> <script src="Scripts/jquery-1.10.2.js"></script> <script> $(function(){ $('#Button1').click(function(){ $('#result').html(Math.round($('#Text1').val())) }); }) </script> </head> <body>     <form id="form1" runat="server">     <div>     Enter Number: <input id="Text1" type="text" value="123.123" /> <input id="Button1" type="button" value="Round Off value" /> <br /> <label id="result"

How to get Elements of HTML using id and class in JQuery

How to get the element from the html file using their id and class property. In my previous article we have already get the html element from their id property. But in this article we will get the element from their class name. Lets take a simple example to demonstrate the article. <%@ Page Language="C#" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> <script src="Scripts/jquery-1.10.2.js"></script> <script> $(function(){ $('#Button1').click(function () { var firstdiv = $('#first').html(); alert(firstdiv); var getclass = $('.test').html(); alert(getclass); }); }) </script> </head> <body>     <form id="form1" runat="server">     <div id="first" style="border: 1px solid #009900; padding: 10px"

Check Whether string match or not using JQuery

If you want to search string from given string then you should use String class. A String class have different methods through them we can search any text from the given Text. In this example, i will take indexOf() method , its a more popular method. Actually This method work when your search characters sequence match with the given text. Now , take a simple example of it. <%@ Page Language="C#" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> <script src="Scripts/jquery-1.10.2.js"></script> <script> $(function () { $('#Button1').click(function () { if ($('#Text1').val().indexOf('jacob') != -1) { alert('string match'); return true; } else { alert('string doesnt match'); return false; } }); }) </script> </hea

How to remove content from division also remove it using Jquery methods

Remove content from the division or remove complete div from the page. In these types of problem you can use JQuery. In Jquery we have a empty( ) and remove( ) function. Both functions are used easily. Ok, let take a simple example , in which we have a division with border style and text. If i want to remove content of the div then first to find the division using JQuery by this method. $('# id of the division') After find the division you can use empty method, Through this method we can remove content of the division. <%@ Page Language="C#" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server">     <title></title> <script src="Scripts/jquery-1.10.2.js"></script> <script> $(function(){ $('#Button1').click(function(){ $('#contentdiv').empty(); }); $('#Button2').click(function(){ $('#c