private void bindData()
        {
            try
            {
                string machineNames = "", parameterNames = "";
                foreach (ListItem item in multiselectddlMachineID.Items)
                {
                    if (item.Selected)
                    {
                        if (machineNames == "")
                        {
                            machineNames = "['" + item.Text + "'";
                        }
                        else
                        {
                            machineNames += ",'" + item.Text + "'";
                        }
                    }
                }
                if (machineNames != "")
                {
                    machineNames += "]";
                }
                else
                {
                    machineNames = "['']";
                }
                List <string> headerName = new List <string>();
                headerName.Add("MachineID");
                headerName.Add("CycleStartTS");
                headerName.Add("CycleEndTS");
                headerName.Add("UpdatedTS");
                foreach (ListItem item in cbParameterList.Items)
                {
                    if (item.Selected)
                    {
                        if (parameterNames == "")
                        {
                            parameterNames = "['" + item.Text + "'";
                        }
                        else
                        {
                            parameterNames += ",'" + item.Text + "'";
                        }
                        //headerName.Add(item.Text.Replace("-",""));
                        headerName.Add(item.Text);
                    }
                }
                if (parameterNames != "")
                {
                    parameterNames += "]";
                }
                else
                {
                    parameterNames = "['']";
                }
                string FromDate = txtFromDateTime.Text;
                double ToDate   = ddlSelectHour.SelectedValue == null?0.5:Convert.ToDouble(ddlSelectHour.SelectedValue);
                //var filter = "{$and : [{ UpdatedTS: {$gte: ISODate('" + Util.GetDateTime(FromDate).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") + "')} },{ UpdatedTS: {$lte: ISODate('" + Util.GetDateTime(FromDate).AddHours(ToDate).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ssZ") + "')} }, {MachineID : {$in : " + machineNames + "}}]}";
                //var dataset = _MongoDatabase.GetCollection<BsonDocument>("PPT_AMGIOT_ColumnData_Test").Find(filter).ToList();

                List <BsonDocument> dataset = MongoDBAccess.getDataForListOfValues(FromDate, ToDate, machineNames, ddlCompany.SelectedValue == null ? "" : ddlCompany.SelectedValue.ToString(), ddlPlant.SelectedValue == null ? "" : ddlPlant.SelectedValue.ToString());

                for (int i = gvListOfValues.Columns.Count - 1; i >= 0; i--)
                {
                    gvListOfValues.Columns.RemoveAt(i);
                }
                for (int i = headerName.Count - 1; i >= 0; i--)
                {
                    BoundField boundField = new BoundField();
                    boundField.DataField  = headerName[i].ToString();
                    boundField.HeaderText = headerName[i].ToString();
                    gvListOfValues.Columns.Insert(0, boundField);
                }

                DataTable dt = new DataTable();
                for (int i = 0; i < headerName.Count; i++)
                {
                    dt.Columns.Add(headerName[i]);
                }

                foreach (BsonDocument document in dataset)
                {
                    DataRow dr = dt.NewRow();
                    foreach (BsonElement elm in document.Elements)
                    {
                        if (dt.Columns.Contains(elm.Name))
                        {
                            if (elm.Name == "CycleStartTS" || elm.Name == "CycleEndTS" || elm.Name == "UpdatedTS")
                            {
                                if (elm.Value == BsonNull.Value)
                                {
                                    dr[elm.Name] = "";
                                }
                                else
                                {
                                    dr[elm.Name] = elm.Value.AsLocalTime.ToString("dd-MM-yyyy HH:mm:ss");
                                }

                                // dr[elm.Name] = elm.Value.AsDateTime.ToString("dd-MM-yyyy HH:mm:ss");
                            }
                            else
                            {
                                System.Type type = elm.Value.GetType();
                                if (type.Name == "BsonDouble")
                                {
                                    dr[elm.Name] = Math.Round(elm.Value.AsDouble, 3);
                                }
                                else
                                {
                                    dr[elm.Name] = elm.Value;
                                }
                            }
                        }
                    }
                    dt.Rows.Add(dr);
                }
                DataView dv = dt.DefaultView;
                dv.Sort = "MachineID";
                DataTable sortedDT = dv.ToTable();
                gvListOfValues.DataSource = sortedDT;
                gvListOfValues.DataBind();
                Session["ProcessParameterListOfValuesDetails"] = dt;
            }
            catch (Exception ex)
            {
            }
        }