private void BindMobileNetwork() { DropDownListMobileNetwork.ClearSelection(); DropDownListMobileNetwork.DataSource = MobileNetwork.GetMobileNetworkList(); DropDownListMobileNetwork.DataTextField = "Description"; DropDownListMobileNetwork.DataValueField = "MobileNetworkId"; DropDownListMobileNetwork.DataBind(); DropDownListMobileNetwork.Items.Insert(0, new ListItem("Please select", "0")); }
private void BindDevice() { try { Device device = Device.GetDeviceByDeviceId(this.deviceId); DropDownListDeviceType.ClearSelection(); DropDownListDeviceType.Items.FindByValue(device.DeviceTypeId.ToString()).Selected = true; TextBoxDescription.Text = device.Description; TextBoxComment.Text = device.Comment; if (Convert.ToInt32(device.DeviceTypeId) == 3 /*Laptop*/) { PanelMobile.Visible = false; PanelLaptop.Visible = true; TextBoxSerial.Text = device.Serial; } if (Convert.ToInt32(device.DeviceTypeId) == 1 || Convert.ToInt32(device.DeviceTypeId) == 2) { PanelMobile.Visible = true; PanelLaptop.Visible = false; DropDownListMobileNetwork.ClearSelection(); DropDownListMobileNetwork.Items.FindByValue(device.MobileNetworkId.ToString()).Selected = true; TextBoxMobile.Text = device.Mobile; TextBoxSIM.Text = device.SIM; TextBoxIMEI.Text = device.IMEI; TextBoxPUCK.Text = device.PUCK; } } catch (System.Data.SqlClient.SqlException sqlEx) { for (int i = 0; i < sqlEx.Errors.Count; i++) { LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); } PanelError.Visible = true; } catch (Exception exception) { LabelError.Text += (exception.Message + "<br />"); PanelError.Visible = true; } }