Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to exec dataaccess

Status
Not open for further replies.

WordTechinc

Programmer
Sep 4, 2009
38
I am new c# and Web App and try to understand it. I would like to know how the following line work and also attached full public void too. I cannot figure out how where GetProgramM get executed. I use Visual Studio 2008 & c#.

DataTable _datatable = _dataaccess.GetProgramM(_iPMID);



public void LoadProgramDropDown(int _iPMID)
{
_dataaccess = new DataAccess();
DataTable _datatable = _dataaccess.GetProgramM(_iPMID);
Programddl.DataSource = _datatable;

Programddl.DataValueField = "PMID";
Programddl.DataTextField = "ProgramNameType";
Programddl.DataBind();

Programddl.Items.Insert(0, "<< Select A Program >>");
Programddl.Items[0].Value = "0";
}
 
GetProgramM is a method of the _dataaccess object which, (I assume) returns a DataTable. It is called within the LoadProgramDropDown method, (again I assume), is called from elsewhere, probably the Page_Load event handler.

As the _dataaccess object and its _GetProgramM method are not defined in your example and appear to be a custom class, (not a standard .Net framework class), and a method on it I can't really help you much further.

Rhys

"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
Terry Pratchett
 
I am attacing full code. Please help me. I want to know where is called.....


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using DatabaseObject;

public partial class Dashboard_CampRegDashboard : System.Web.UI.Page
{
DataAccess _dataaccess;
DataTable _datatable;
FormClass _formclass;

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
LoadQuickView();
ParticipantSearchddl.Items.Insert(0, new ListItem("----Select To Search----", "0"));
ParticipantSearchddl.Items.Insert(1, new ListItem("FirstName", "1"));
ParticipantSearchddl.Items.Insert(2, new ListItem("RegistrationDate", "2"));
ParticipantSearchddl.Items.Insert(3, new ListItem("LastName", "3"));

LoadProgramDropDown(0);
}

if (Convert.ToInt32(Session["RegistrationCount"].ToString()) >0)
{
lblRegInfo.Text = "Total Online Registration : " + Session["RegistrationCount"].ToString();
}
}

public void LoadQuickView()
{
try
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
_datatable = _dataaccess.GetAllPartPayDetails(0);
Session["RegistrationCount"] = _datatable.Rows.Count;
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();

}
catch (Exception ex)
{
throw ex;
}
}


protected void PartRegistrationGridview_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
PartRegistrationGridview.PageIndex = e.NewPageIndex;
LoadQuickView();

}

public void LoadProgramDropDown(int _iPMID)
{
_dataaccess = new DataAccess();
DataTable _datatable = _dataaccess.GetProgramM(_iPMID);
Programddl.DataSource = _datatable;

Programddl.DataValueField = "PMID";
Programddl.DataTextField = "ProgramNameType";
Programddl.DataBind();

Programddl.Items.Insert(0, "<< Select A Program >>");
Programddl.Items[0].Value = "0";
}

protected void SearchImgButton_Click(object sender, ImageClickEventArgs e)
{
if (ParticipantSearchddl.SelectedIndex == 1)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails(SearchTextBox.Text,"","",Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}
else if (ParticipantSearchddl.SelectedIndex == 2)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails("", "", SearchTextBox.Text, Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}

else if (ParticipantSearchddl.SelectedIndex == 3)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails("", SearchTextBox.Text, "", Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}
}
protected void Programddl_SelectedIndexChanged(object sender, EventArgs e)
{
if (ParticipantSearchddl.SelectedIndex == 1)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails(SearchTextBox.Text, "", "", Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}
else if (ParticipantSearchddl.SelectedIndex == 2)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails("", "", SearchTextBox.Text, Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}

else if (ParticipantSearchddl.SelectedIndex == 3)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
if (SearchTextBox.Text != "")
{
_datatable = _dataaccess.SearchRegistrationdetails("", SearchTextBox.Text, "", Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
else
{
LoadQuickView();
}
}
else if (ParticipantSearchddl.SelectedIndex == 0)
{
_dataaccess = new DataAccess();
_datatable = new DataTable();
_datatable = _dataaccess.SearchRegistrationdetails("", "" , "", Convert.ToInt32(Programddl.SelectedValue));
PartRegistrationGridview.DataSource = _datatable;
PartRegistrationGridview.DataBind();
}
}
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top