Records navigate first,next,previous,last

how to records navigate first,next,previous,last record try this code

server side


Imports System.IO
Imports System.Data
Partial Class RecordNavigate
Inherits System.Web.UI.Page
Private cls1 As Class1
Dim dt As Data.DataTable
Dim n As Integer
Dim n1 As Integer
Dim dr As DataRow
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cls1 = New Class1
dt = cls1.Crr("select * from tbemp", "re")
dtg1.DataSource = dt
dtg1.DataBind()
txb1.Attributes.Add("onkeypress", "ChangeValue()")
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
n = Session.Item("n") + 1
If (n > dt.Rows.Count - 1) Then
lblIntimate.Text = "Record is Eof!.."
Else
dr = dt.Rows(n)
Txt1.Text = dr(0)
Txt2.Text = dr(1)
End If
Session.Item("n") = n
End Sub
Protected Sub b1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles b1.Click
dr = dt.Rows(0)
Txt1.Text = dr(0)
Txt2.Text = dr(1)
End Sub
Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim lst As Integer = dt.Rows.Count - 1
dr = dt.Rows(lst)
Txt1.Text = dr(0)
Txt2.Text = dr(1)
End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
n = Session.Item("n") - 1
If (n = -1) Then
Else
dr = dt.Rows(n)
Txt1.Text = dr(0)
Txt2.Text = dr(1)
End If
Session.Item("n") = n
End Sub
End Class


client side


< html xmlns="http://www.w3.org/1999/xhtml" >
< head runat="server" >
< title >Untitled Page< /title >

< /head >
< body >
< form id="form1" runat="server" >
Name : < asp:TextBox ID="Txt1" runat ="server" >< /asp:TextBox >
< br / >
< br / >
Amount : < asp:TextBox ID="Txt2" runat ="server" >< /asp:TextBox >
< br / >
< asp:Label ID="lblIntimate" runat ="server" ForeColor="Red" >< /asp:Label >< br / >
< br / >
< asp:Button ID="b1" runat ="server" Text ="First" / >
< asp:Button ID="Button1" runat ="server" Text ="Next" / >
< asp:Button ID="Button2" runat ="server" Text ="Previous" / >
< asp:Button ID="Button3" runat ="server" Text ="Last" / >

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


Comments

Author: Mrs. Meetu Choudhary Nanda04 Jul 2009 Member Level: Gold   Points : 2

Please Re format your Client Side Portion of the article to get approved.

++
Thanks and Regards
Meetu Choudhary
Site Coordinator.

Author: Jayakumar.R04 Jul 2009 Member Level: Gold   Points : 0

Pl Explian how to format

here client code 



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: