Method is to populate the Dropdown

Method is to populate the drop down without layered architecture

private void populate_student()

{

try

{

cn.Open();

strQuery = "select id from student_details2";

 cmd = new SqlCommand(strQuery, cn);

 DataSet ds = new DataSet();

 adap = new SqlDataAdapter(cmd);

adap.Fill(ds); ddl_id.DataTextField = "id";

ddl_id.DataSource = ds; ddl_id.DataBind();

}

catch (Exception ex)

{

 lbl_status.Text = ex.Message;

}

 finally

{

cn.Close();

}

}

Method used to populate the dropdown in layered architecture

 public void PopulateAddressType()

{

try

{

List<AddressType> _addresslist=newList<AddressType>();// AddressType is Entity class

_addresslist = _genealSetupProcess.GetAddressType(); // _genealSetupProcess is the object of UI process Class

if (_addresslist != null && _addresslist.Count > 0)

{

 radlstAddressType.DataTextField = "Type";

radlstAddressType.DataValueField = "ID";

 radlstAddressType.DataSource = _addresslist;

radlstAddressType.DataBind();

}

}

catch (Exception ex)

{

throw ex;

 }

finally

{ }

}

Method is to populate the drop down without layered architecture

private void populate_student()

{

try

{

cn.Open();

strQuery = "select id from student_details2";

 cmd = new SqlCommand(strQuery, cn);

 DataSet ds = new DataSet();

 adap = new SqlDataAdapter(cmd);

adap.Fill(ds); ddl_id.DataTextField = "id";

ddl_id.DataSource = ds; ddl_id.DataBind();

}

catch (Exception ex)

{

 lbl_status.Text = ex.Message;

}

 finally

{

cn.Close();

}

}

Method used to populate the dropdown in layered architecture

 public void PopulateAddressType()

{

try

{

List<AddressType> _addresslist=newList<AddressType>();// AddressType is Entity class

_addresslist = _genealSetupProcess.GetAddressType(); // _genealSetupProcess is the object of UI process Class

if (_addresslist != null && _addresslist.Count > 0)

{

 radlstAddressType.DataTextField = "Type"; //Type and ID are the Entity Name

radlstAddressType.DataValueField = "ID";

 radlstAddressType.DataSource = _addresslist;

radlstAddressType.DataBind();

}

}

catch (Exception ex)

{

throw ex;

 }

finally

{ }

}

Ebook Download
View all
Learn
View all