protected void ButtonCancel3_Click(object sender, EventArgs e) { GridView1.SelectRow(-1); Panel2.Visible = false; GridView1.Enabled = true; }
protected void ButtonNo_Click(object sender, EventArgs e) { // Запрет в кружок SqlDataSource1.UpdateCommand = @"UPDATE UsersKruzhki SET " + " Статус = 'отклонено' " + " WHERE ((KruzhId LIKE '" + GridView1.SelectedDataKey[1] + "') AND (UserId LIKE '" + GridView1.SelectedDataKey[0] + "'))"; GridView1.SelectRow(-1); SqlConnection connection = new SqlConnection(SqlDataSource1.ConnectionString); connection.Open(); SqlDataSource1.Update(); connection.Close(); GridView1.SelectRow(-1); Panel1.Visible = false; GridView1.Enabled = true; //Обновление списка //Показывать обработанные заявки if (CheckBox1.Checked) { SqlDataSource1.SelectCommand = " SELECT UsersKruzhki.UserId, UsersKruzhki.KruzhId, aspnet_Users.UserName, " + " Users.Фамилия, Users.Имя, UsersKruzhki.Статус, UsersKruzhki.ДатаПодачи " + " FROM Kruzhki INNER JOIN UsersKruzhki ON Kruzhki.KruzhId = UsersKruzhki.KruzhId " + " INNER JOIN Users ON UsersKruzhki.UserId = Users.UserId " + " INNER JOIN aspnet_Users ON Users.UserId = aspnet_Users.UserId " + " WHERE ((UsersKruzhki.KruzhId LIKE '" + DropDownList1.SelectedValue + "') " + " AND (Kruzhki.ДатаОкончания > '" + DateTime.Now + "') )"; } else { SqlDataSource1.SelectCommand = " SELECT UsersKruzhki.UserId, UsersKruzhki.KruzhId, aspnet_Users.UserName, " + " Users.Фамилия, Users.Имя, UsersKruzhki.Статус, UsersKruzhki.ДатаПодачи " + " FROM Kruzhki INNER JOIN UsersKruzhki ON Kruzhki.KruzhId = UsersKruzhki.KruzhId " + " INNER JOIN Users ON UsersKruzhki.UserId = Users.UserId " + " INNER JOIN aspnet_Users ON Users.UserId = aspnet_Users.UserId " + " WHERE ((UsersKruzhki.KruzhId LIKE '" + DropDownList1.SelectedValue + "') " + " AND (Kruzhki.ДатаОкончания > '" + DateTime.Now + "')" + " AND (UsersKruzhki.Статус='рассмотрение') )"; } DataSourceSelectArguments argument = new DataSourceSelectArguments(); connection.Open(); SqlDataSource1.Select(argument); connection.Close(); GridView1.Visible = true; GridView1.DataBind(); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //обновление Кружка GridView1.SelectRow(e.RowIndex); TextBox Описание = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox4"); TextBox Начало = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox5"); TextBox Конец = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox6"); try { SqlDataSource1.UpdateCommand = @"UPDATE Kruzhki SET " + " Описание = '" + Описание.Text + "' , ДатаНачала = '" + Convert.ToDateTime(Начало.Text) + "' , ДатаОкончания = '" + Convert.ToDateTime(Конец.Text) + "' WHERE (KruzhId LIKE '" + GridView1.SelectedValue + "')"; GridView1.SelectRow(-1); } catch { e.Cancel = true; } }
protected void ButtonОк1_Click(object sender, EventArgs e) { //Удаляем каталлог Кружка и находящиеся в нем файлы string saveDir = @"uploads\Задания\"; string saveDir2 = @"uploads\Работы\"; string saveDir3 = @"uploads\Теория\"; string appPath = Request.PhysicalApplicationPath; Label Кружок = (Label)GridView1.SelectedRow.FindControl("Label4"); Label Дисциплина = (Label)GridView1.SelectedRow.FindControl("Label2"); try { Directory.Delete(appPath + saveDir + Дисциплина.Text + @"\" + Кружок.Text + @"\", true); Directory.Delete(appPath + saveDir2 + Дисциплина.Text + @"\" + Кружок.Text + @"\", true); Directory.Delete(appPath + saveDir3 + Дисциплина.Text + @"\" + Кружок.Text + @"\", true); } catch { // каталоги не найдены } SqlDataSource1.DeleteCommand = @"DELETE FROM Kruzhki WHERE (KruzhId LIKE '" + GridView1.SelectedValue + "')"; SqlDataSource1.Delete(); GridView1.SelectRow(-1); Panel1.Visible = false; GridView1.Enabled = true; }
protected void editBox_OK_Click(object sender, EventArgs e) { //Удаляем каталлог и находящиеся в нем файлы string saveDir = @"uploads\Теория\"; string saveDir2 = @"uploads\Работы\"; string saveDir3 = @"uploads\Задания\"; string appPath = Request.PhysicalApplicationPath; Label Subject = (Label)GridView1.SelectedRow.FindControl("lblTile"); try { Directory.Delete(appPath + saveDir + Subject.Text + @"\", true); Directory.Delete(appPath + saveDir2 + Subject.Text + @"\", true); Directory.Delete(appPath + saveDir3 + Subject.Text + @"\", true); } catch { // Каталог не найден } SqlDataSource1.DeleteCommand = @"DELETE FROM Subjects WHERE (SubjectId LIKE '" + GridView1.SelectedValue + "')"; SqlDataSource1.Delete(); GridView1.SelectRow(-1); Panel1.Visible = false; GridView1.Enabled = true; }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { GridView1.Rows[e.RowIndex].Cells[0].Visible = true; GridView1.SelectRow(e.RowIndex); string idd = GridView1.SelectedDataKey[0].ToString(); Literal1.Text = ":" + idd; SqlConnection sqlConnection = new SqlConnection(); sqlConnection.ConnectionString = ConfigurationManager.ConnectionStrings["CrisTimeConnection"].ConnectionString; SqlCommand sqlCommand = new SqlCommand(); sqlCommand.Connection = sqlConnection; sqlCommand.CommandText = " delete from [SARBATORI] where id=" + idd.Trim(); sqlCommand.Connection.Open(); try { sqlCommand.ExecuteNonQuery(); this.Literal1.Text = "<strong>Sarbatoare legala stearsa cu success </strong>"; GridView1.DataBind(); } catch (SqlException ex) { this.Literal1.Text = this.Literal1.Text + "<br>/" + ex.Message + "<br /> <strong>Eroare le stergere </strong>"; } sqlCommand.Connection.Close(); e.Cancel = true; }
protected void editBox_Cancel_Click(object sender, EventArgs e) { Panel1.Visible = false; GridView1.SelectRow(-1); GridView1.Enabled = true; }
protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e) { //Bind the data changes to the GridView to render immediately GridView1.DataBind(); //close the DetailView by recalibrating GridView selected row to -1 (non-row) GridView1.SelectRow(-1); }
protected void GridView_Prod_RadioSelect(object sender, EventArgs e) { RadioButton linkb = (RadioButton)sender; GridViewRow row = (GridViewRow)linkb.NamingContainer; if (row != null && row.RowIndex != -1) { GridView1.SelectRow(row.RowIndex); } }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Удаление Теста Panel1.Visible = true; GridView1.SelectRow(e.RowIndex); GridView1.Enabled = false; SqlDataSource1.DeleteCommand = @"DELETE FROM TestSeries WHERE (Номер = '')"; }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Удаление пользователя Panel1.Visible = true; GridView1.SelectRow(e.RowIndex); GridView1.Enabled = false; SqlDataSource1.DeleteCommand = @"DELETE FROM Users WHERE (Фамилия = ' ')"; }
protected void gridViewRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "ShowDetailsView") { GridView1.SelectRow(Convert.ToInt32(e.CommandArgument)); GridViewRow gvr = GridView1.SelectedRow; string text = gvr.Cells[0].Text; Console.WriteLine("There is a method" + gvr.Cells[0].Text); Response.Redirect("RecipeDetails.aspx?RecipeId=" + gvr.Cells[0].Text); } Console.WriteLine("There is a method"); }
protected void GridView1_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { // Удаление файла Panel1.Visible = true; GridView1.SelectRow(e.RowIndex); GridView1.Enabled = false; SqlDataSource1.DeleteCommand = @"DELETE FROM TeorFiles WHERE (НазваниеФайла = ' ')"; }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { // Удаление дисциплины Panel1.Visible = true; GridView1.SelectRow(e.RowIndex); GridView1.Enabled = false; SqlDataSource1.DeleteCommand = @"DELETE FROM Subjects WHERE (Название = ' ')"; }
protected void ButtonОк1_Click(object sender, EventArgs e) { //Удаляем Тест SqlDataSource1.DeleteCommand = @"DELETE FROM TestSeries WHERE (TestSeriesId LIKE '" + GridView1.SelectedValue + "')"; SqlDataSource1.Delete(); GridView1.SelectRow(-1); Panel1.Visible = false; GridView1.Enabled = true; }
protected void Page_Load(object sender, EventArgs e) { if (Session["Email_ID"] == null) { Response.Redirect("Home.aspx"); } lblCurrentUser.Text = Session["Email_ID"].ToString(); lblLoginTime.Text = DateTime.Now.ToString(); GridView1.Visible = true; GridView1.SelectRow(-1); GridView1.DataSourceID = "SqlDataSource1"; }
protected void ButtonОк1_Click(object sender, EventArgs e) { // Удаление файла, записи в БД и физически //Находим физический путь файла string appPath = Request.PhysicalApplicationPath; SqlConnection connection = new SqlConnection(SqlDataSource1.ConnectionString); SqlCommand getFile = new SqlCommand( "SELECT Путь FROM TeorFiles " + "WHERE (TeorFileId LIKE '" + GridView1.SelectedValue + "');", connection); connection.Open(); SqlDataReader reader = getFile.ExecuteReader(); try { reader.Read(); File.Delete(appPath + reader[0].ToString()); } catch { } finally { reader.Close(); connection.Close(); } // Удаление записи из БД SqlDataSource1.DeleteCommand = @"DELETE FROM TeorFiles WHERE (TeorFileId LIKE '" + GridView1.SelectedValue + "')"; SqlDataSource1.Delete(); GridView1.SelectRow(-1); Panel1.Visible = false; GridView1.Enabled = true; }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //обновление дисциплины GridView1.SelectRow(e.RowIndex); TextBox Descr = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Descript"); TextBox Poscr = (TextBox)GridView1.Rows[e.RowIndex].FindControl("Poscript"); SqlDataSource1.UpdateCommand = @"UPDATE Subjects SET " + " Описание = '" + Descr.Text + "' , Примечание = '" + Poscr.Text + "' WHERE (SubjectId LIKE '" + GridView1.SelectedValue + "')"; GridView1.SelectRow(-1); }
protected void LinkButton_Show_Spec_Command(object sender, CommandEventArgs e) { LinkButton linkb = (LinkButton)sender; GridViewRow row = (GridViewRow)linkb.NamingContainer; if (row != null && row.RowIndex != -1 && row.RowIndex != GridView1.SelectedIndex) { GridView1.SelectRow(row.RowIndex); } ((RadioButton)GridView1.SelectedRow.Cells[0].FindControl("prod_radio")).Checked = true; String forwardString = "Popups/Product/AllProd_Specification.aspx"; forwardString += "?prodCatId=" + ((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Hidden")).Text; ScriptManager.RegisterStartupScript(this, typeof(string), "DispSpecProd", "window.open('" + forwardString + "',null,'resizeable=yes,scrollbars=yes,addressbar=no,toolbar=yes,width=700,height=600,left=100,right=500,scrollbars=1');", true); }
protected void LinkButton_Defect_Command(object sender, CommandEventArgs e) { LinkButton linkb = (LinkButton)sender; GridViewRow row = (GridViewRow)linkb.NamingContainer; if (row != null && row.RowIndex != -1 && row.RowIndex != GridView1.SelectedIndex) { GridView1.SelectRow(row.RowIndex); } ((RadioButton)GridView1.SelectedRow.Cells[0].FindControl("contact_radio")).Checked = true; String forwardString = "/Pages/Popups/Contacts/AllDefectsWithContact.aspx"; forwardString += "?contactId=" + ((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Hidden")).Text; ScriptManager.RegisterStartupScript(this, typeof(string), "DispContactDefects", "window.open('" + forwardString + "',null,'resizeable=yes,scrollbars=yes,addressbar=no,toolbar=yes,width=1000,Height=700');", true); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { //Обновление теста GridView1.SelectRow(e.RowIndex); TextBox Descr = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBox2"); SqlDataSource1.UpdateCommand = @"UPDATE TestSeries SET " + " Описание = '" + Descr.Text + "', Дата = '" + DateTime.Now + "' WHERE (TestSeriesId LIKE '" + GridView1.SelectedValue + "')"; GridView1.SelectRow(-1); }
protected void Page_Load(object sender, EventArgs e) { Calendar1.SelectedDate = date_select1; Calendar2.SelectedDate = date_select2; try { colorDef = GridView1.BackColor; if (Session["UserCellStats"] != null) { DropDownList1.SelectedIndex = (int)Session["UserCellStats"]; } if (Session["StartDateCellStats"] != null) { Calendar1.SelectedDate = (DateTime)Session["StartDateCellStats"]; } if (Session["EndDateCellStats"] != null) { Calendar2.SelectedDate = (DateTime)Session["EndDateCellStats"]; } if (Session["Grid1DataCellStats"] != null) { List <cellDisp1> grid1_data = (List <cellDisp1>)Session["Grid1DataCellStats"]; GridView1.DataSource = grid1_data; GridView1.DataBind(); GridView1.Visible = true; } if (Session["Grid1SelectedRowCellStats"] != null) { int grid1row = (int)Session["Grid1SelectedRowCellStats"]; GridView1.SelectedIndex = grid1row; GridView1.SelectedRow.BackColor = System.Drawing.Color.Yellow; GridView1.SelectRow(grid1row); } } catch (Exception ex) { TextBoxC1.Text = "Error in restoring sesson data.\n"; } clear_session(); }
protected void LinkButton_Location_Command(object sender, CommandEventArgs e) { LinkButton linkb = (LinkButton)sender; GridViewRow row = (GridViewRow)linkb.NamingContainer; if (row != null && row.RowIndex != -1 && row.RowIndex != GridView1.SelectedIndex) { GridView1.SelectRow(row.RowIndex); } ((RadioButton)GridView1.SelectedRow.Cells[0].FindControl("contact_radio")).Checked = true; String forwardString = "Popups/Contacts/AllContacts_Location.aspx"; String fromSite = ((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_From_Site")).Text; forwardString += "?fromSite=" + fromSite; ScriptManager.RegisterStartupScript(this, typeof(string), "DispLocationContacts", "window.open('" + forwardString + "',null,'status=1,width=600,height=400,left=500,right=500');", true); }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { // определение команды обновления оценки работы GridView1.SelectRow(e.RowIndex); Panel2.Visible = false; GridView1.Enabled = true; DropDownList статус = (DropDownList)GridView1.Rows[e.RowIndex].FindControl("DropDownListS"); TextBox баллы = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBoxB"); TextBox комментарий = (TextBox)GridView1.Rows[e.RowIndex].FindControl("TextBoxK"); // SqlDataSource2.UpdateCommand = @"UPDATE Works SET " + " Статус = '" + статус.Text + "', " + " Баллы = '" + баллы.Text + "', " + " Комментарий = '" + комментарий.Text + "' " + " WHERE (WorkId LIKE '" + GridView1.SelectedValue + "')"; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { FillDepartments(); FillGenders(); GetDataFromDatabase(); ViewState["Action"] = "Insert"; ViewState["Id"] = null; if (Request.QueryString["FirstName"] != null) { Label1.Text = Request.QueryString["FirstName"] + " " + Request.QueryString["LastName"]; } GridView1.SelectRow(0); for (int i = 1; i <= GridView1.Rows.Count; i++) { GridView1.SelectedRow.Cells[0].Text = i.ToString(); GridView1.SelectRow(i); } } }
protected void VenDetail_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { GridView1.DataBind(); GridView1.SelectRow(-1); venueOutput.Visible = false; }
protected void GridView1_Load(object sender, EventArgs e) { GridView1.SelectRow(1); }
protected void DetailsView1_ItemInserted1(object sender, DetailsViewInsertedEventArgs e) { GridView1.DataBind(); GridView1.SelectRow(-1); }
protected void DetailsView2_ItemDeleted(object sender, DetailsViewDeletedEventArgs e) { GridView1.DataBind(); GridView1.SelectRow(-1); }
protected void FirstTaskButton_Click(object sender, EventArgs e) { GridView1.SelectedIndex = -1; GridView1.SelectRow(-1); DetailsView1.ChangeMode(DetailsViewMode.Insert); }