-->

Thursday, October 1, 2015

Use pen paint tool online using html5 canvas with JQuery

Introduction
In this article i will show you how to draw using pencil, i mean to say your mouse cursor behaves like pencil on specific area of web browser. You can draw something on web browser using mouse cursor. Also you can use this for digital signature. Through this article i will explain how to design paint online for drawing something.



Description
In this article i will use Html5 canvas with JQuery. i will use canvas for drawing area and sketch.js file is used for drawing on it. I explained Button working as file upload control using JQuery, Open and close new window using Jquery , event inside event example in JQuery etc.

Source code:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script src="http://intridea.github.io/sketch.js/lib/sketch.min.js"></script>
    <script>
        $(function () {
            $('#sketch').sketch();

            $(".digital a").eq(0).attr("style", "color:#ddd");
            $(".digital a").click(function () {
                $(".tools a").removeAttr("style");
                $(this).attr("style", "color:#000");
            });


            $("#savebtn").bind("click", function () {
                var base64 = $('#sketch')[0].toDataURL();
                $("#imgc").attr("src", base64);
                $("#imgc").show();
    });
        });
     </script>


</head>
<body>
    <div class="digital">
        <a href="#sketch" data-tool="marker">marker</a>
        <a href="#sketch" data-tool="remover">remover</a>
            </div>

    <br/>
    <canvas id="sketch" width="600" height="300"></canvas>
    <br/>
    <input type="button" id="savebtn" value="image save"/>
    <img id="imgc" alt="" style="display:none"/>



</body>
</html>

Code Generate the following output

WPF: Show Each row details in DataGrid when we click on rows

Introduction
In this article i will explain how to bind the DataGrid with list, which is already bind with public class. Also explain, when we click on any row of DataGrid then it display detailed information of selected row. This things is possible through RowDetailsTemplate of DataGrid Template. In this DataGrid we have two TextColumn and one TextBlock.

Source Code

<Grid Name="grid1" Margin="0,10,0,0">
        <DataGrid Name="dg" AutoGenerateColumns="False">
            <DataGrid.Columns>
                <DataGridTextColumn Header="ID" Binding="{Binding Id}"/>
                <DataGridTextColumn Header="Name" Binding="{Binding Name}"/>


            </DataGrid.Columns>
            <DataGrid.RowDetailsTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Details}"/>
                </DataTemplate>
            </DataGrid.RowDetailsTemplate>          
        </DataGrid>    

    </Grid>

Code Behind 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for addcolumn.xaml
    /// </summary>
    public partial class addcolumn : Window
    {
        public addcolumn()
        {
            InitializeComponent();
            List<student> students = new List<student>();
            students.Add(new student() { Id = 1, Name = "Jacob" });
            students.Add(new student() { Id = 2, Name = "Bill" });
            students.Add(new student() { Id = 3, Name = "Ammey" });
            students.Add(new student() { Id = 4, Name = "John" });
            students.Add(new student() { Id = 5, Name = "kitty" });
            dg.ItemsSource = students;
       
        }
     public class student
     {
         public int Id { get; set; }
         public string Name { get; set; }
         public string Details
         {
             get
             {
                 return String.Format("{0}=>this is row id and {1}=> this is row name", Id, Name);
             }
         }
     }
           
    }
}

Code generate the following output

WPF: Show Each row details in DataGrid when we click on rows

Wednesday, September 30, 2015

fire event inside another event using JQuery

Introduction
In this article i will show you how to fire event inside event using JQuery. I will give an example of it. In this article, first we create a table using JQuery then append the table with the dynamically created table. First, we get the column of the table for inside event then generate function on table row. Lets check the example.

Source code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="browserdetails.aspx.cs" Inherits="browserdetails" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <title></title>
    <script>
 

        $(function () {
            $("#btncreate").click(function () {
                var newtable = '<table id="mytable"><tr><td>Column1</td><td>Column2</td></tr><tr><td>Row11</td><td>Row12</td></tr></table>';
                $("#tbcontainer").append(newtable);

                var tblid = $("#tbcontainer table").attr("id");
           
                $("#" + tblid).on("click", "tr:last", function () {
                    var val1 = $(this).find("td").eq(0).text();
                    var val2 = $(this).find("td").eq(1).text();
                    alert(val1 + "  " + val2);
                })
            })
        })
