Skip to main content

Conditionally Modifying the List Object DataSource

using eBAPI.Connection;

using System.Data.Common;

using eBAIntegrationAPI;

--namespaces should be added

%SystemPath%\Common\eBAPI.dll

%SystemPath%\Common\eBAIntegrationAPI.dll

--These references should be added to the project

--If Choice1 is checked, List1 is populated with a query in the intagration manager, and if it is not checked, it is populated with another query

public void Secim1_OnCheckedChanged(Object sender, EventArgs e)

{

DataTable dt = new DataTable();

eBAConnection con = CreateServerConnection();

Con. Open();

if(Select1.Checked)

{

eBAIntegrationQuery qry= new eBAIntegrationQuery("connectionName", "queryName");

qry. Parameters.Add("parameterName", "value"); If there is a parameter

DT = qry. Execute(con);

}

else

{

eBAIntegrationQuery qry= new eBAIntegrationQuery("connectionName", "queryName2");

qry. Parameters.Add("parameterName", "value"); If there is a parameter

DT = qry. Execute(con);

}

Con. Close();

List1.DataSource = dt;

List1.DataTextField = "Field1";

List1.DataValueField = "field2";

List1.DataBind();

}