Esempio n. 1
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        TextBox comments = LoginView4.FindControl("txbxcomment") as TextBox;

        try
        {
            if (comments.Text != comments.ToolTip.ToString())
            {
                if (con.State == ConnectionState.Closed)
                {
                    con.Open();
                }

                SqlCommand cmd = new SqlCommand("insert into Comments(BlogId, Comment, Name, Date) values(@bid,@com,@name,@date)", con);
                cmd.Parameters.AddWithValue("@bid", Request.QueryString["Id"]);
                cmd.Parameters.AddWithValue("@com", comments.Text);
                cmd.Parameters.AddWithValue("@name", Profile.UserName);
                cmd.Parameters.AddWithValue("@date", System.DateTime.Now);
                cmd.ExecuteNonQuery();
                cmd.Dispose();
                comments.Text = String.Empty;
                bindComment();
                Response.Redirect(Request.RawUrl);
            }
            else
            {
            }
        }
        catch (Exception)
        {
            throw;
        }
        finally { con.Close(); }
    }
    protected void chooseClassList_SelectedIndexChanged(object sender, EventArgs e)
    {
        DropDownList ddlList = (DropDownList)LoginView4.FindControl("chooseClassList");

        chosenClassLabel.Text = ddlList.SelectedValue;
        this.BindGrid2();
        AtendeeLabel.Text     = "No one selected. &nbsp";
        RemoveAtendee.Enabled = false;
    }