</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    <label id="tbcontainer" />
   
        <input id="btncreate" type="button" value="button" />
    </div>
    </form>
</body>
</html>

Code Generate the following output
fire event inside another event using JQuery

Open and close new window using JQuery

Introduction
In this article i will show you how to open new window when we click on button using JQuery. I will give an example of it. Also do some thing like when we click on other button then opened new window will closed also mentioned in the example.

Description
I have explained Get browser details using JQuery, Button work as fileupload control in JQuery.
Source code
<!DOCTYPE html>
<html>
<head>
    <title> OPen and close window using JQuery </title>
</head>
<body>

    <form name="form1">
        <input type="button" value="Open New Window" id="btnOpen" />
        <p> <input type="button" value="Close New Window" id="btnClose" />

    </form>
    <script src="https://code.jquery.com/jquery-2.1.4.js"></script>
    <script type="text/javascript">
     
        var Window1;
        $(function () {
            $(form1.btnOpen).click(function () {
                Window1 =  window.open('', 'YourWindow', 'height=500,width=500');
            });
            $(form1.btnClose).click(function () {
                Window1.close();
            });
        });

   
 
    </script>
</body>
</html>
Code Generate the following output
Open and close new window using JQuery

Tuesday, September 29, 2015

Get browser details using JQuery

Introduction 
In this article i will show you how to determine which web browser is selected for your application or you can say that how many user open your website in which web browser. Through this article i will show you Browser type, Browser version etc. Lets check the example of getting browser details using JQuery.



Description
In previous article i explained Button work as fileupload control in JQuery  , Select box validation using JQuery , JQuery TextBox validation when it emptyRetrieve selected Radio button and checkbox value using JQueryHow to show popup on page load using JQuery .

Code Example:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="browserdetails.aspx.cs" Inherits="browserdetails" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <label id="blbl" />
        <script>
            $(function () {

                $.each($.browser, function (i, val) {

                    $("#blbl").append(i + '=>' + val + '<br/>');

                });
             
            })

        </script>
    </div>
    </form>
</body>
</html>
Code Generate the following output

Get browser details using JQuery

Sunday, September 27, 2015

How to deploy windows phone 8.1 application to device

If you want to run your windows phone 8.1 application to your physical device or you can say phone that you can follow these instruction which is mentioned below:
1. Search windows phone developer registration 8.1 from your window start screen.


windows phone 8.1 registration

2. Register your windows phone now.

windows phone 8.1 registration

3. After successfully registration, set platform of windows phone by build menu in visual studio like:

Configuration manager of build menu
4. Select Platform as "ARM" from Dropdown option.

windows phone device
 5. Now, connect your phone with your computer from USB cable.
6. Run your application.

Friday, September 25, 2015

Bind DataList from database in asp.net c#

Introduction

In this article i will show you how to bind dataList from database table. Also i will give an example of it. In this example i will set the orientation property of items also set columns which is appear on the web page.

The DataList Control

The DataList control is a Data bound control that display data by using templates. These templates define controls and HTML elements that should be displayed for an item. The DataList control exists within the System.Web.UI.WebControl namespace.
Now , lets take an example.

How to bind DataList Control using the SqlDataSource

Follow some steps for binding Datalist to SqlDataSource . Steps same as Previous post. Basically SqlDataSource is used to connect front-end to  back-end using connection string . Connection string  saved in configuration file.
Now , After establishing connection you have to use property builder through ShowSmart tag.

DataList Property builder
Select Property Builder link , Now after selected a new window will open 


dataList Properties

Run You Application

<%@ 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:DataList ID="DataList1" runat="server" DataKeyField="Id" DataSourceID="SqlDataSource1" Height="285px" RepeatColumns="3" RepeatDirection="Horizontal" Width="134px">
            <ItemTemplate>
                Id:
                <asp:Label ID="IdLabel" runat="server" Text='<%# Eval("Id") %>' />
                <br />
                namet:
                <asp:Label ID="nametLabel" runat="server" Text='<%# Eval("namet") %>' />
                <br />
                Income:
                <asp:Label ID="IncomeLabel" runat="server" Text='<%# Eval("Income") %>' />
                <br />
<br />
            </ItemTemplate>
        </asp:DataList>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [footerex]"></asp:SqlDataSource>
 
    </div>
    </form>
</body>
</html>

Output
How to use DataList Control in ASP.NET

© Copyright 2013 Computer Programming | All Right Reserved