protected void FillSelectParking(object sender, EventArgs e) { if (selectCampus.Items.Count > 0) { //Select parking ParkingData parkingData = new ParkingData(); DataTable dataTableParking = new DataTable(); if (hiddenCampusValue.Value.Equals(string.Empty)) { dataTableParking = parkingData.DataTableParking(Convert.ToInt32(selectCampus.Items[0].Value)); } else { dataTableParking = parkingData.DataTableParking(Convert.ToInt32(hiddenCampusValue.Value)); } selectParking.DataSource = dataTableParking; selectParking.DataValueField = "Id"; selectParking.DataTextField = "Name"; selectParking.DataBind(); } else { buttonStyle.buttonStyleRed(buttonErrors, "No campus and parking avaible to show."); } }
protected void FillSelectParkingToView(object sender, EventArgs e) { //Select parking ParkingData parkingData = new ParkingData(); DataTable dataTableParking = new DataTable(); if (hiddenCampusToViewValue.Value.Equals(string.Empty)) { dataTableParking = parkingData.DataTableParking(Convert.ToInt32(selectCampusToView.Items[0].Value)); } else { dataTableParking = parkingData.DataTableParking(Convert.ToInt32(hiddenCampusToViewValue.Value)); } selectParkingToView.DataSource = dataTableParking; selectParkingToView.DataValueField = "Id"; selectParkingToView.DataTextField = "Name"; selectParkingToView.DataBind(); }
protected void FillTable(object sender, EventArgs e) { ParkingData parkingData = new ParkingData(); //Populating a DataTable from database. DataTable dt = new DataTable(); if (hiddenCampusToViewValue.Value.Equals(string.Empty)) dt = parkingData.DataTableParking(Convert.ToInt32(selectCampusToView.Items[0].Value)); else dt = parkingData.DataTableParking(Convert.ToInt32(hiddenCampusToViewValue.Value)); //Building an HTML string. StringBuilder html = new StringBuilder(); //Cleaning last table placeHolderTableParking.Controls.Clear(); //Building the Header row. html.Append("<tbody>"); html.Append("<tr>"); //Building the Header row. html.Append("<tbody>"); html.Append("<tr>"); html.Append("<th>"); html.Append("Id"); html.Append("</th>"); html.Append("<th>"); html.Append("Name"); html.Append("</th>"); html.Append("<th>"); html.Append("Campus Id"); html.Append("</th>"); html.Append("<th>"); html.Append("Campus Name"); html.Append("</th>"); html.Append("<th>"); html.Append("Height"); html.Append("</th>"); html.Append("<th>"); html.Append("Width"); html.Append("</th>"); html.Append("<th>"); html.Append("Total Space"); html.Append("</th>"); html.Append("<th>"); html.Append("Free Space"); html.Append("</th>"); html.Append("<th>"); html.Append("Car Space"); html.Append("</th>"); html.Append("<th>"); html.Append("Motorcycle Space"); html.Append("</th>"); html.Append("<th>"); html.Append("Handicap Space"); html.Append("</th>"); html.Append("<th>"); html.Append("Bus Space"); html.Append("</th>"); html.Append("</tr>"); //Building the Data rows. foreach (DataRow row in dt.Rows) { html.Append("<tr class='desmarcado'>"); foreach (DataColumn column in dt.Columns) { html.Append("<td style='cursor:pointer' onclick='getValue(this.parentNode)'>"); html.Append(row[column.ColumnName]); html.Append("</td>"); } html.Append("<td>"); html.Append("<button onclick='setValues(this.parentNode.parentNode)' type='button'>Edit</button>"); html.Append("</td>"); html.Append("<td>"); html.Append("<button onclick='deleteParking()' type='button'>Delete</button>"); html.Append("</td>"); html.Append("</tr>"); } html.Append("</tbody>"); //Append the HTML string to Placeholder. placeHolderTableParking.Controls.Add(new Literal { Text = html.ToString() }); }
protected void FillSelectParking(object sender, EventArgs e) { if (selectCampus.Items.Count > 0) { //Select parking ParkingData parkingData = new ParkingData(); DataTable dataTableParking = new DataTable(); if (hiddenCampusValue.Value.Equals(string.Empty)) dataTableParking = parkingData.DataTableParking(Convert.ToInt32(selectCampus.Items[0].Value)); else dataTableParking = parkingData.DataTableParking(Convert.ToInt32(hiddenCampusValue.Value)); selectParking.DataSource = dataTableParking; selectParking.DataValueField = "Id"; selectParking.DataTextField = "Name"; selectParking.DataBind(); } else { buttonStyle.buttonStyleRed(buttonErrors, "No campus and parking avaible to show."); } }