hi everybody ,
this is my first post ever on code project so please help me out ,
I am having a parent page create Items in which a user control ucCreateItems is opened which contains a dropdown list of categories ,
on a button click of this user control a new pop up opens called PopUpCreate categories opens
which is an aspx page in which a user control ucCreateCategories is opened where we can create new categories .When a category is created through a pop up,i want that the dropdown list of the first page create item is populated and newly created category is selected automatically, so a little help about how to get the control (dropdown list ) of first usercontrol be get in the pop up user control so that i cam bind it dynamically .
here is the code----->>>>>
protected void Page_Load(object sender, EventArgs e)
{
try
{
objItem.CompanyId = objcategory.CompanyId = Convert.ToInt64(Session["LoginCompanyId"]);
if (!Page.IsPostBack)
{
BindItemUnit();
DataTable CategoriesDropDownFill = objcategory.GetCategories();
DropDownListCategory.DataSource = CategoriesDropDownFill;
DropDownListCategory.DataTextField = "CategoryName";
DropDownListCategory.DataValueField = "CategoryId";
DropDownListCategory.DataBind();
DropDownListCategory.Items.Insert(0, new ListItem("-Select-", 0.ToString()));
if (Request.QueryString["ItemId"] != null)
{
H1Text.InnerHtml = "Edit item";
GetItemDetail();
}
else
{
H1Text.InnerHtml = "New item";
}
LabelCurrency.Text = LabelCurrency2.Text = Session["currencyName"].ToString();
}
}
catch (Exception ex)
{
objErrorLog.InsErrorLog(ex.Message.ToString(), "~/Master/Items/CreateItem.aspx", "Page_Load()",
Convert.ToInt32(Session["LoginUserId"]));
}
}
public void BindItemUnit()
{
ItemUnit objitemunit = new ItemUnit();
objitemunit.CompanyId = Convert.ToInt64(Session["LoginCompanyId"]);
var listUnit = objitemunit.FillUnits().ToList();
DropDownListUnit.DataSource = listUnit;
DropDownListUnit.DataTextField = "Unit";
DropDownListUnit.DataValueField = "UnitId";
DropDownListUnit.DataBind();
DropDownListUnit.Items.Insert(0, new ListItem("-Select-", 0.ToString()));
}
Here i want to get the control of the create item user control
protected void ButtonSave_Click(object sender, EventArgs e)
{
try
{
if (Request.QueryString["Id"] != null)
{
objCategory.CategoryId = Convert.ToInt32(Request.QueryString["Id"].ToString());
}
objCategory.ParentId = Convert.ToInt64(DropDownListParentCategory.SelectedValue);
objCategory.CategoryName = TextBoxCategoryName.Text;
objCategory.Description = TextBoxDescription.Text;
objCategory.CreatedBy = Convert.ToInt32(Session["LoginUserId"]);
objCategory.LastModifiedBy = Convert.ToInt32(Session["LoginUserId"]);
objCategory.CompanyId = Convert.ToInt64(Session["LoginCompanyId"]);
if (objCategory.IsExist() > 0)
{
LabelMsg.Text = "Category with same name already Exist.";
}
else
if (objCategory.AddUpdateNewCategory() > 0)
{
if (Request.QueryString["Type"]!=null)
{
HiddenFieldLastInsertedDropDownValue.Value = objCategory.AddUpdateNewCategory().ToString();
string script = "BinducCreateItemDropDown();";
ScriptManager.RegisterStartupScript(this, this.GetType(), "BinducCreateItemDropDown", script, true);
}
else
{
string script = "Redirect();";
ScriptManager.RegisterStartupScript(this, this.GetType(), "Redirect", script, true);
}
}
}
if (Request.QueryString["Type"]!=null)
{
HiddenFieldLastInsertedDropDownValue.Value = objCategory.AddUpdateNewCategory().ToString();
string script = "BinducCreateItemDropDown();";
ScriptManager.RegisterStartupScript(this, this.GetType(), "BinducCreateItemDropDown", script, true);
}
its here i want to get the control dropdown list categories