protected void Page_Load(object sender, EventArgs e) { string appID = Convert.ToString(Request.QueryString["appID"]); if (!string.IsNullOrEmpty(appID)) { isEdit = true; } else { isEdit = false; } if (!IsPostBack) { appList = ComponentDb.GetAll(); BindData(); if (isEdit) { Component application = ComponentLogic.GetByAppId(appID); AppNameTxt.Value = application.AppName; // AppIDTxt.Value = application.AppID; if (application.ChildrenComponents != null && application.ChildrenComponents.Count > 0) { foreach (var item in application.ChildrenComponents) { ListItem listItem = new ListItem(item.AppName, item.Id.ToString()); listItem.Selected = true; AppsDrpDown.Items.Add(listItem); } } SaveButton.Text = "Update"; ID = application.Id.ToString(); } } }