Friday, July 29, 2011

How To Create Menu Bar through Web.SiteMap file?

Add the Site Map file to the Website................................





 Select the Web.SiteMap file...............and press Ok


Write the code in Web.SiteMap file................


Add Menu Control from the toolbox........to the page where u want to place ur menu........


After adding the menu bar to the page........click on the arrow which is in the right top corner of the menu bar.....and you will find "Choose Data Source" drop down list................click on that and select "<New Data Source>"


One window will open.............select "Site Map" and press ok........


Your Menu Has created.....by using Site Map..............

and now how to add "SiteMapPath"......to the page.........................................
-------------------------------------------------------------------------------------------------
Drag and drop the SiteMapPath control from the navigation toolbox.......to the page........

see the path ....here..........


Done.........................................Enjoy.........................




Tuesday, July 19, 2011

Hotel Management System software Screen Shots

 This is the Application name is HOTEL MANAGEMENT SYSTEM (Windows Based Application)......which is mainly i developed for the Hotels. By using this application hotel management can easily manage the works....like adding employee to the hotel, Room Status, Availability of rooms, kitchen system, updating employee details are easy in this. Like that all works.






















Monday, July 18, 2011

Opening a small size image in New Tab with original size

  • Add ------ Image Button Control To The Page
  • Then------ Add Image to the Button
  • Then------ Run The website
At the running time, 
Right Click on the Image Button & Open in New Tab.


Result--- That Button Image will Open in full size in new tab.

Adding of Flash File(.swf) to the Webpage in ASP.NET

Write below code in the source view of webpage.......
--------------------------------------------------------------------

<object type ="application/x-shokwave-flash" data ="yourFlashFile.swf" width="" height ="" >
<param name="movie" value="yourFlashFile.swf" />

How to add Images to the AdRotator Control and how to make this control automatic refreshable ?

Q.) How to add Images to the AdRotator Control and how to  make this control automatic refreshable ?

Answer:-) 
---------------------------------------------------------------------------------------------------------​-------
  • Create Website
  • Create one Image Folder inside Website root
  • Add images to the Folder
Then,
  • Minimize the website & open Notepad, 
Save Notepad with name with extension .xml (eg; adrotator.xml).
  • Open adrotator.xml in Noetpad & write code which mensioned below:
---------------------------------------------------------------------------------------------------------​------
<?xml version="1.0" encoding="utf-8"?>
<Advertisements>
    <Ad>
        <ImageUrl>Image\Chrysanthemum.jpg</ImageUrl>
        <NavigateUrl></NavigateUrl>
        <AlternateText></AlternateText>
        <Keyword>A</Keyword>
        <Impressions>Technology</Impressions>
        <Caption>This is the caption for Ad#1</Caption>
    </Ad>


  <Ad>
        <ImageUrl>Image\Desert.jpg</ImageUrl>
        <NavigateUrl>http://www.sulekha.net</NavigateUrl>
        <AlternateText>www.Sulekha.net</AlternateText>
        <Keyword>B</Keyword>
        <Impressions>Web Site</Impressions>
        <Caption>This is the caption for Ad#2</Caption>
    </Ad>


    <Ad>
        <ImageUrl>Image\Hydrangeas.jpg</ImageUrl>
        <NavigateUrl></NavigateUrl>
        <AlternateText>www.neostream.net</AlternateText>
        <Keyword>C</Keyword>
        <Impressions>Flash Site</Impressions>
        <Caption>This is the caption for Ad#3</Caption>
    </Ad>
</Advertisements>

---------------------------------------------------------------------------------------------------------​--------

  • After writing every code in xml file Save it again. 
  • Then, Maximize the Website & add this xml file to website.
  • Go To Source View of Default.aspx(Page Name) and Write the code which is mensioned below:-
---------------------------------------------------------------------------------------------------------​--------
<body style="height: 966px">
    <form id="form1" runat="server">
     <asp:ScriptManager ID="ScriptManager1" runat="server" />
    <div>
       <asp:Timer ID="Timer1" OnTick="Timer1_Tick" runat="server" Interval="2000">
        </asp:Timer>
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server">
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>
    <ContentTemplate>
      <asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/adrotator.xml " target="_self"

     style="z-index: 1; left: 10px; top: 15px; position: absolute; height:50px ; width:100px " 
            onadcreated="AdRotator1_AdCreated" Height="200px" Width="300px" />
            </ContentTemplate>
       </asp:UpdatePanel>
       <asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server">
    <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
    </Triggers>

    </asp:UpdatePanel>

    <asp:TextBox ID="TextBox1" runat="server" 
        style="z-index: 1; left: 1062px; top: 152px; position: absolute"></asp:TextBox>
    <asp:TextBox ID="TextBox3" runat="server" 
        style="z-index: 1; left: 1059px; top: 275px; position: absolute"></asp:TextBox>
    </form>
</body>

---------------------------------------------------------------------------------------------------------​--------

  • Copy this source code and paste it on Default.aspx page........In place of Body tag.
  • And go to design vew and double click on Timer Control.
  • Build the website and run

Result:- You will find pictures are changing automatically............

I put the textbox to make it clear only adrotator control is updating.

------------------------------------------------------------------------------------------------

Enjoy the code....................

Encreyption and Decryption of data in ASP.NET.

Q.) How to Encrypt And Decrypt the data in ASP.NET ?

Answer:-
---------------------------------------------------------------------------------------------------------​----------
Write Below Code In Code view of Page (Default.aspx.cs)
------------------------------------------------------------------------
In Design view Take-- 
  1. One Label
  2. Two Buttons
  3. Three TextBoxs
I mensioned the image of the Desging page also in the post..........design ur page like that.....
---------------------------------------------------------------------------------------------------------​-------
---------------------------------------------------------------------------------------------------------​---------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


public class EncryptionTest
{


    public static string base64Encode(string sData)
    {
        try
        {
            byte[] encData_byte = new byte[sData.Length];


            encData_byte = System.Text.Encoding.UTF8.GetBytes(sData);


            string encodedData = Convert.ToBase64String(encData_byte);


            return encodedData;


        }
        catch (Exception ex)
        {
            throw new Exception("Error in base64Encode" + ex.Message);
        }
    }


    public static string base64Decode(string sData)
    {
        try
        {


            System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();


            System.Text.Decoder utf8Decode = encoder.GetDecoder();


            byte[] todecode_byte = Convert.FromBase64String(sData);


            int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);


            char[] decoded_char = new char[charCount];


            utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);


            string result = new String(decoded_char);


            return result;
        }
        catch (Exception ex)
        {
            throw new Exception("Error in base64Decode" + ex.Message);
        }


    }


}
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {


    }

    protected void Button1_Click1(object sender, EventArgs e)
    {


        string val = TextBox1.Text;
        string pass = EncryptionTest.base64Encode(val);
        TextBox2.Text = pass;


        //you can pass this value to database for storing
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        //from database you can decrypt the value like this


        string str = EncryptionTest.base64Decode(TextBox2.Text);
        TextBox3.Text = str;
    }
}
 --------------------------------------------------------------------------------------------------------​------------
---------------------------------------------------------------------------------------------------------​------------
Thank you.
By:-Rajesh Kumar Sahu