protected void BindAvailableDocuments() { BPDocuments bpu = new BPDocuments(); DSDocuments = new BEDocuments(); if (FilterID != -1) { DSDocuments.Merge(bpu.SelectAllByDocumentCategoryID(FilterID)); } else { DSDocuments.Merge(bpu.SelectAllWithDocumentCategories()); } 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"].ToString() + "," + HttpUtility.HtmlDecode(" ") + dr["DocumentAlias"].ToString() + "|"); } lblScript.Text = "<script Language=\"Javascript\">window.parent.handleResponse('" + returnDocuments + "', 'Document')</script>"; }
private void BindDSDocuments() { BPDocuments bp = new BPDocuments(); if (ddlDocumentCategories.SelectedValue == "-1") { DSDocuments = bp.SelectAllWithDocumentCategories(); } else { DSDocuments = bp.SelectAllByDocumentCategoryID(Convert.ToInt32(ddlDocumentCategories.SelectedValue)); } DSDocuments.tbl_Documents.DefaultView.Sort = "DocumentAlias"; DSDocuments.tbl_Documents.DefaultView.RowFilter = RowFilter("DocumentAlias", "DocumentActive"); letters_Bind(); dgDocs.DataBind(); SetPagerButtons(); if (DSDocuments.tbl_Documents.DefaultView.Count == 0) { lblError.Visible = true; lblError.Text = "0 Records found."; } else { lblError.Visible = false; lblError.Text = ""; } }
protected void BindDocuments() { BPDocuments bpu = new BPDocuments(); DSDocuments = new BEDocuments(); if (ddlDocumentCategories.SelectedValue != "-1") { DSDocuments.Merge(bpu.SelectAllByDocumentCategoryID(Convert.ToInt32(ddlDocumentCategories.SelectedValue))); } else { DSDocuments.Merge(bpu.SelectAllWithDocumentCategories()); } 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"].ToString(), dr["DocumentID"].ToString())); } if (SelectedDocument != 0) { ddlDocuments.SelectedValue = SelectedDocument.ToString(); } }