private void BindMachineDocuments() { try { hdnFieldIDForPB.Value = ""; hdnColNameForPB.Value = ""; hdnFileNameForPB.Value = ""; string view = "nodate"; string fromDate = "", toDate = ""; if (txtFromDate.Text.Trim() == "" && txtFromDate.Text.Trim() == "") { view = "nodate"; } else { if (txtFromDate.Text.Trim() == "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "warning", "openWarningModal('Please select From Date.');", true); return; } if (txtToDate.Text.Trim() == "") { ScriptManager.RegisterStartupScript(this, this.GetType(), "warning", "openWarningModal('Please select To Date.');", true); return; } fromDate = txtFromDate.Text.Trim(); toDate = txtToDate.Text.Trim(); view = "date"; } BsonArray model = new BsonArray(); if (ddlModel.SelectedValue == "All") { foreach (ListItem item in ddlModel.Items) { model.Add(item.Value); } } else { model.Add(ddlModel.SelectedValue); } BsonArray machineSlno = new BsonArray(); if (ddlMachineNumber.SelectedValue == "All") { foreach (ListItem item in ddlMachineNumber.Items) { machineSlno.Add(item.Value); } } else { machineSlno.Add(ddlMachineNumber.SelectedValue); } BsonArray category = new BsonArray(); if (ddlCategory.SelectedValue == "All") { foreach (ListItem item in ddlCategory.Items) { category.Add(item.Value); } } else { category.Add(ddlCategory.SelectedValue); } BsonArray subcategory = new BsonArray(); if (ddlSubCategory.SelectedValue == "All") { foreach (ListItem item in ddlSubCategory.Items) { subcategory.Add(item.Value); } } else { subcategory.Add(ddlSubCategory.SelectedValue); } List <eDocumentData> list = MongoDBAccess.getMachineDocumentsDetails(model, machineSlno, category, subcategory, fromDate, toDate, view); lvMachineDocs.DataSource = list; lvMachineDocs.DataBind(); lvMachineDocsCardView.DataSource = list; lvMachineDocsCardView.DataBind(); } catch (Exception ex) { } }