Skip to main content

Posts

Showing posts from October, 2015

WPF menu bar with dockpanel | additem | Image | Icon | Checkbox | Click event

In this article, I will teach you, how to add WPF menu bar at top position in window, Add items in it, add image as icon in it, also handle click event on each items of it. I explained, how to add items with underline.
<Window x:Class="WpfApplication5.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" <DockPanel> Title="MainWindow" Height="350" Width="525"> <Grid> <Menu DockPanel.Dock="Top"> <MenuItem Header=" second child"/> <MenuItem Header="_First Parent"> <MenuItem Header="New" Command="New"/> </MenuItem.Icon> <MenuItem Header="Third child with image"> <MenuItem.Icon> <Image Source="mango.png"/> …

Example of Login form in WPF

Today, I will teach you, how to design login form in WPF. Also, I will teach you, how it will work. In this example, I will take two text boxes, two Text Blocks and one button control from ToolBox. Now, create a database table with some following fields:

CREATE TABLE [dbo].[users] ( [Id] INT NOT NULL IDENTITY, [username] NVARCHAR (50) NULL, [password] NVARCHAR (50) NULL, PRIMARY KEY CLUSTERED ([Id] ASC) );
In this database table, I have three column, first column is automatic incremented by one.

<Window x:Class="WpfApplication5.additemwpflistview" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="additemwpflistview" Height="300" Width="300"> <Grid> <TextBlock HorizontalAlignment="Left" Margin="10,41,0,0" TextWrapping="Wrap" Text="Use…

WPF Listview formatting, styling

In this article, I will teach you, how to change Background color, foreground color, font style, and many more things. I explained already many more things about WPF Listview like
How to add items in it using XAML codeHow to bind the WPF Listview.view from Gridview.WPF Listview binding from EDMX fileBinding it with List of string type. Also covered many more articles, which is related to styling and formatting. You can see my video article for Learn WPF styling using static as well as dynamic. Today, I will put some styles in XAML code. Let's see

<ListView Name="list1" HorizontalAlignment="Left" VerticalAlignment="Top"> <ListViewItem FontFamily="Times New Roman" FontSize="15" Foreground="Red" Background="Green" BorderBrush="AliceBlue" BorderThickness="2">Apple</ListViewItem> <ListViewItem FontSize="16" Foreground="Green" Background=…

WPF Listview with ItemTemplate binding using EDMX file

In this article, I will teach you, how to bind WPF Listview with ItemTemplate using EDMX file. Also, I will give you an example of it. So far we have discussed basics of WPF Listview control. Let's see, what's are covered about WPF:

WPF Listview binding with Gridview cell template using EDMX fileWPF LISTVIEW BINDING USING EDMX FILEwpf listview bind with list of string type Let's see the example of this example:

<Window x:Class="WpfApplication5.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <ListView Name="list1"> <ListView.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="Id="/> <TextBlock Text="{Binding Id}…

First 3 WPF videos, start your learning

I will give you a WPF videos series. If you watch each then you do start your career with WPF. Through WPF videos, you can design light weight application. Let's start step by step. In first video you learn about basics of WPF projects, let's see


In this video, I will teach you many more things about WPF start like
How to start Visual Studio for WPF application.Create new project for WPF, select C# language in left pane, select WPF application in middle pane.First-page name of the default window is MainWindow.xaml. It contains default WPF Grid control.Add a TextBlock with Text property inside WPF grid.Learn, How to run WPF application. Now, come to next video of WPF videos series. First of all, I will teach you about WPF panels. So, here, I share you a video of stack panel.
Check it, what is inside. Drag WPF stack panel control from ToolBox, drop it in Window. When we add it in Window then XAML automatically update with stack panel code. Here, we have HorizontalAlignment=left,…

WPF Listview items with images

WPF ListView is a container of other single controls. I mean to say that you can put other single control in it. Other controls considered as a Listview item. You can put only simple single string or control like TextBlock. Lets to check the demo of this line.

1: <ListView> 2: <ListViewItem> 3: <TextBlock Text="Fruits"/> 4: </ListViewItem> 5: <ListViewItem> 6: Vegetables 7: </ListViewItem> 8: </ListView>
In this code, we have both string as well control. You can take other containers in it like StackPanel etc. as a ListView Item. In previous example, i taken Gridview control as view of Listview. Now, i will take image with Text in it as a single WPF Listview item.

