protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { // if (e.CommandName == "ChangeStatus") { GridViewRow row = (GridViewRow)(((LinkButton)e.CommandSource).NamingContainer); Label Label1 = (Label)row.FindControl("Label1"); Label Label2AcountType = ( Label )row.FindControl("Label2AcountType"); Label txtFirstName = (Label)row.FindControl("LaStudentFirstName"); Label txtEmail = (Label)row.FindControl("txtEmail"); if ((Label2AcountType.Text == Resources.Resource1.Active)) { try { SDSSDegress2013.UpdateCommand = "UPDATE MyStudents SET IsActive =0 WHERE StudentID =" + Label1.Text + " "; SDSSDegress2013.Update(); } catch (Exception ex) { } } else { string password = Convert.ToString(Session["adminID"]) + StringGeneration.getString(30); Contacting sendwelcome = new Contacting(); string message = " عزيزي " + txtFirstName.Text; message = message + "\n نحن نرسل لك هذا البريد لنعلمك انه قد تم تفعيل حسابك على ماي كورسس في موقعنا يمكنك الدخول الان ومتابعة الدروس ومواعيدها "; message = message + "\nقم بالدخول على هذا الرابط"; message = message + "\n http://alruabye.net/AdminLogin.aspx "; message = message + "\n وقم بادخال كلمة المرور المؤقتة التالية"; message = message + password; message = message + " \n Hussein alrubaye , email [email protected]"; sendwelcome.SendWelcome(txtEmail.Text, "تم تغعيل حسابك في نظام الدورات", message); SDSSDegress2013.UpdateCommand = "UPDATE MyStudents SET IsActive =1, Password="******" WHERE (StudentID =" + Label1.Text + ")"; SDSSDegress2013.Update(); } } }
protected void BuSearch_Click(object sender, EventArgs e) { //SDSSDegress2013.SelectParameters["FullName"].DefaultValue = "%" + txtStudentName.Text + "%"; SDSSDegress2013.DataBind(); GridView1.DataBind(); }