Friday, 2 August 2013

Create Dynamic Menu in EXT.NET





First create a menu table in the database like this

GO
/****** Object:  Table [dbo].[menu]    Script Date: 08/03/2013 00:03:09 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[menu](
[id] [int] IDENTITY(1,1) NOT NULL,
[rootmenu] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[childmenu] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
[subchildmenu] [varchar](50) COLLATE Latin1_General_CI_AI NULL,
 CONSTRAINT [PK_menu] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

GO
SET ANSI_PADDING OFF



After that  create a page Default.aspx


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DynamicMenu._Default" %>



<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>



<!DOCTYPE html>

<html>
<head id="Head1" runat="server">
    <title>Dynamic Menu</title>
    <link href="/resources/css/examples.css" rel="stylesheet" />
</head>
<body>
    <ext:ResourceManager runat="server" />
   
   
    <asp:PlaceHolder ID="PlaceHolder1" runat="server" />
</body>
</html>




Then at code behind give the following code


using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Ext.Net;
using System.Data.SqlClient;

namespace DynamicMenu
{
    public partial class _Default : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            DataSet PrSet = PDataset("Select * from menu");

            foreach (DataRow dr in PrSet.Tables[0].Rows)
            {
                TreePanel tree = new TreePanel();

                tree.RootVisible = false;

                Ext.Net.Node root = new Ext.Net.Node();
                root.NodeID = dr["rootmenu"].ToString();
                root.Expanded = true;

                tree.Root.Add(root);

                Ext.Net.Node node1 = new Ext.Net.Node();

                node1.Text = dr["childmenu"].ToString();
                node1.Expanded = true;

                node1.Children.Add(new Ext.Net.Node()
                {
                    Text = dr["subchildmenu"].ToString(),
                    Href = "Default.aspx",
                    Icon = Icon.User,
                    Leaf = true

                });


                root.Children.Add(node1);

                Ext.Net.Node node2 = new Ext.Net.Node();
                node2.Text = dr["childmenu"].ToString();
                node2.Expanded = true;

                node2.Children.Add(new Ext.Net.Node()
                {
                    Text = dr["subchildmenu"].ToString(),
                    Icon = Icon.UserFemale,
                    Leaf = true
                });


                root.Children.Add(node2);



                Ext.Net.Panel window = new Ext.Net.Panel();
                window.Title = dr["RootMenu"].ToString();
                window.Width = Unit.Pixel(250);
                window.BodyBorder = 0;
                window.Layout = "Accordion";
                window.Collapsible = true;
                window.Items.Add(tree);

                this.PlaceHolder1.Controls.Add(window);
            }
        }

        protected DataSet PDataset(string Select_Statement)
        {

            SqlConnection SqlCon = new SqlConnection("Your Connectionstring");

            SqlDataAdapter ad = new SqlDataAdapter(Select_Statement, SqlCon);

            DataSet ds = new DataSet();

            ad.Fill(ds);

            return ds;



        }
    }
}



Thursday, 1 August 2013

Use your Android Phone as a Webcam

Follow the below steps to turn your android phone to webcam.......................



Step 1:  Download IP camera Adapter for PC.

Step 2:  Install it on your PC

Step 3:  Download IP-Webcam APK for your Android Phone

Step 4:  Install it on your Phone

Step 5:  Run IP camera Adapter for PC

Step 6:  Start IP-Webcam in your phone.

Step 7:  Select start server in IP-Webcam

Step 8:  Copy the IP address in IP-Webcam and enter it in camera feed URL                            (http://192.168.1.11:8080/videofeed) in IP camera Adapter for PC

Step 9:  Open the above address in the browser of your PC and start using your new webcam.



Instructions: 

1.Click DOWNLOAD 

2.Click on SKIP AD on next page to get download link


Sunday, 21 July 2013

EXPORT MULTIPLE GRIDVIEWS TO EXCEL SHEET ON SINGLE BUTTON CLICK(Code Behind)

The code given below is for getting custom output in excel sheet.
In this example 12 Gridviews are used and are arranged in a custom format in excel sheet...

Browser Output



        protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
        {
            Response.Clear();
            Response.Buffer = true;

            Response.AddHeader("content-disposition",
             "attachment;filename=GridViewExport.xls");
            Response.Charset = "";
            Response.ContentType = "application/vnd.ms-excel";
            StringWriter sw = new StringWriter();
            HtmlTextWriter hw = new HtmlTextWriter(sw);

            Table tb = new Table();
         

            TableRow tr1 = new TableRow();
            TableCell cell1 = new TableCell();
            cell1.Controls.Add(GridView1);
            tr1.Cells.Add(cell1);
            TableCell cell2 = new TableCell();
            cell2.Controls.Add(GridView2);
            tr1.Cells.Add(cell2);
            TableCell cell3 = new TableCell();
            cell3.Controls.Add(GridView3);
            tr1.Cells.Add(cell3);
            TableCell cell4 = new TableCell();
            cell4.Controls.Add(GridView4);
            tr1.Cells.Add(cell4);
            TableCell cell5 = new TableCell();
            cell5.Controls.Add(GridView5);
            tr1.Cells.Add(cell5);
            TableCell cell6 = new TableCell();
            cell6.Controls.Add(GridView6);
            tr1.Cells.Add(cell6);
            tb.Rows.Add(tr1);
               
      ////////////////////////Second row on Excel Sheet/////////////////////////

            TableRow tr2 = new TableRow();
            TableCell cell7 = new TableCell();
            cell7.Controls.Add(GridView7);
            tr2.Cells.Add(cell7);
            TableCell cell8 = new TableCell();
            cell8.Controls.Add(GridView8);
            tr2.Cells.Add(cell8);
            TableCell cell9 = new TableCell();
            cell9.Controls.Add(GridView9);
            tr2.Cells.Add(cell9);
            TableCell cell10 = new TableCell();
            cell10.Controls.Add(GridView10);
            tr2.Cells.Add(cell10);
            TableCell cell11 = new TableCell();
            cell11.Controls.Add(GridView11);
            tr2.Cells.Add(cell11);
            TableCell cell12 = new TableCell();
            cell12.Controls.Add(GridView12);
            tr2.Cells.Add(cell12);
            tb.Rows.Add(tr2);

            tb.RenderControl(hw);

            string style = @"<style> .textmode { mso-number-format:\@; } </style>";
            Response.Write(style);
            Response.Output.Write(sw.ToString());
            Response.Flush();
            Response.End();

        }

Excel output

 If you find any problem with the code,be free to comment below...
We will try to solve it....

Friday, 26 April 2013

SIMPLE C PROGRAM TO SHOW A PLANE CRASH

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(6);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,50,20);
line(350-i,295,380-i,280);
line(341-i,313,380-i,313);
line(380-i,280,380-i,313);
bar3d(50,150,95,800,10,1);
delay(50);
cleardevice();
}
for(j=0;j<500;j++)
circle(95,295,j);
getch();
}

SIMPLE COMPUTER GRAPHICS C PROGRAM TO SHOW THE MOVEMENT OF FISH

#include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include<dos.h>
void main()
{
int gdriver = DETECT, gmode, errorcode; int i,j;
initgraph(&gdriver, &gmode,"");
clrscr();
setcolor(4);
for(i=0;i<150;i++)
{
ellipse(300-i, 300, 0, 360,30,10);
line(328-i,295,350-i,280);
line(328-i,303,350-i,310);
line(350-i,280,350-i,310);
circle(280-i,299,2);
delay(50);
cleardevice();
}
for(j=0;j<150;j++)
{
ellipse(300-i, 300-j, 0, 360,30,10);
line(328-i,295-j,350-i,280-j);
line(328-i,303-j,350-i,310-j);
line(350-i,280-j,350-i,310-j);
circle(280-i,299-j,2);
delay(50);
cleardevice();
}
getch();
}