1: <ListView> 2: <ListViewItem> 3: <StackPanel Orientation="Horizontal"> 4: <Image Source="apple.png"/> 5: <T…

ASP.NET FILEUPLOAD CONTROL CHANGE BACKGROUND COLOR USING CODE

Each control in ASP.NET ToolBox of visual studio, treat as a class. Property window shows the behavior of their controls also contains some common property, such as back-color, border color etc. Now in this article, we will take a simple example to change the background color of ASP.NET file upload control.

Description
I explained, ASP.NET FILEUPLOAD CONTROL change border color, File upload control enable/disable.  Source code


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fileupload_backcolor.aspx.cs" Inherits="fileupload_backcolor" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> Enter Alpha color : <asp:TextBox ID="TextBox1" runat="server" Width="202px">…

WPF Listview binding with Gridview cell template using EDMX file

Good evening, welcome to WPF programming. I already explained, how to bind WPF listview from string type list also explained binding it with database table using EDMX file. In this article, I will give you an example of cell template of Gridview, which is inside in WPF Listview. You can say, I will update previous WPF listview article. If you want to customize your Gridview cell in WPF Listview control then use cell template.


Note: Before doing this task, read previous
You need to change only XAML file without any changes in code behind code. The previous XAML code is:
<Grid> <ListView Name="listgrid"> <ListView.View>  <GridView> <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Emp_Name}"/> </GridView> </ListView.View> </ListView> </Grid>
Now, …

ASP.NET fileupload control change border color Programmatically

Each control in tools of visual studio, treat as a class. Property window shows the behavior of their controls also contains some common property, such as back-color, border color etc. Now in this article, we will take a simple example to change the border color with border style of ASP.NET FILEUPLOAD control. I explained, How to use file upload, enable/disable file upload and many more properties.
Source code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fileupload_backcolor.aspx.cs" Inherits="fileupload_backcolor" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> Enter Alpha color : <asp:TextBox ID="TextBox1" runat="server" Width="202px"></asp:TextBox…

ASP.NET Fileupload control enable/disable programmatically

Enable property defines the working mode of asp.net file upload control. It has two boolean value first one is true and second one is false. If you set true for this then control work properly otherwise control doesn't work, I mean to say that fileupload appear on screen but will not work as input control. If you want to set this property during compile time, must add attribute inside the tag. Like
Read AlsoASP.NET FILEUPLOAD CONTROL INSERT IMAGE IN DATABASE


<asp:FileUpload ID="FileUpload1" runat="server" Enabled="False" />
    true is the default value for this. Now take a simple example to change the value at run time. Source code
<form id="form1" runat="server"> <div> <asp:FileUpload ID="FileUpload1" runat="server" Enabled="False" /> <br /> <br /> <asp:Button ID="Button1" runat="server" Text="Enable/…

Default Listing with Insert and Update in MVC 4

MVC 4 provides simple listing procedure through which developer can create CRUD actions for a database table. Awesome thing is developer don’t need to write a single line of code and will complete the task. We have added new table Category and updated edmx file in earlier article. Now we will create CRUD actions and their views with default MVC 4 structure. We have created empty controller without using any default action but now we will add a controller with all the default actions. Follow the procedure for creating a controller and in “Add Controller” window name the controller as CategoryController and select the options as selected in the following screenshot and click on Add button:
This window is prompting for your context class (inherited from DbContext or may be your edmx entities name) file and the model name for which these actions will be created. After clicking on Add button, it will add a controller with following 5 actions and corresponding views. Those views are not cre…

WPF LISTVIEW BINDING USING EDMX FILE

In previous WPF listview article, I explained, how to bind listview from List of string type. In this article, I will explain you, how to bind listview using EDMX file. We all know about powerful features of  WPF listview i.e Gridview. Lets, take an example of it.

