This method correctly loads the data and binds it to the infragistics control as long as I remove the object source, EventArgs e and call the method from page_load.
Is that a good idea to remove the object source, eventArgs e?
protected void dgvAppts_NeedDataSource(object source, EventArgs e)
{
if (Session.IsNewSession == false)
{
DataTable ApptTable = new DataTable();
ApptTable = objGatewayFunctions.GetAppointmentReCap(Session["LoginID"].ToString(), RecapDate.ToShortDateString(), "R", ConfigurationManager.AppSettings["Connection"].ToString());
this.dgvAppts.DataSource = ApptTable;
//if (ApptTable.Rows.Count == 0)
//{
// this.uwtTabs.Tabs(0).Style.ForeColor = System.Drawing.Color.Gray;
//}
//else
//{
// this.uwtTabs.Tabs(0).Style.ForeColor = System.Drawing.Color.Black;
//}
}
}
If it's better to have the object source, EventArgs e present in the method. How do I call that function so it can load the WebDataGrid?
I don't think Infragistics WebDataGrid has NeedDataSource event; it sounds like the code was being converted from the use of a Telerik control.
If that's the case then there's no need to call the method
protected void dgvAppts_NeedDataSource(object source, EventArgs e)
You can call it instead something like
protected void BindMyGrid()
and call it from the page load indeed (with possible check to do it only if page is not in a postback mode)