Click here to Skip to main content
15,914,481 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRestricting user to modify the query string Pin
meeram39516-May-07 2:48
meeram39516-May-07 2:48 
AnswerRe: Restricting user to modify the query string Pin
kubben16-May-07 3:27
kubben16-May-07 3:27 
GeneralRe: Restricting user to modify the query string Pin
meeram39516-May-07 3:54
meeram39516-May-07 3:54 
AnswerRe: Restricting user to modify the query string Pin
Tarakeshwar Reddy16-May-07 3:31
professionalTarakeshwar Reddy16-May-07 3:31 
GeneralRe: Restricting user to modify the query string Pin
meeram39516-May-07 3:55
meeram39516-May-07 3:55 
AnswerRe: Restricting user to modify the query string Pin
N a v a n e e t h16-May-07 5:09
N a v a n e e t h16-May-07 5:09 
QuestionDataGrid ButtonColumn Events Pin
TheEagle16-May-07 2:40
TheEagle16-May-07 2:40 
Questiondoubt about asp.net Pin
saravanan0516-May-07 2:14
saravanan0516-May-07 2:14 
AnswerRe: doubt about asp.net Pin
N a v a n e e t h16-May-07 2:25
N a v a n e e t h16-May-07 2:25 
AnswerRe: doubt about asp.net Pin
Jaiprakash M Bankolli16-May-07 2:50
Jaiprakash M Bankolli16-May-07 2:50 
QuestionASP.NET and Firebird Pin
gerhard.etsebeth16-May-07 2:07
gerhard.etsebeth16-May-07 2:07 
QuestionServer did not register with DCOM within the required timeout Pin
fulbright16-May-07 1:46
fulbright16-May-07 1:46 
QuestionAjax Masked Edit Pin
Atif Ali Bhatti16-May-07 1:15
Atif Ali Bhatti16-May-07 1:15 
QuestionHelp for MSMQ Pin
Glenn D'souza16-May-07 1:06
Glenn D'souza16-May-07 1:06 
AnswerRe: Help for MSMQ Pin
kubben16-May-07 3:29
kubben16-May-07 3:29 
GeneralRe: Help for MSMQ Pin
Glenn D'souza16-May-07 19:26
Glenn D'souza16-May-07 19:26 
GeneralRe: Help for MSMQ Pin
kubben17-May-07 4:54
kubben17-May-07 4:54 
GeneralRe: Help for MSMQ Pin
Glenn D'souza17-May-07 18:21
Glenn D'souza17-May-07 18:21 
GeneralRe: Help for MSMQ Pin
kubben18-May-07 1:55
kubben18-May-07 1:55 
Questionquest Pin
jinovv16-May-07 1:04
jinovv16-May-07 1:04 
AnswerRe: quest Pin
N a v a n e e t h16-May-07 2:28
N a v a n e e t h16-May-07 2:28 
AnswerRe: quest Pin
tonymathewt16-May-07 18:41
professionaltonymathewt16-May-07 18:41 
Suppose you have the required records in a datatable dt, you only need to iterate the row index keeping the column index constant.
The rows index value needs to be stored into a hidden field after each iteration. Below is the C# code for the default.aspx for displaying the records.
<br />
using System;<br />
using System.Data;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
<br />
public partial class _Default : System.Web.UI.Page <br />
{<br />
    Cls_DBtier Cls_DBtierobj = new Cls_DBtier();<br />
    int i = 0;<br />
    DataTable dt;<br />
    protected void Page_Load(object sender, EventArgs e)<br />
    {<br />
        <br />
        Cls_DBtierobj.mvar_DBConnectionstring = Application["Connection_String"].ToString();<br />
        Cls_DBtierobj.OpenConnection();<br />
        dt = Cls_DBtierobj.getNames();<br />
        i = dt.Rows.Count;<br />
        Cls_DBtierobj.CloseConnection();<br />
        LblNames.Text = dt.Rows[0][0].ToString();<br />
        <br />
    }<br />
    protected void BtnNxt_Click(object sender, EventArgs e)<br />
    {<br />
        int index = Convert.ToInt32(HidIndex.Value);<br />
        if (index < i-1)<br />
        {<br />
            index = index + 1;<br />
            HidIndex.Value = index.ToString();<br />
            LblNames.Text = dt.Rows[index][0].ToString();<br />
        }<br />
    }<br />
}<br />


HidIndex is the hidden field, LblNames is the label for displaying the records. And BtnNxt is the button display the next record.

Cls_DBtier is class file. Below is the code for it.
<br />
using System;<br />
using System.Data;<br />
using System.Data.SqlClient;<br />
using System.Web;<br />
using System.Web.UI;<br />
using System.Web.UI.WebControls;<br />
using System.Web.UI.WebControls.WebParts;<br />
<br />
public class Cls_DBtier<br />
{<br />
    public string mvar_DBConnectionstring;<br />
    SqlConnection conn;<br />
    public void OpenConnection()<br />
    {<br />
        conn = new SqlConnection(mvar_DBConnectionstring);<br />
    }<br />
    public void CloseConnection()<br />
    {<br />
        conn.Close();<br />
    }<br />
    public SqlCommand ReturnSqlCommand(string sqlStmt)<br />
    {<br />
        SqlCommand Cmd;<br />
        try<br />
        {<br />
            Cmd = new SqlCommand();<br />
            Cmd.Connection = conn;<br />
            Cmd.CommandType = CommandType.Text;<br />
            Cmd.CommandText = sqlStmt;<br />
            return Cmd;<br />
        }<br />
        finally<br />
        {<br />
            Cmd = null;<br />
        }<br />
    }<br />
    public DataTable getNames()<br />
    {<br />
        string stt = "SELECT ename FROM employee";<br />
        SqlDataAdapter SAdaptor;<br />
        SqlCommand Cmd;<br />
        DataSet ds=new DataSet();<br />
        DataTable dt;<br />
        try<br />
        {<br />
            Cmd=ReturnSqlCommand(stt);<br />
            SAdaptor = new SqlDataAdapter(Cmd);<br />
            SAdaptor.Fill(ds);<br />
            dt = ds.Tables[0];<br />
            return dt;<br />
        }<br />
        finally<br />
        {<br />
            stt = null;<br />
            SAdaptor = null;<br />
            Cmd = null;<br />
            ds = null;<br />
            dt = null;<br />
        }<br />
    }<br />
}<br />

Questionasp.net through c# dropdown list data attachment question Pin
Smrutiranjandebata16-May-07 0:57
Smrutiranjandebata16-May-07 0:57 
AnswerRe: asp.net through c# dropdown list data attachment question Pin
gauthee16-May-07 1:10
gauthee16-May-07 1:10 
AnswerRe: asp.net through c# dropdown list data attachment question Pin
Sylvester george16-May-07 1:52
Sylvester george16-May-07 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.