<Grid> <ListView Name="listgrid"> <ListView.View> <GridView> <GridViewColumn Header="Id" DisplayMemberBinding="{Binding Id}"/> <GridViewColumn Header="Name" DisplayMemberBinding="{Binding Emp_Name}"/> </GridView> </ListView.View> </ListView> </Grid>
In the mentioned code, Gridview is a view of WPF Listview with two columns that are Id and name. Here, DisplayMemberBinding is the property of GridviewColumn, which is used to bind listview columns from field of model class.

public partial class MainWindow : Window {…

ASP.NET FILEUPLOAD CONTROL INSERT IMAGE INTO DATABASE

Introduction First of all, I would like to thank all of the readers who have read my previous articles. What a great support I have got from you people. By using ASP.NET File upload control, we can easily insert images into Table or you can say that we can create image gallery projects. With the help of JQuery, we put some dynamic effects like upload multiple files one by one. you can also do by JQuery to create button work as File upload. I really felt great when article Bind GridView was displayed on this blog page. Following are the articles that I have written so far for beginners as well as developers.


Follow some steps for inserting Images into database using asp.net fileupload control.
STEP-1 : Create Database Table



STEP-2: Drag asp.net fileupload control from ToolBox and Drop it in Design window.

<form id="form1" runat="server"> <div> <asp:FileUpload ID="FileUpload1" runat="server" /><BR /> <a…

Update Edmx When Database Changes in MVC 4

MVC 4: Update Edmx is to make the model as same as the database through which it created. Whatever changes made with the database will not reflect in the Model to perform CURD functions. Suppose we have added a new table with SQL server management studio and want to insert/update some entries with that table using code part. After creating object of database context, notice that we don’t have an instance for that newly added table. To resolve this issue we have to update our edmx using Update Model Wizard as described in this article.

Create new table Category in the same database added earlier and use basic columns like id, name, description, isActive. Open our visual studio project and check that this table have not any existence yet. Open edmx file, right click on the blank space and click on Update Model from Database.





