welcome Netizen

Share Your Knowledge.It is a way to achieve immortality

Wednesday, February 23, 2011

Search a Items in Array() String without using any Loop


i got an requirement to search a value in an array,Normally i knew the concept of using for loop ,we can serach the items in array,but now i found new method without using any loop ,Its easy to find a items in arrray.

                    For an examble in an array it contains more than 50 items in array,Now our requirement is search one item in that array list,Normally we use for loop,But considering the time factor we can use another method to follow to find.....

Examble:  item(0)="people"
In that item of array list contains 10 value from that value we are going to find the value of "raj"
Dim lst as list(of string)
Dim result as string =lst.contains("raj")

The result has return a boolean value,if the result has True-"it array contains that value" otherwise it return "false"

i hope this one useful to you.....

Tuesday, February 22, 2011



Its  Really very intresting google has been providing  so many features for the user...Now they offers sms channel
to subscribe any channels as you like,By the way subscption you can easily get daily sms from the channels,
Also for bloggers can easily update the BLOGs articles by using sms,also  you can invites users to view your blog through sms

For that you can subscibe your blog with google sms channels get your own sms channel links..

Here is the link for subcribe for my Blog Post....

click this link and join in this channel ,you can get blog updates  through sms on your mobile

also if you want to create new channel click this below link...

i hope this one helpful to you..also post your valuable comments

How to Refersh a web page at a particular time Without using any script..

Here I will explain how to refresh a web page without using any script..
i hope this one will help for the  developer to develop a web page by using simple code.


You have to add this code in that design page, inside the Head tag..

For refresh the whole page you can use meta tag..
<meta http-equiv="refresh" content="60"/>
Here content shows the time duration for refresh the page...

i hope this one helpful to you ....

Monday, February 21, 2011

How to Disable Back Button in Web page?

i knew many of them could tried to disable the option of Back Button,Because if you would not disable the
user can easily go back to previous page ,so avoid this situation we can use javascript to diable the option
You can add this code in that header tag..Follow this steps

<head runat="server">
    <title>Untitled Page</title>
    <script language="javascript " type ="text/javascript" >
    window .history.forward();

i hope this helpful to u .....

Wednesday, February 16, 2011

How to rotate the ads without refreshing the page by using Adrotator in Ajax....

hi ..Create your own add in your webpage..
In this article i describe about ,how to display the ads in webpage by using adrotator,
By using AJAX without refreshing the whole page you can easily display the diffrent ads in the particular area....
Intially the ads are stored in xml file ..
First you have to create the xml file for ads.

<AlternateText>This is Sample image</AlternateText>
<AlternateText>This is Sample image</AlternateText>

and save it advertisement.xml

Next create an new applications

In this adrotator->>you can finthis one in toolbox
Add Script Manage and timer
and add update panel
In this adrotator properties you can add the advertisement xml file
And also  set the time for rotating the ad in the timer control

Your code should be like this....

 <asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
    <asp:Timer ID="Timer1" Interval="2000" runat="Server">
<asp:UpdatePanel ID="updatepanel1" runat="Server">
<asp:AsyncPostBackTrigger ControlID="Timer1" Eventname="Tick" />

    <asp:AdRotator ID="AdRotator2" runat="server" DataSourceID="XmlDataSource2" />
    <asp:XmlDataSource ID="XmlDataSource2" runat="server" DataFile="~/Advertisements.xml">

Your add should be like this ..........

How to insert XML data into SQL Database...


Here i can simply explain to store xml data into sql database ,

create a SQL database like this...
1)carsid           varchar(50)
2)carsmodel     varchar(50)
3)carscolor       varchar(50)

This is a xml file to store into sql table..

- <system>
- <message>
- <message>
- <message>

Then enter the code behind submit button to store xml data into sql databse..

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Carsid, Carsmodel, Carscolor,str As String

 Dim sXMLFilePath As String = "C:\users\admin\desktop\12.xml"

        Dim document As New XmlDocument()

        Dim xmlNodeList As XmlNodeList = document.SelectNodes("system/message")
        For Each node As XmlNode In xmlNodeList
            Carsid = Integer.Parse(node("Carsid").InnerText)
            Carsmodel = node("Carsmodel").InnerText
            Carscolor = node("Carscolor").InnerText

            str = "INSERT INTO car (Carsid,Carsmodel,Carscolor) values ('" & Carsid & "', '" & Carsmodel & "','" & Carscolor & "')"
            sqlcmd = New SqlCommand(str, sqlcon)
                    sqlcmd.CommandType = CommandType.Text

    End Sub

i hope this helpful to u.................

Sunday, February 6, 2011

Upload a Image or File into Database in ASP.NET using VB coding


In previous articles we have seen about uploading files into folder..This articles to update a files into  database...
For that you have to add following items in design side..
1) File upload
2)1 Button
3) text box
4) Label

