-->

Sunday, September 1, 2013

Online camera shopping cart project in ASP.NET

Introduction

Its a shopping cart project which is used over the network. Present time online shopping companies get benefits from online selling because they getting lots of money compare to manual marketing. The scene of the project is making online application which is used for online shopping. Basically this application is designed for camera only also its a demo application.





Application of the project

  • Gets some extra cash from online selling
  • Application is designed for Institutional purpose
Features of the project
  • Add new category and sub-category of the camera
  • User registration page
  • Online cashing
  • Searching facility
  • User session
  • Add to cart facility
  • Admin panel
  • Customer panel

Hardware and software requirements of the project

  • Visual studio 2010
  • SQL-SERVER 2008

How to run your project

  • Open your project in VS2010
  • Run your home page
  • First register into this site
  • After that click on any camera which you want to purchase
  • Add quantity and add item to the cart
  • In admin panel first check your admin password in server explorer 
  • Add new camera detail after login into Admin panel


If you want to purchase this please contact me on :  narenkumar851@gmail.com

Silverlight Tutorial : Create Simple Silverlight Application

The easiest way to start Silverlight is to create an ordinary website with HTML pages and no server-side code . Here's how
1. Select File--> New-->Project in visual studio , choose the visual c# group of project types, and select the Silverlight Application template . As usual , you need to pick a project name and a location on your hard drive before clicking OK to create the project.

Silverlight Application template

2. At this point , visual studio will prompt you to choose whether you want to create full -fledged ASP.NET website that can run server-side code along with your silverlight . In visual studio , uncheck the "Host the Silverlight application in a website" option to keep things simple.
 uncheck the "Host the Silverlight application in a website

3. Click OK to continue and create the project.
Every Silverlight project start with a small set of essential files. All the files that end with the extension .xaml use a flexible markup standard called XAML. All the files that end with the extension .cs hold the C# source code that powers your application.
Every Silverlight project start with a small set of essential files
App.xaml and App.xaml.cs files configure your Silverlight application they allow you to resources that will be made available to all the pages in your application, and they allow you to react to application events such as startup, shutdown and error conditions.

MainPage.xaml files defines the user interface(the collection of controls, images, and text) that will be shown for your first page. Technically , Silverlight pages are user controls-custom classes that drive from UserControl. A Silverlight application can contain as many pages as you need - to add more , simply choose project-->Add new item, pick the silverlight User Control template.

Example of Create Simple "Hello World Application" in  Silverlight 

<UserControl x:Class="SilverlightApplication1.MainPage"
    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"
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">



    <Grid x:Name="LayoutRoot" Background="Black">
        <TextBox Text=" Hello World!" HorizontalAlignment="Left" Height="23" TextWrapping="Wrap" VerticalAlignment="Top" Width="120"/>



    </Grid>
</UserControl>


Output
 Create Simple Silverlight Application

Saturday, August 31, 2013

How to Use Calendar Control: WPF

To select a date in our client application, enter the date into a textbox and then convert it to the particular class i.e. DateTime. What, if there is an in-built control to select a date, month and a year also. Calendar control is used to do these task and look like the following:

Display Modes of Calendar Control in WPF

The image shows three display modes of this calendar control i.e. month, year and decade respectively. By default it is Month view (the first view). User can switch the view to click on month and then year and so on. It have some commonly used properties which are:

DisplayDate: To specify the displayed date in the calendar control. Assign the date in the system date format.

SelectedDate: change the currently selected date. Used as the display date. If the control shows the old date we can change it to current using following code:
<Calendar SelectedDate="{x:Static sys:DateTime.Now}"/>

SelectionMode: it provides multiple modes for selection like “MultipleRange”. We can select a range of dates by using this property.

BlackoutDates: this control provides a feature of black out some dates means user cannot select some of the date blocked by system.
<Calendar>
<Calendar.BlackoutDates>
<CalendarDateRange Start="08.04.2013" End="08.04.2013"/>
<CalendarDateRange Start="08.16.2013" End="08.24.2013"/>
</Calendar.BlackoutDates>
</Calendar>
It will cross all the dates specified in the above range as shown in the following image:

Blackout Dates in Calendar Control: WPF

DisplayMode: to change the display modes i.e. year, month and decade as in our first diagram.

Like other controls it also have many events like selectedDatesChanged, displayDateChanged, displayModeChanged and etc. We can specify the actions to be performed at the particular event. Calendar control can be customizable as per the requirement of the user like background and foreground.

See also: Button Control

Ways to Use Button Control: WPF

Button, a simple and small name to listen in all the programming languages. All the windows, forms, dialog boxes and even user controls mostly use this button to be performed some action. Open, close, submitting a form and whatever to do can also be performed by button.

Button control is of content control type, means it have a content property to be assigned by us. The content may be a string or anything that can be used under the conditions.

<Button Name=”loginButton” Content=”Click to Login”></Button>

The above button will look like a standard button control and saying the user to click if he/she want to login. Actually, it only have its content property, doesn’t have defined any action to be performed when user will click. So click event have to be defined to perform an action when user click on it.



<Button Name="loginButton" Content="Click to Login" Click="loginButton_Click"></Button>

In the code behind file the click event is generated like the following code in C# language
private void loginButton_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("You are logged in");
}
The message box is not pre-defined. When user click on the button it will show the above message each time. We can bind our button to the commands defined in a class to be performed the same action as in click event. The following code is used to bind a button to a command.

<Button Name="loginButton" Content="Click to Login" Command="{Binding ClickCommand}"></Button>

