public void fillGridFromViewState() { try { //if (ViewState[travelerDTVar] != null) //{ // TravelerDT = (DataTable)ViewState[travelerDTVar]; //} if (Session[travelerDTVar] != null) { TravelerDT = (DataTable)Session[travelerDTVar]; } TravelerHAGrid.DataSource = TravelerDT; TravelerHAGrid.DataBind(); } catch (Exception ex) { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The following error has occurred: " + ex.Message + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; errorDiv.Style.Value = "display: block"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } }
public void fillGrid() { try { TravelerDT = VSWebBL.ConfiguratorBL.TravelerBL.Ins.GetTravelerHADataStore(); if (TravelerDT.Rows.Count > 0) { TravelerDT.PrimaryKey = new DataColumn[] { TravelerDT.Columns["ID"] }; } //ViewState.Add(travelerDTVar, TravelerDT); Session[travelerDTVar] = TravelerDT; TravelerHAGrid.DataSource = TravelerDT; TravelerHAGrid.DataBind(); } catch (Exception ex) { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The following error has occurred: " + ex.Message + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; errorDiv.Style.Value = "display: block"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } }
protected void TravelerHAGrid_HtmlRowCreated(object sender, ASPxGridViewTableRowEventArgs e) { //1/24/2014 NS added "manual" adding of the rows to the combobox in order to avoid the error: //Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control try { if (e.RowType == GridViewRowType.EditForm) { ASPxComboBox txtTestScan = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("TestScanComboBox"); txtTestScan.TextField = "TestScanServer"; txtTestScan.ValueField = "TestScanServer"; txtTestScan.DataSource = VSWebBL.ConfiguratorBL.TravelerBL.Ins.GetTravelerTestWhenScan(); //txtTestScan.DataBind(); ASPxTextBox txtTravelerPoolName = (ASPxTextBox)TravelerHAGrid.FindEditFormTemplateControl("TravelerPoolNameTextBox"); ASPxTextBox txtServerName = (ASPxTextBox)TravelerHAGrid.FindEditFormTemplateControl("ServerNameTextBox"); ASPxComboBox txtDataStore = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("DataStoreComboBox"); ASPxTextBox txtPort = (ASPxTextBox)TravelerHAGrid.FindEditFormTemplateControl("PortTextBox"); ASPxTextBox txtUserName = (ASPxTextBox)TravelerHAGrid.FindEditFormTemplateControl("UserNameTextBox"); ASPxTextBox txtPwd = (ASPxTextBox)TravelerHAGrid.FindEditFormTemplateControl("PasswordTextBox"); ASPxComboBox txtIntegratedSecurity = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("IntegratedSecurityComboBox"); ASPxDropDownEdit txtUsedBySrv = (ASPxDropDownEdit)TravelerHAGrid.FindEditFormTemplateControl("UsedByServersComboBox"); ASPxLabel pwdlb = (ASPxLabel)TravelerHAGrid.FindEditFormTemplateControl("PasswordLabel"); txtPwd.Visible = true; pwdlb.Visible = true; if (!((ASPxGridView)(sender)).IsNewRowEditing) { txtPwd.Visible = false; pwdlb.Visible = false; //PasswordLabel.Visible = false; txtTravelerPoolName.Value = e.GetValue("TravelerServicePoolName"); txtServerName.Value = e.GetValue("ServerName"); for (int i = 0; i < txtDataStore.Items.Count; i++) { if (txtDataStore.Items[i].Value.ToString() == e.GetValue("DataStore").ToString()) { txtDataStore.SelectedIndex = i; break; } } txtPort.Value = e.GetValue("Port"); txtUserName.Value = e.GetValue("UserName"); txtPwd.Value = e.GetValue("Password"); int IntegratedSecurity = -1; if (e.GetValue("IntegratedSecurity").ToString() == "Yes") { IntegratedSecurity = 1; } else { IntegratedSecurity = 0; } for (int i = 0; i < txtIntegratedSecurity.Items.Count; i++) { if (txtIntegratedSecurity.Items[i].Value.ToString() == IntegratedSecurity.ToString()) { txtIntegratedSecurity.SelectedIndex = i; break; } } txtTestScan.Value = e.GetValue("TestScanServer"); txtUsedBySrv.Value = e.GetValue("UsedByServers"); } } } catch (Exception ex) { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The following error has occurred: " + ex.Message + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; errorDiv.Style.Value = "display: block"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } }
private TravelerDS CollectData(string mode, DataRow travelerrow) { TravelerDS TravelerObject = new TravelerDS(); ASPxComboBox txtDataStore = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("DataStoreComboBox"); ASPxComboBox txtIntegratedSecurity = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("IntegratedSecurityComboBox"); ASPxComboBox txtTestScan = (ASPxComboBox)TravelerHAGrid.FindEditFormTemplateControl("TestScanComboBox"); try { if (mode == "Update") { TravelerObject.ID = int.Parse(Convert.ToString(travelerrow["ID"])); } TravelerObject.TravelerPoolName = travelerrow["TravelerServicePoolName"].ToString(); TravelerObject.ServerName = travelerrow["ServerName"].ToString(); for (int i = 0; i < txtDataStore.Items.Count; i++) { if (txtDataStore.Items[i].Value.ToString() == travelerrow["DataStore"].ToString()) { txtDataStore.SelectedIndex = i; break; } } TravelerObject.DataStore = txtDataStore.SelectedItem.Value.ToString(); if (travelerrow["Port"].ToString() == "-1") { TravelerObject.Port = "NULL"; } else { TravelerObject.Port = travelerrow["Port"].ToString(); } TravelerObject.Password = travelerrow["Password"].ToString(); TravelerObject.UserName = travelerrow["UserName"].ToString(); for (int i = 0; i < txtIntegratedSecurity.Items.Count; i++) { if (txtIntegratedSecurity.Items[i].Text == travelerrow["IntegratedSecurity"].ToString()) { txtIntegratedSecurity.SelectedIndex = i; break; } } if (txtIntegratedSecurity.SelectedItem.Text == "SQL Server") { TravelerObject.IntegratedSecurity = "False"; } else { TravelerObject.IntegratedSecurity = "True"; } for (int i = 0; i < txtTestScan.Items.Count; i++) { if (txtTestScan.Items[i].Value.ToString() == travelerrow["TestScanServer"].ToString()) { txtTestScan.SelectedIndex = i; break; } } if (txtTestScan.SelectedItem != null) { TravelerObject.TestScan = txtTestScan.SelectedItem.Value.ToString(); } else { TravelerObject.TestScan = ""; } TravelerObject.UsedByServers = travelerrow["UsedByServers"].ToString(); //7/18/2014 NS added for VSPLUS-806 TravelerObject.DatabaseName = travelerrow["DatabaseName"].ToString(); } catch (Exception ex) { //10/6/2014 NS modified for VSPLUS-990 errorDiv.InnerHtml = "The following error has occurred: " + ex.Message + "<button type=\"button\" class=\"close\" data-dismiss=\"alert\"><span aria-hidden=\"true\">×</span><span class=\"sr-only\">Close</span></button>"; errorDiv.Style.Value = "display: block"; //6/27/2014 NS added for VSPLUS-634 Log.Entry.Ins.WriteHistoryEntry(DateTime.Now.ToString() + " Exception - " + ex); } return(TravelerObject); }