ajay raju

ajay raju

  • NA
  • 398
  • 0

Display Next Records in Textboxes in Web Application

Apr 16 2010 1:57 AM

hi!
i am taking emp table in sqlserver. that table contains Eno,Ename,Sal columns and insert some values into the Table.
And in my Web form i take 3 labes for column names and 3 textboxes for showing Employee Details. and Take Next Button.
i write code like
int Rowno = 0 (declared in class)
in form load i create objects to sqlconnection,sqldataadapter,dataset
code under Next  button click
If
(Rowno < ds.Tables(0).Rows.Count - 1) Then
rno += 1
TextBox1.Text = ds.Tables(0).Rows(Rowno)(0).ToString()
TextBox2.Text = ds.Tables(0).Rows(Rowno)(1).ToString()
TextBox3.Text = ds.Tables(0).Rows(Rowno)(2).ToString()
Else
MessageBox.Show(
"Last Record") // messagebox write only in vb.net and in asp.net i write Response.write("Last Record")
End If
This code write in Windows forms its working. and i create same design in ASP.net webpage and write above code under next button, it increment only one time. because when i click button it take Rowno is 0. i click button number of times it take Rno is 0. so bydefault it increment one tme.
my doubt is this type of program is doing in web applications? if do please tell a process.
Thanks.

Answers (1)