
How to do I navigate to another list in a DataList. I only want one record perpage. I have been searching
for an answer and I have come up with nothing. If anyone has any ideas please share them with me. I would
so apprecitate it.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using Microsoft.Data.Odbc;
using System.Text;
namespace MSPOS
{
/// <summary>
/// Summary description for Objects.
/// </summary>
public class Objects : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataList myDataGrid;
protected System.Web.UI.HtmlControls.HtmlForm Form1;
private DataSet ddlDataSet1 = new DataSet();
private DataSet ddlDataSet = new DataSet();
protected Int32 _currentPageNumber = 1;
protected int PageSize = 1;
public void Page_Load ( Object sender, EventArgs e )
{
if ( !Page.IsPostBack )
{
BindData();
}
}
public void BindData()
{
OdbcConnection myConnection = new
OdbcConnection("DSN=POS;UID=system;PWD=system");
myConnection.Open();
// get records from the table
string commandString = @"SELECT CM_REF, CM_DESCRIPTION,
CM_OBJECTNAME, CM_TIMEOUT, CM_TYPE, CM_CONTENT, CM_PREPARED, CM_CONNECTION FROM
TBCOMMANDS";
// Set the datagrid's datasource to the datareader and databind
// Create a OdbcCommand object and assign the connection connect to
the database
// Create a OdbcCommand object and assign the connection connect to
the database
OdbcCommand command = myConnection.CreateCommand( );
command.CommandText = commandString;
command.Connection = myConnection;
// Create the Reader and bind it to the datagrid
OdbcDataReader reader =
command.ExecuteReader(CommandBehavior.CloseConnect ion);
ddlDataSet.DataSource=reader;
ddlDataSet.DataBind();
reader.Close();
reader=null;
myConnection.Dispose();
}
private void InitializeComponent()
{
this.myDataGrid.SelectedIndexChanged += new
System.EventHandler(this.myDataGrid_SelectedIndexC hanged);
}
private void MyDataGrid_SelectedIndexChanged(object sender,
System.EventArgs e)
{
}
private void myDataGrid_SelectedIndexChanged(object sender,
System.EventArgs e)
{
}
}
}
Thank You for Your Time,
Matt
Knowledge is to be shared.