Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string userName;

        //setting the userName variable based on query string or user name value in the session
        if (Request.QueryString["id"] != null)
        {
            userName = Request.QueryString["id"].ToString();
        }
        else
        {
            userName = User.Identity.Name;
        }
        TeacherUserName.Text = userName;
        DataView dvSql = (DataView)TeacherDataSource.Select(DataSourceSelectArguments.Empty);

        foreach (DataRowView drvSql in dvSql)
        {
            TeacherName.Text        = drvSql["FirstName"].ToString();
            TeacherLastName.Text    = drvSql["LastName"].ToString();
            TeacherEducation.Text   = drvSql["Education"].ToString();
            TeacherContact.Text     = drvSql["Contact"].ToString();
            TeacherEmail.Text       = drvSql["Email"].ToString();
            TeacherDesignation.Text = drvSql["Designation"].ToString();
            if (drvSql["Avatar"].ToString() != "")
            {
                UserPicture.ImageUrl = drvSql["Avatar"].ToString();
            }
        }
    }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         DataView studentDataView = (DataView)TeacherDataSource.Select(DataSourceSelectArguments.Empty);
         foreach (DataRowView dvr in studentDataView)
         {
             TxtFirstName.Text   = dvr["FirstName"].ToString();
             TxtLastName.Text    = dvr["LastName"].ToString();
             TxtContact.Text     = dvr["Contact"].ToString();
             TxtEmail.Text       = dvr["Email"].ToString();
             TxtEducation.Text   = dvr["Education"].ToString();
             TxtDesignation.Text = dvr["Designation"].ToString();
             if (dvr["Gender"].ToString() == "Female")
             {
                 DDGender.SelectedIndex = 1;
             }
             if (dvr["Avatar"].ToString() != "")
             {
                 DisplayPicture.ImageUrl = dvr["Avatar"].ToString();
             }
         }
     }
 }