protected void BindAvailableDocuments() { BPDocuments bpu = new BPDocuments(); DSDocuments = new BEDocuments(); if (FilterID != -1) DSDocuments.Merge(bpu.SelectActiveByDocumentCategoryID(FilterID)); else DSDocuments.Merge(bpu.SelectActiveWithDocumentCategories()); int DocumentCategoryID = -1; Boolean blnNew = true; StringBuilder returnDocuments = new StringBuilder(10000); returnDocuments.Append("none,No Document|"); foreach(DataRow dr in DSDocuments.tbl_Documents.Rows) { if ((int) dr["DocumentCategoryID"] != DocumentCategoryID) { DocumentCategoryID = (int) dr["DocumentCategoryID"]; blnNew = true; } if (blnNew) { returnDocuments.Append(",-- " + dr["DocumentCategoryName"] + " --|"); blnNew = false; } returnDocuments.Append(dr["DocumentID"] + "," + HttpUtility.HtmlDecode(" ") + dr["DocumentAlias"] + "|"); } string returnDocumentsString = returnDocuments.Replace("'", @"\'").ToString(); lblScript.Text = "<script Language=\"Javascript\">window.parent.handleResponse('" + returnDocuments + "', 'Document')</script>"; }
protected void BindDocuments() { BPDocuments bpu = new BPDocuments(); DSDocuments = new BEDocuments(); if (ddlDocumentCategories.SelectedValue != "-1") DSDocuments.Merge(bpu.SelectActiveByDocumentCategoryID(Convert.ToInt32(ddlDocumentCategories.SelectedValue))); else DSDocuments.Merge(bpu.SelectActiveWithDocumentCategories()); int DocumentCategoryID = -1; Boolean blnNew = true; ddlDocuments.Items.Clear(); ddlDocuments.Items.Add(new ListItem("No Document", "0")); foreach (DataRow dr in DSDocuments.tbl_Documents.Rows) { if ((int)dr["DocumentCategoryID"] != DocumentCategoryID) { DocumentCategoryID = (int)dr["DocumentCategoryID"]; blnNew = true; } if (blnNew) { ddlDocuments.Items.Add(new ListItem("-- " + dr["DocumentCategoryName"] + " --", "")); blnNew = false; } ddlDocuments.Items.Add(new ListItem(HttpUtility.HtmlDecode(" ") + dr["DocumentAlias"], dr["DocumentID"].ToString())); } if (SelectedDocument != 0) ddlDocuments.SelectedValue = SelectedDocument.ToString(); }