The command can be simply defined as the below code in C# language:
public ICommand ClickCommand
{
get
{
return showDetailCommand;
}
}
ICommand is the interface that is used for this command binding. We will learn it later. We can use a button as per our requirements using its properties.

How to use Panel Control in ASP.NET

The Panel Control

The Panel control is one of the most frequently used controls. It creates a borderless division on the form, by using this division one can place the controls inside this control. This control exists within System.Web.UI.WebControls namespace. The panel control are useful when you want to show or hide a group of controls at once or when you want to add controls to a Web page through code.

How to change panel background color dynamically

When you add a panel control on a Web page (panelcontrol.aspx), it adds the following code to the source code of the Web page.
<asp:Panel ID="Panel1" runat="server"></asp:Panel>
In this example , we have placed two panel controls on the Web page. The first control contains two RadioButton controls showing color options on the button Control's click event. The second Panel control displays the color selected by any of the RadioButton control.


<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">


    protected void Button1_Click(object sender, EventArgs e)
    {
        string s = string.Empty;
        if (RadioButton1.Checked)
        {
            s = RadioButton1.Text;
            Panel2.Attributes.Add("Style", "BackGround-Color:" + s);
        }
        else
        {
            s = RadioButton2.Text;
            Panel2.Attributes.Add("Style", "BackGround-Color:" + s);
         
        }
     

    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Panel ID="Panel1" runat="server">
            <asp:RadioButton   ID="RadioButton1" runat="server" Text="Red" AutoPostBack="True" GroupName ="c1" />
            <asp:RadioButton ID="RadioButton2" runat="server"  Text="Green" AutoPostBack="True" GroupName ="c1" />



            <br />
            <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Change Color" />
            <br />



        </asp:Panel>
    </div>
        <asp:Panel ID="Panel2" runat="server">
            Panel-color changed</asp:Panel>
    </form>
</body>
</html>

Output
How to change panel background color dynamically

Friday, August 30, 2013

ASP.NET: Total list item count in DropDownlist

Example of count List Item


<%@ Page Language="C#" %>
<!DOCTYPE html>
<script runat="server">
    protected void Button1_Click(object sender, EventArgs e)
    {
        string s = "Total item of the dropdownlist are<br/>";
        s = s + DropDownList1.Items.Count;
        string s1 = "Total item of the listbox are <br/>";
        s1 = s1 + ListBox1.Items.Count;
        Label1.Text = s + "<br/>" + s1;
       
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <strong>HOW TO COUNT LISTITEM IN A DROPDOWNLIST</strong>
        <br />
        <asp:DropDownList ID="DropDownList1" runat="server" Height="46px" Width="133px">
            <asp:ListItem>Item-1</asp:ListItem>
            <asp:ListItem>Item-2</asp:ListItem>
        </asp:DropDownList>
        <br />
        <strong>HOW TO COUNT LISTITEM IN A LISTBOX<br />
        </strong>
        <asp:ListBox ID="ListBox1" runat="server" Height="136px" Width="123px">
            <asp:ListItem>ListItem-1</asp:ListItem>
            <asp:ListItem>ListItem-2</asp:ListItem>
            <asp:ListItem>ListItem-3</asp:ListItem>
            <asp:ListItem>ListItem-4</asp:ListItem>
        </asp:ListBox>
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Count" />
        <br />
        <br />
        <asp:Label ID="Label1" runat="server"></asp:Label>
        <br />
        <br />

    </div>
    </form>
</body>
</html>

Output
ASP.NET: Total list item count in DropDownlist

How to use Table Control in ASP.NET

The Table Control

The Table control helps create a table. The control is useful when you want to present data in a tabular format. This control exists within the System.Web.UI.WebControls namespace. Web designers often use tables for the right placement of elements in Web pages. You can create a Table at design-time or runtime, depending on The requirement of the project.

Public Properties of the Table Class

Caption : Obtains or sets the text to render in an HTML caption element in a Table control.
GridLines : Obtains or set the grid line style to display in the Table control

 Example of the Table Control in ASP.NET

1. Add table rows to the Table Control with the help of the TableRow Collection Editor dialog box by selecting the Table control in the design-mode and clicking the ellipse(...) button in front of its Rows properties in the Properties window.
Table Rows Collection


2. For adding new table rows to the Table control, click the Add button in the TableRow Collection Editor dialog box.
Create Table Rows
3. To add Table cells to a table row, click the ellipsis (...) button in front of its cells property on the right side of the TableRow Collection Editor dialog box.
Create Cells in selected Table rows
4. For adding Table cells to a table row, click the Add button . You can set the Text to be displayed in a table cell by setting its Table property on the right side of the TableCell Collection Editor dialog box.
Add Cell Text

Example of How to use Table Control in ASP.NET



<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
 
        <asp:Table ID="Table1" runat="server" GridLines="Both">
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">Id</asp:TableCell>
                <asp:TableCell runat="server">Name</asp:TableCell>
                <asp:TableCell runat="server">Address</asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">1</asp:TableCell>
                <asp:TableCell runat="server">Dotprogramming</asp:TableCell>
                <asp:TableCell runat="server">Chirawa </asp:TableCell>
            </asp:TableRow>
            <asp:TableRow runat="server">
                <asp:TableCell runat="server">2</asp:TableCell>
                <asp:TableCell runat="server">Narendra</asp:TableCell>
                <asp:TableCell runat="server">Chirawa</asp:TableCell>
            </asp:TableRow>
        </asp:Table>
 
    </div>
    </form>
</body>
</html>

Output
How to use Table Control in ASP.NET

© Copyright 2013 Computer Programming | All Right Reserved