Exemplo n.º 1
0
 protected void btnreply_Click(object sender, EventArgs e)
 {
     if (Session["user_name"] != null)
     {
         if (Page.IsValid)
         {
             Button            btn   = (Button)sender;
             string            a     = ((TextBox)btn.Parent.FindControl("txtreply")).Text.Trim();
             travel_comt_reply reply = new travel_comt_reply();
             reply.trcomt_id  = Int32.Parse((btn.Parent.FindControl("HiddenFieldComID") as HiddenField).Value);
             reply.user_id    = int.Parse(Session["user_id"].ToString());
             reply.reply_cont = ((TextBox)btn.Parent.FindControl("txtreply")).Text.Trim();
             reply.reply_time = DateTime.Now;
             int result = Travel_comt_replyManager.InsertTravel_re(reply);
             if (result >= 1)
             {
                 ScriptManager.RegisterClientScriptBlock(updatereply, this.GetType(), "click", "alert('回复成功!')", true);
                 BindTravelComment();
                 txtComments.Text = "";
             }
             else
             {
                 ScriptManager.RegisterClientScriptBlock(updatereply, this.GetType(), "click", "alert('回复失败!')", true);
             }
         }
     }
     else
     {
         ScriptManager.RegisterClientScriptBlock(updatereply, this.GetType(), "click", "alert('您必须先登录才能回复!')", true);
         ScriptManager.RegisterStartupScript(updatereply, updatereply.GetType(), "updateScript", "window.location.href='login1.aspx'", true);
     }
 }