Exemplo n.º 1
0
    protected void btnEdit_Click(object sender, EventArgs e)
    {
        if (Page.IsValid)
        {
            try
            {
                ddcb_City.DataBind();
                foreach (ListItem item in ddcb_City.Items)
                {
                    item.Selected = false;
                }

                hdn_CityAdminId.Value = ((Button)sender).CommandArgument.ToString();
                ddcb_City.DataBind();

                DataTable dtCityAdmin = objAppAdmin.GetCityAdminInfo(Convert.ToInt32(hdn_CityAdminId.Value));
                if (dtCityAdmin.Rows.Count > 0)
                {
                    DataTable dtCities = new DataTable();
                    dtCities = objAppAdmin.GetCityAdminMapping(Convert.ToInt32(hdn_CityAdminId.Value));

                    foreach (ListItem item in ddcb_City.Items)
                    {
                        var x = from row in dtCities.Select()
                                where row["CityId"].ToString() == item.Value.ToString()
                                select row;

                        if (x.Count() > 0)
                        {
                            if (((DataRow)x.First())["CityId"].ToString() == item.Value.ToString())
                            {
                                item.Selected = true;
                            }
                        }
                    }

                    //ddl_City.SelectedValue = dtCityAdmin.Rows[0]["CityId"].ToString();
                    txtAddress.Text    = dtCityAdmin.Rows[0]["Address"].ToString();
                    txtEmail.Text      = dtCityAdmin.Rows[0]["Email"].ToString();
                    txt_FirstName.Text = dtCityAdmin.Rows[0]["FirstName"].ToString();
                    txt_LastName.Text  = dtCityAdmin.Rows[0]["LastName"].ToString();
                    //txtConfirmPassword.Text = _dt.Rows[0]["Password"].ToString();
                    //txtPassword.Text = _dt.Rows[0]["Password"].ToString();
                    tr_password.Visible    = false;
                    tr_Conpassword.Visible = false;

                    pnl_AddAdmin.Visible       = true;
                    pnl_AdminList.Visible      = false;
                    btn_Save.Text              = "Aktualisiert";
                    rfvConfirmPassword.Enabled = false;
                    rfvPassword.Enabled        = false;
                }
            }
            catch (Exception ex)
            {
                //Helper.errorLog(ex, Server.MapPath(@"~/ImpTemp/Log.txt"));
            }
        }
    }