i have 2 ddl on one aspx apage but in different panel.
i create a function. this function fetch data frm database nd fill the list.
but the problem is i want to fill both ddl with this function.
dont want to create same function for my 2nd list
the function is
private void CategoryListBind()
{
ItemCategoryBE objCat = new ItemCategoryBE();
objCat.ID = 0;
DataSet ds = new DataSet();
ds = ItemCategoryBL.SelectCategoryBL(objCat);
ddlCate.DataSource = ds;
ddlCate.DataTextField = "CName";
ddlCate.DataValueField = "ID";
ddlCate.DataBind();
}
if i want to fill 2nd ddl2 through this code but due to list name i cannot able to do
can any one please tell me the FACTORY which can fill any dropdownlist on the page. i hope you'll get my point
Thanks
Loading
Apex PotumsPosted Jan 7, 2011, 8:29 AM
Madhu KPosted Jan 7, 2011, 1:41 AM
Rashid KhanPosted Jan 7, 2011, 1:35 AM
but this is not the way to create a factory class.
i want to use this function in whole project. where i have 9 dropdownlist on different pages. if i go with madhu ur option i have to set 9 ddl name thts a bad idea.
i have to create a public function(FACTORY CLASS)
which can be accessible on any ddl
tht code is just an idea only
Amit waiting for ur reply
Thanks
Madhu KPosted Jan 7, 2011, 1:13 AM
private void CategoryListBind()
{
ItemCategoryBE objCat = new ItemCategoryBE();
objCat.ID = 0;
DataSet ds = new DataSet();
ds = ItemCategoryBL.SelectCategoryBL(objCat);
ddlCate.DataSource = ds;
ddlCate.DataTextField = "CName";
ddlCate.DataValueField = "ID";
ddlCate.DataBind();
ddlsecond.DataSource = ds;
ddlsecond.DataTextField = "CName";
ddlsecond.DataValueField = "ID";
ddlsecond.DataBind();
}
Apex PotumsPosted Jan 6, 2011, 2:10 PM
private void CategoryListBind(DropDownList ddl)
{
ItemCategoryBE objCat = new ItemCategoryBE();
objCat.ID = 0;
DataSet ds = new DataSet();
ds = ItemCategoryBL.SelectCategoryBL(objCat);
ddl.DataSource = ds;
ddl.DataTextField = "CName";
ddl.DataValueField = "ID";
ddl.DataBind();
}