Before in SQL you have to create a table like this..
CREATE TABLE [dbo].[upload](
[fileid] [int] IDENTITY(1,1) NOT NULL,
[ImageName] [varchar](max) COLLATE SQL_Latin1_General_CP1_CS_AS NULL,
[Image] [image] NULL

Follow the server side coding....
In submit button you have to add the following codes.....

In file uploading has one important property  HTTPPOSTEDFILE, by using this property we can easily get the file upload details
like file length,file content type and file name.....Also we can easily check  file extension..For an example if we want to upload only gif image
means by using content type we can check the file type...After checking we can upload the file into database

'Checking the file in fileupload
            If FileUpload1.HasFile Then

                Dim imageSize As Byte()
                imageSize = New Byte(FileUpload1.PostedFile.ContentLength - 1) {}

                Dim postfile As HttpPostedFile = FileUpload1.PostedFile()

                postfile.InputStream.Read(imageSize, 0, CInt(FileUpload1.PostedFile.ContentLength))

                ' Create SQL Connection 
                Dim con As New SqlConnection()
                con.ConnectionString = ConfigurationManager.ConnectionStrings("Con").ConnectionString

                ' Create SQL Command 
'Checking file type
                If postfile.ContentType.ToLower() = "image/gif" Then

                    Dim cmd As New SqlCommand()
                    cmd.CommandText = "INSERT INTO upload(ImageName,Image) VALUES (@ImageName,@Image)"
                    cmd.CommandType = CommandType.Text
                    cmd.Connection = con
                    Dim ImageName As New SqlParameter("@ImageName", SqlDbType.VarChar, 50)
                    ImageName.Value = TextBox1.Text.ToString

                    Dim imagelenth As New SqlParameter("@Image", SqlDbType.Image, imageSize.Length)
                    imagelenth.Value = imageSize
                    Dim result As Integer = cmd.ExecuteNonQuery()
                    Label1.Text = "Its not a gif image"
                End If
                Label1.Text = "please select the file to uplaod"
            End If
        Catch ex As Exception
        End Try

    End Sub

Hope this helps to u.....

Friday, February 4, 2011

Upload a File in ASP.NET using VB coding

In this article you are going to see about to upload file in

Folloe the client side coding......

Normally if you want to upload a file you have to add FILEUPLOAD its present in the toolbox

then you have to add one button rename it submit
Follow server side

In server side you have to add the following code in the submit button event ....

Protected Sub submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles 


            Dim filetype As String
            Dim file As String
            Dim filepath As String
            Dim uploadpath As String
            file = FileUpload1.PostedFile.FileName

            filepath = Path.GetFileName(file)
            uploadpath = "d:\vijay\"

                FileUpload1.PostedFile.SaveAs(Path.Combine(uploadpath, file))
                Response.Write("upload succesfully")

        Catch ex As Exception

        End Try
End Sub

Normally when upload one issue araise ,How to check the upload file name extension..this one was the big problem for developer....
For checking extension in VB present one function i.e CONTENT TYPE....
By using this function you have check the file extension coding..

In this exanble i checked the gif image file ...


            Dim filetype As String
            Dim file As String
            Dim filepath As String
            Dim uploadpath As String
            filetype = FileUpload1.PostedFile.ContentType
            file = FileUpload1.PostedFile.FileName

            filepath = Path.GetFileName(file)
            uploadpath = "d:\vijay\"
            If filetype = "image/gif" Then

                FileUpload1.PostedFile.SaveAs(Path.Combine(uploadpath, file))
                Response.Write("upload succesfully")
                Response.Write("its not gif file")
            End If

        Catch ex As Exception

        End Try
By using this method you can easily check file type at the time of upload.....

i hope this article helpful to uu.....

plz post your valuable comments here..............

Thursday, February 3, 2011

Default Button in

hi..i have seen many of them dont know the usage of setting default button..

By reading this one you can get clear idea about uses of setting Default Button..
In an webpage when creatiing form like an application or any fill up form ,when the user enter the
field in textbox after fill up user hit the enter button on the keyboard Then the deafult button will fire..
let me see where to write default button coding ...

<form id="form1" runat="server" defaultbutton ="button3">

In the main form id you have to add the default button id...

Tuesday, February 1, 2011


hi friends..

Here i describe the methods to load sql data table into grid view.By using this article you will get clear idea to load the table into grid view also you can also update the table using grid view..

--------This are Grid view coding are comes under client side ...........
 <asp:GridView ID="GridView1" runat="server"
            CellPadding="3" GridLines="Vertical"
            AutoGenerateColumns="False" Height="155px" Width="573px" BackColor="White"
                BorderColor="#999999" BorderStyle="None" BorderWidth="1px"
                AllowPaging="True" DataKeyNames="Number">
                    <Columns >
        <asp:TemplateField HeaderText ="PHONE NUMBER">
                        <ItemTemplate >
        <asp:TemplateField HeaderText ="NAME" >
                        <ItemTemplate >
                         <EditItemTemplate >
                         <cc1:textbox ID="txtrwname" runat="server" Text ='<%#Bind("Name")%>'></cc1:textbox>
        <asp:TemplateField  HeaderText ="ADDRESS">
                        <ItemTemplate >
                        <ItemStyle HorizontalAlign="Left" />    
                           <EditItemTemplate >
                            <cc1:textbox ID="txtrwaddress" runat="server" Text='<%#bind("Address")%> ' Validate ="IsAlphaNum" ></cc1:textbox>
        <asp:TemplateField HeaderTEXT="CITY" >
                        <ItemTemplate >
                               <cc1:textbox ID="txtrwcity" runat="server" Text='<%#bind("City")%>'></cc1:textbox>
            <asp:TemplateField HeaderText ="STATE">
                           <cc1:textbox ID="txtrwstate" runat="server" Text='<%#bind("State")%> ' Validate ="IsAlphaNum ">
---------This field are used to modify and update the database---------------------

  <asp:CommandField HeaderText ="modify" ShowDeleteButton ="false" ShowEditButton ="true" EditText ="modify" />
       <asp:TemplateField HeaderText="Delete">
                                        <asp:LinkButton ID="lnkDelete" CommandName="Delete" runat="server" OnClientClick ="return confirm('are you sure')">Delete</asp:LinkButton>

---In server side you have to add this coding by using grid view properties------

  Sub loadde()
        fselect = "select * from phone"
        'sselect = "select *from phone where Number='" & txtPhonno.Text & "'"
        'r1table = obj.ExecuteData(sselect)
        rtable = obj.ExecuteData(fselect)

        GridView1.DataSource = rtable

You can find this event in Grid View properties......

Protected Sub GridView1_RowEditing(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GridView1.RowEditing
        GridView1.EditIndex = e.NewEditIndex
    End Sub

Protected Sub GridView1_RowCancelingEdit(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GridView1.RowCancelingEdit
        GridView1.EditIndex = -1

    End Sub
Protected Sub GridView1_PageIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewPageEventArgs) Handles GridView1.PageIndexChanging
        GridView1.PageIndex = e.NewPageIndex

    End Sub

 Protected Sub GridView1_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GridView1.RowDeleting
           phonercd = GridView1.DataKeys(e.RowIndex).Value.ToString
        fselect = "delete phone where Number='" & phonercd & "'"
    End Sub
 Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GridView1.RowUpdating
                fselect = "update phone set Name='" & Trim(rwname.text) & "',Address='" & Trim(rwaddress.Text) & "',City='" & Trim(rwcity.Text) & "',State='" & Trim(rwstate.text) & "' where Number='" & Trim(phonercd) & "'"
        GridView1.EditIndex = -1
    End Sub
plz post your valuable comments.....

Application ,Session,Cache and Cookies in ASP.NET

Hi friends ...This articles is fully discuss about basics cocept that every web developer should know the thing..


Its really very intrested to read about application ..Application is used to store the variables and objects to use throughout the entire application.And also you can share the stored variable in all pages.
In moreover the application and session state are same concept the main difference between the application and session is that the session state store and share the variables for one particular user,whereas the application layer store variables that all user, share the information at the same time.

Let us see one examble for Apllication..

Now by using appliation i created the counter for tthe page ...

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Application("counter") Is Nothing Then
            Application("counter") = 1
            Application("counter") += 1
        End If
        Label1.Text = Application("counter")

    End Sub

In client side you have to add one label...
in serve side in load event just add the codings..
Now at the every time when the page load the counter will increment the count.This count store the variables for that all user using the page.


Like application state the session state are used to store the temporary infromation in this page.But in session state the variable store the value for the current user using the page,But its deosnot the share the information to all user like application.
if you want to store the temporary infomation regarding the current use ,we can use session

we can use the session for all pages in the application..
After closing the browser sesion has end at the particular time,this time property has set in GLOBAL.ASAX page.


cache is like similar to application,Both have shared the data between all user using the web application
By using insert the data is stored into cache ans also we have set the time using the time sapn till the time the data is present in the cache.
Cache.Insert("User", UserTable, Nothing,
DateTime.MaxValue, TimeSpan.FromMinutes(10))

If you want to store data related to a particular user, you could use the Session object,but in session has as an important drawback: its contents are lost when the user closes the browser window
To store user data for longer periods of time, you need to use cookies .Cookies are not lost when the browser is closed (unless the user deletes them), so you can save data that helps identify your user in a cookie.