  An Update Model wizard will open with options to add tables, views and stored procedures. We have added only a table so expand “Tables” node and select “Categorie…

Top 10 asp.net forums

Asp.net forums: It mean provide help related to asp.net code and many more things like presentation related, business logic related etc. asp.net support many languages like c#, f#, vb etc. These languages are interoperable so all mentioned forums are working in all languages.

(Top-1)asp.net forums: This is related to many more things like tutorials, articles, learning skills, asp.net forums etc. Forums working on these following topics:

Getting started: general awareness of asp.net.web forms:   Server controls, events, validation, master pages, themes, web parts, personalization, etc.Web Forms Data Controls : Data-bound controls such as the GridView, DataGrid, DataList, FormView, DetailsView, Repeater, and Microsoft Chart.MVC: Discussions regarding ASP.NET Model-View-Controller (MVC).Alexa Traffic Rank



(Top-2)stack overflow: This is related to various technologies like asp.net, php, javascript, c++, java, mysql, css, html, python etc. Put your thread related to tag.



(Top-3)c-sharpcorner

Refactoring in visual studio 2013,2015

Refactoring, change the internal structure of the code without any changes in behavior/outer structure. By using visual studio plugins, you can do the following refactoring in the visual studio code. The most popular and powerful refactoring plugin/extension in visual studio is visual assist. By using it, we can do some following tasks:

Extract method refactoring: By using visual studio we can create new methods for existing code, I want to say that if you have a code in a method, you want to break it in different segments/methods then you can use extract method like Suppose your code look like public class Class1 { public void display() { int a=10; int b=20; Console.WriteLine(a + b); } }
Select the code fragment you want to extract:

int a=10; int b=20;
Right click on selected text, Refactor--> Extract Method..., appear new window.


After pressing the "ok" button, your code look like

public class …

VISUAL STUDIO DESIGN GAMES USING UNITY PLUGINS

Microsoft and many more product based companies provides some extensions for visual studio. Behind the scene, the main purpose of them, they want to enhance the features of visual studio. Similarly, UNITY software is a type of extension, which is used for design games in visual studio. UNITY provides you to make platform independent games, i mean, you can run your games data in 21 platforms. Also provides many more features like: You can design your games either in 2D and 3D.Debug your game code using break point in visual studio.You can put your logics in UNITY game by using c#, which is userfriendly for you.Check error in error list of visual studio. 
How to download it: Download it by using official sites, but i recommended this path, Through this you can download other things. Download UnityDownloadAssistant-5.2.1f1.exe, start it by using double click. Below mentioned Progress snap  of downloading. 

In the next article i will show you how to start screen of unity, how to start code…

Design beautiful web forms in any technology

Good morning, i am jacob, Today i have to share some post which is related to design beautiful web forms in asp.net. If you want to design web forms in asp.net then you need to learn some basic technologies like HTML, CSS, Photoshop, JQuery etc. Here, i will tech you about these technologies one by one using some web forms article. so, lets start, Following these steps to design beautiful we forms: (Task-1)Before anything doing, must to rough stretch your website : Suppose you want to design 20 pages website then  you need 20 pages of note book. Now, stretch each web site page into your notebook. Suppose i have to design first page in my note book that is:


Similarly do for all remaining pages. Now, your first task is completed.
(Task-2)Fill colors in stretched design: Now, come to second task that is fill colors, For beautiful web forms, must to fill different colors in the page by using color pens.
(Task-3)Design your pages by using Photoshop: By using Photoshop, you can feel exact loo…

wpf listview bind with list of string type

As we all know the wpf listview is inherited class of listbox and have almost all the properties of listbox. We have learnt listbox binding with string list in our earlier post. In this article we bind the listview with the same string list.

Just place a wpf listview having only name property, because we have to access that wpf listview in our code behind file. We can also use height and width property of the listview, if the data items are of lengthy string.
<ListView>
<ListView.Name>listView</ListView.Name>
</ListView>
Now use the same list of string as in previous post i.e.
List<string> strList = new List<string>();
strList.Add("London");
strList.Add("Italy");
strList.Add("California");
strList.Add("France");
listView.ItemsSource = strList;
Now look out the last statement, it will set the item source of the wpf listview as this string list. When we run the project it will show a listview with four items:



To…

jquery button created dynamically

Introduction
In this article, i will show you how to create jquery button dynamically. Example of dynamically created button using jquery. In this example, create a input tag with their attributes by using jquery. Now, after this you can append it in division.



<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>JQuery Button Created Dynamically</title>
    <script src="Scripts/jquery-1.10.2.js"></script>
  <script>
      $(document).ready(function () {
          var $bt=$('<input/>').attr({type:'button',name:'mybutton',value:'Dynamic Button'});
          $("#div1").append($bt);


      })

  </script>

</head>
<body>
 <div id="div1"></div>

</body>
</html>

Query String in web forms asp.net c#

Introduction Query String in web forms asp.net is very important if you have a shopping products. Through this  article we will show you how to use Query String in web forms asp.net also you can say i will provide you an example of it.  If we want to pass control or variable value from one form to another form then we can use QueryString . There are many options available to pass queryString , these are. In Hyperlink: <a href=”~/Default.aspx?id=10&name=Jacob”>QueryString Example</a>
In Response.Redirect method :Response.Redirect(“~/Default.aspx?id=10&name=Jacob”);
If we want to get queryString Parameter valuefrom url then we should use Request.QueryString  Object. Label1.Text=Request.QueryString[“querystring parameter”].ToString();
Lets take an simple example to pass textbox value from one form to another form using QueryString.



<%@PageLanguage="C#"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xh…

How to bind CheckBoxList using Xml file in ASP.NET

XML File Introduction XML file is a text file. basically XML file is used for carry data.
Features of XML file
1. Its a Case sensitive language.
2. Use User defined tags
3. Used for communication purpose
4. Its not a presentation language .
5. Same as HTML language.
6. Use Tree based architecture

The CheckBoxList control displays the list of data as a CheckBox from which you can make a multiple selection. The CheckBoxList control exists within the System.Web.UI.WebControls namespace. You can select multiple items in this control because In this control you have some options. The CheckBoxList control has no non-inherited methods or events.
Public Properties of DropDownList ClassSelectedIndex : Obtains or sets the index of the selected item in the control.
Application of DropDownList ControlIn skill page where you can select your skills in given CheckBoxList options.In management project where you can select multiple option in given options. Lets take an simple example to bind CheckBox…