protected void Page_Load(object sender, EventArgs e)
    {
        //Page.Header.DataBind();
        if (!IsPostBack)
        {
            Session["SubmitTime"] = DateTime.Now.ToString();
            if (Convert.ToString(Session["ExternalUserId"]) != "" && Session["ExternalUserId"] != null)
            {
                ViewState["UserID"] = Convert.ToInt32(Session["ExternalUserId"].ToString());
            }

            HtmlGenericControl masterlbl = (HtmlGenericControl)Master.FindControl("lblmaster");
            masterlbl.InnerText = "Q&A";

            if (Convert.ToString(Session["UserTypeId"]) != "" && Session["UserTypeId"] != null)
            {
                ViewState["FlagUser"] = Convert.ToInt32(Session["UserTypeId"].ToString());
            }
            SubjectTempDataTable();
            BindSubjectList();
            GetRelatedQuestion();
            // HideShowSubject();
            if (!string.IsNullOrEmpty(Request.QueryString["PostQAId"]))
            {
                ViewState["PostQAId"] = Request.QueryString["PostQAId"];
                LoadEditQA();
                BindEditSubjectList();
                BindSubjectLists();
            }

            CKDescription.Focus();
        }
    }
Exemple #2
0
    protected void RepPopPost_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        PopUpShare.Style.Add("display", "none");
        divDeletesucess.Style.Add("display", "none");
        HiddenField hdnBlogCommentUser = (HiddenField)e.Item.FindControl("hdnBlogCommentUser");
        HiddenField hdnCommentID       = (HiddenField)e.Item.FindControl("hdnCommentID");
        HiddenField hdnintAddedBy      = (HiddenField)e.Item.FindControl("hdnintAddedBy");
        Label       lblCommentAll      = e.Item.FindControl("lblCommentAll") as Label;

        ViewState["hdnCommentID"]          = hdnCommentID.Value;
        objBlogLikeShare.intCommentID      = Convert.ToInt32(hdnCommentID.Value);
        objBlogLikeShare.intRegistrationId = Convert.ToInt32(ViewState["UserID"]);
        string ip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];

        if (ip == null)
        {
            ip = Request.ServerVariables["REMOTE_ADDR"];
        }
        objBlogLikeShare.strIpAddress = ip;
        objBlogLikeShare.intAddedBy   = Convert.ToInt32(ViewState["UserID"]);
        divSuccess.Style.Add("display", "none");
        if (e.CommandName == "View profile")
        {
            Response.Redirect("Home.aspx?RegId=" + hdnintAddedBy.Value);
        }
        else
        if (e.CommandName == "LikeForum")
        {
            PopUpShare.Style.Add("display", "none");
            objBlogLikeShare.strRepLiShStatus = "LI";
            objBlogLikeShareDB.AddEditDel_BlogCommentLikeShare(objBlogLikeShare, DA_BlogLikeShare.BlogShareLikeFlag.BlogLike);
            PopUpShare.Style.Add("display", "none");
            BindComments();
        }
        else
        if (e.CommandName == "ShareForum")
        {
            ViewState["intCommentID"] = hdnCommentID.Value;
            Label  lblComment = (Label)e.Item.FindControl("lblComment");
            string DocTitle   = lblComment.Text;
            lblTitle.Text = lblComment.Text;
            PopUpShare.Style.Add("display", "block");
        }
        else
        if (e.CommandName == "ViewMore")
        {
            Label      lblComment  = (Label)e.Item.FindControl("lblComment");
            LinkButton lnkViewSubj = (LinkButton)e.Item.FindControl("lnkViewSubj");
            if (lnkViewSubj.Text == "view more")
            {
                lblComment.Visible    = false;
                lblCommentAll.Visible = true;
                lnkViewSubj.Text      = "Close";
                PopUpShare.Style.Add("display", "none");
            }
            else
            {
                lblComment.Visible    = true;
                lblCommentAll.Visible = false;
                lnkViewSubj.Text      = "view more";
                PopUpShare.Style.Add("display", "none");
            }
        }
        else
        if (e.CommandName == "Edit Blog")
        {
            ViewState["Edit"] = hdnCommentID.Value;
            if (ip == null)
            {
                ip = Request.ServerVariables["REMOTE_ADDR"];
            }
            objblogdo.strIPAddress = ip;
            objblogdo.intBlogId    = Convert.ToInt32(ViewState["intBlogId"]);
            objblogdo.intAddedBy   = Convert.ToInt32(Session["ExternalUserId"]);
            objblogdo.intCommentId = Convert.ToInt32(hdnCommentID.Value);
            DataTable dtblog = objblogda.GetDataTableComment(objblogdo, DA_NewBlogs.BlogCommnet.GetCommentById);
            if (dtblog.Rows.Count > 0)
            {
                CKDescription.InnerText = Convert.ToString(dtblog.Rows[0]["strComment"]);
                CKDescription.Focus();
            }
        }
        else
        if (e.CommandName == "Delete Blog")
        {
            ViewState["blogCommentnames"] = lblCommentAll.Text;
            divDeletesucess.Style.Add("display", "block");
        }
    }