using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Bloger_LogManage_WriteLog : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void FormView1_DataBound(object sender, EventArgs e)
    {
        this.FormView1.ChangeMode(FormViewMode.Insert);
    }
    protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
    {
        e.Command.Parameters["@bloger_name"].Value = this.User.Identity.Name;
    }
    protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        if (IsPostBack)
        {
            Control myCtrl1 = this.FormView1.FindControl("DropDownList1");
            e.Command.Parameters["@category_id"].Value = int.Parse(((DropDownList)myCtrl1).SelectedValue);

            e.Command.Parameters["@bloger_name"].Value = this.User.Identity.Name;
            e.Command.Parameters["@contents"].Value = ((FredCK.FCKeditorV2.FCKeditor)this.FormView1.FindControl("FCKeditor1")).Value.ToString();
                        
        }
    }
    protected void InsertButton_Click(object sender, EventArgs e)
    {
        Response.Write("<script>alert('日志已保存。再写一篇吧^_^)</script>");        
    }
}
