Want to read all data from the database without using the grid view control

Posted by .Netlearner under ASP.NET on 8/11/2012 | Points: 10 | Views : 1588 | Status : [Member] | Replies : 2
Hello All,
I want to read all my data stored in the database in my web page but without using gridview.I just want to display the first record in my controls as

First Name : .Netlearner

Qualification :Msc

i must be able to view the next set of records while clicking an button,similar way i have travel backwards too.(ie) if i press the back button i want to view the previous records in my web page. How can this be implemented


Posted by: Vikash on: 8/11/2012 [Member] Starter | Points: 25

Plz use DetailsView Control & implement following

your .aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:DetailsView ID="DetailsView1" OnPageIndexChanging="PageIndexChanging" AllowPaging="true" runat="server" Height="50px" Width="125px">
<asp:Button ID="Button1" runat="server" Text="GenerateXML"
onclick="Button1_Click1" />

Your code bbehind file
protected void Page_Load(object sender, EventArgs e)

private void filldetailsview()
SqlDataAdapter da = new SqlDataAdapter("select firstName,Qualification from tableName", con);
DataSet ds = new DataSet();
da.Fill(ds, "tablename");
DetailsView1.DataSource = ds;
protected void PageIndexChanging(object sender, DetailsViewPageEventArgs e)
DetailsView1.PageIndex = e.NewPageIndex;

i hope you got your answer..........

Vikash Pathak

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 8/11/2012 [Member] Starter | Points: 25

Thanks for ur guidence but i want to display the data in many controls some within tab control and some outside.It cannot be implemented through details view na.

.Netlearner, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response