コード例 #1
0
        public void CreateUser_OnClick(object sender, EventArgs args)
        {
            try
            {
                // Create new user.

                modelDataContext db = new modelDataContext();

                ogrenci_liste dt = new ogrenci_liste();

                dt.Ad     = txtName.Text;
                dt.Soyadi = txtLastname.Text;
                dt.Email  = txtEmail.Text;

                db.ogrenci_listes.InsertOnSubmit(dt);

                db.SubmitChanges();

                Response.Redirect("~/onlyMembers/onlyMembers.aspx");
            }
            catch (MembershipCreateUserException e)
            {
                Msg.Text = GetErrorMessage(e.StatusCode);
            }
            catch (HttpException e)
            {
                Msg.Text = e.Message;
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.IsPostBack)
            {
                return;
            }

            modelDataContext db = new modelDataContext();

            var data = from d in db.ogrenci_listes
                       select new
            {
                d.ID,
                d.Ad,
                Soyad = d.Soyadi,
                d.Email
            };

            gvPerson.DataSource = data;
            gvPerson.DataBind();
        }