protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (string.IsNullOrEmpty(Request.QueryString["id"]) || string.IsNullOrEmpty(Request.QueryString["type"]) || (QS("id", 0) == 0)) { ShowArgumentErrorMessageToClient(); return; } int id = int.Parse(Request.QueryString["id"]); string type = Request.QueryString["type"]; if (type == DirectoryObjectType.Directory.ToString()) { rbtnNewDirectory.Checked = true; rbtnNewFile.Checked = false; DirectoryEntity model = fileApp.GetDirectory(int.Parse(Request.Params["id"])); DirectoryEntity parent = fileApp.GetDirectory(model.ParentID); List <DirectoryEntity> list = fileApp.GetDirectories(parent.ParentID); list.BindDropdown <DirectoryEntity>(ddlCurrent, "Title", "ID", "Please Select", "0"); ddlCurrent.SelectedValue = model.ParentID.ToString(); txtTitle.Text = model.Title; txtDesc.Text = model.Description; } else if (type == DirectoryObjectType.File.ToString()) { int direid = 0; if (!string.IsNullOrEmpty(Request.Params["direid"]) && int.TryParse(Request.Params["direid"], out direid)) { DirectoryObjectsEntity objects = fileApp.GetObjects(direid); if (!ISReadOnlyRole || UserInfo.ID == objects.CreatedBy) { DirectoryEntity parent = fileApp.GetDirectory(objects.DirectoryID); ddlCurrent.Items.Add(new ListItem(parent.Title, parent.ID.ToString(), true)); FilesEntity file = fileApp.Get(objects.ObjectID); txtDesc.Text = file.ThumbPath; } else { ShowArgumentErrorMessageToClient(); return; } } rbtnNewDirectory.Checked = false; rbtnNewFile.Checked = true; } } }
protected void Page_Load(object sender, EventArgs e) { fileApp = new FileApplication(); if (!IsPostBack) { if (QS("id", 0) == 0) { ShowArgumentErrorMessageToClient(); } else { DirectoryEntity model = fileApp.GetDirectory(int.Parse(Request.Params["id"])); List <DirectoryEntity> list = fileApp.GetDirectories(model.ParentID); list.BindDropdown <DirectoryEntity>(ddlCurrent, "Title", "ID", "Please Select", "0"); ddlCurrent.SelectedValue = model.ID.ToString(); } SetControlsStatus(); } }