private void Bind() { clsTbClient Client = new clsTbClient(); DataTable dt = Client.SelectAll(); gvClientsList.DataSource = dt; gvClientsList.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { //HtmlGenericControl lic = (HtmlGenericControl)(Page.Master.FindControl("ClientManagement")); //lic.Attributes["Class"] = "open"; HtmlGenericControl li = (HtmlGenericControl)(Page.Master.FindControl("CCTeam")); li.Attributes["Class"] = "active"; clsTbClient Client = new clsTbClient(); DataTable dt = Client.SelectAll(); ddlClientName.DataSource = dt; ddlClientName.DataTextField = "Name"; ddlClientName.DataValueField = "ID"; ddlClientName.DataBind(); Bind(); if (string.IsNullOrEmpty(Request.QueryString["ID"])) { // Response.Redirect("~/Admin/CreateClient.aspx"); } else { int i = Convert.ToInt32(Request.QueryString["id"].ToString()); clsTbClient_Team ClientTeam = new clsTbClient_Team(); ClientTeam.iID = i; DataTable dt1 = ClientTeam.SelectOneWIDLogic(); if (dt1.Rows.Count > 0) { txtName.Text = dt1.Rows[0]["Name"].ToString(); ddlStatus.SelectedValue = dt1.Rows[0]["Status"].ToString(); ddlRole_Level.SelectedValue = dt1.Rows[0]["Role"].ToString(); txtEmail.Text = dt1.Rows[0]["Email"].ToString(); txtPrimaryPhone.Text = dt1.Rows[0]["Primary_Phone"].ToString(); txtSecondaryPhone.Text = dt1.Rows[0]["Secondary_Phone"].ToString(); txtLocation.Text = dt1.Rows[0]["Location"].ToString(); txtAddress_Line1.Text = dt1.Rows[0]["Address_Line1"].ToString(); txtAddress_Line2.Text = dt1.Rows[0]["Address_Line2"].ToString(); txtCity.Text = dt1.Rows[0]["City"].ToString(); txtState.Text = dt1.Rows[0]["State"].ToString(); txtZIP.Text = dt1.Rows[0]["Zip"].ToString(); txtCountry.Text = dt1.Rows[0]["Country"].ToString(); ddlClientName.SelectedValue = dt1.Rows[0]["Client_ID"].ToString(); txtUserName.Text = ""; txtPassword.Text = ""; txtUserName.Enabled = false; txtPassword.Enabled = false; } } }