Working with repeater control having repeater inside and insert, update and email send operation.
<connectionStrings>
<add name="connectionstring" connectionString="Data Source=RIZVI-PC\SQLEXPRESS;Initial Catalog=ABCdb; User ID=ABC; Password=abc" />
</connectionStrings>
-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class AbcsComment : System.Web.UI.Page
{
Class_Comments _obj = new Class_Comments();
Class_Registration _objRegistration = new Class_Registration();
public static string _firstName = string.Empty;
public static string _lastName = string.Empty;
protected bool _userstatus = false;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
_obj.GetABCComments();
rpt_Comment.DataSource = _obj.ABCCommentsTable;
rpt_Comment.DataBind();
// GetCaptcha();
}
}
protected void btn_Submit_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
_objRegistration.EmailID = Convert.ToString(Session["User"]);
_objRegistration.GetUserDetailsByEmailId();
if (_objRegistration.OperationStatus)
{
_firstName = Convert.ToString(_objRegistration.UserManagementTable.Rows[0]["FirstName"]);
_lastName = Convert.ToString(_objRegistration.UserManagementTable.Rows[0]["LastName"]);
txt_Name.Text = _firstName + " " + _lastName;
if (txt_Name.Text != "" && txt_Comment.Text != "")
{
_obj.EmailID = Convert.ToString(Session["User"]);
_obj.UserName = txt_Name.Text.ToString();
_obj.Description = txt_Comment.Text.ToString();
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.CommentType = "ABCComment";
_obj.AddComment();
lblMsg.Text = "Comment added successfully.";
lblMsg.ForeColor = System.Drawing.Color.Green;
lblMsg.Visible = true;
txt_Name.Text = "";
txt_Comment.Text = "";
BindComment();
}
else
{
lblMsg.Text = "Please enter your comment.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
if (txt_Name.Text == "")
txt_Name.Focus();
else
txt_Comment.Focus();
}
}
else
{
lblMsg.Text = "Please login to post your comments.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
else
{
lblMsg.Text = "Please login to post your comments.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
catch (Exception ex)
{
lblMsg.Text = "Comment not added successfully.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
private void Clear()
{
throw new NotImplementedException();
}
public bool returnStatus()
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
return true;
else return false;
}
protected void btnSendMail_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_email = (TextBox)rptcomment.FindControl("txt_email");
HiddenField hdn_username = (HiddenField)rptcomment.FindControl("hdn_username");
HiddenField hdn_useremail = (HiddenField)rptcomment.FindControl("hdn_useremail");
if (txt_email.Text != "")
{
string body = "Dear " + hdn_username.Value + ",<br/><br/>There is a new message for your comment.";
body += "<br/><br/><b> Message :</b> " + txt_email.Text + "<br/><br/>You can reply on <b>" + Convert.ToString(Session["User"]) + "</b>.<br/><br/>";
body += "<br/>Thank You<br/>abc.in";
Class_Additionalresources.Sendmail(hdn_useremail.Value, "New Message on abc.in", body, "New Message on abc.in", Convert.ToString(Session["User"]));
lbl_msg.Text = "Email sent successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
}
else
{
lbl_msg.Text = "Please enter your query to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
else
{
lbl_msg.Text = "Please login to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Email not sent successfully. Error : " + ex.Message;
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
protected void btn_replySubmit_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_reply = (TextBox)rptcomment.FindControl("txt_reply");
HiddenField hdn_cmntID = (HiddenField)rptcomment.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
if (txt_reply.Text != "")
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
_obj.EmailID = Convert.ToString(Session["User"]);
_obj.CommentReplyType = "ABCComment";
_obj.CommentReply = txt_reply.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.AddCommentReplyFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Reply posted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_reply.Focus();
}
}
else
{
lbl_msg.Text = "Please login to post your reply.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Reply not posted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Update Comment
protected void Btn_UpdateComment_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_editCommnt = (TextBox)rptcomment.FindControl("txt_editCommnt");
HiddenField hdn_cmntID = (HiddenField)rptcomment.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
if (txt_editCommnt.Text != "")
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
// _obj.EmailID = Convert.ToString(Session["User"]);
// _obj.CommentReplyType = "ABCComment";
_obj.Description = txt_editCommnt.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.UpdateABCCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_editCommnt.Focus();
}
}
else
{
lbl_msg.Text = "Please login to update your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Update Child Comment
protected void Btn_UpdateCommentReply_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptCommentReply = (RepeaterItem)btn.NamingContainer;
TextBox txt_editCommntReply = (TextBox)rptCommentReply.FindControl("txt_editCommntReply");
HiddenField hdn_ChildcmntID = (HiddenField)rptCommentReply.FindControl("hdn_ChildcmntID");
if (returnStatus() == true)
{
if (txt_editCommntReply.Text != "")
{
_obj.ReplyID = Convert.ToInt32(hdn_ChildcmntID.Value);
_obj.CommentReply = txt_editCommntReply.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.UpdateABCChildCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_editCommntReply.Focus();
}
}
else
{
lbl_msg.Text = "Please login to update your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Delete Comment
protected void Btn_DeleteCmnt_Click(object sender, EventArgs e)
{
try
{
LinkButton anchor = (LinkButton)sender;
RepeaterItem rptCommentReply = (RepeaterItem)anchor.NamingContainer;
HiddenField hdn_cmntID = (HiddenField)rptCommentReply.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
_obj.DeleteABCCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please login to delete your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Delete Child Comment
protected void Btn_DeleteCmntReply_Click(object sender, EventArgs e)
{
try
{
LinkButton btn = (LinkButton)sender;
RepeaterItem rptCommentReply = (RepeaterItem)btn.NamingContainer;
HiddenField hdn_ChildcmntID = (HiddenField)rptCommentReply.FindControl("hdn_ChildcmntID");
if (returnStatus() == true)
{
_obj.ReplyID = Convert.ToInt32(hdn_ChildcmntID.Value);
_obj.DeleteABCChildCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please login to delete your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
private void BindComment()
{
_obj.GetABCComments();
rpt_Comment.DataSource = _obj.ABCCommentsTable;
rpt_Comment.DataBind();
}
// Child Comment Email
protected void btn_SendChildEMail_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_childEmail = (TextBox)rptcomment.FindControl("txt_childEmail");
HiddenField hdn_Childusername = (HiddenField)rptcomment.FindControl("hdn_Childusername");
HiddenField hdn_Childuseremail = (HiddenField)rptcomment.FindControl("hdn_Childuseremail");
if (txt_childEmail.Text != "")
{
string body = "Dear " + hdn_Childusername.Value + ",<br/><br/>There is a new message for your comment.";
body += "<br/><br/><b> Message :</b> " + txt_childEmail.Text + "<br/><br/>You can reply on <b>" + Convert.ToString(Session["User"]) + "</b>.<br/><br/>";
body += "<br/>Thank You<br/>abc.in";
Class_Additionalresources.Sendmail(hdn_Childuseremail.Value, "New Message for ABC on abc.in", body, "New Message on abc.in", Convert.ToString(Session["User"]));
lbl_msg.Text = "Email sent successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
}
else
{
lbl_msg.Text = "Please enter your query to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
else
{
lbl_msg.Text = "Please login to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Email not sent successfully. Error : " + ex.Message;
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// ---------------------- Child Reply -----------------------------
//protected void btn_childReply_Click(object sender, EventArgs e)
//{
// try
// {
// Button btn = (Button)sender;
// RepeaterItem child_rptcomment = (RepeaterItem)btn.NamingContainer;
// TextBox txt_childreply = (TextBox)child_rptcomment.FindControl("txt_childreply");
// HiddenField hdn_ChildcmntID = (HiddenField)child_rptcomment.FindControl("hdn_ChildcmntID");
// if (returnStatus() == true)
// {
// _obj.CommentsID = Convert.ToInt32(hdn_ChildcmntID.Value);
// _obj.EmailID = Convert.ToString(Session["User"]);
// _obj.CommentReplyType = "ABCComment";
// _obj.CommentReply = txt_childreply.Text;
// _obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
// _obj.AddCommentReplyFront();
// if (_obj.OperationStatus)
// {
// lbl_msg.Text = "Reply posted successfully.";
// lbl_msg.ForeColor = System.Drawing.Color.Green;
// lbl_msg.Visible = true;
// }
// }
// else
// {
// lbl_msg.Text = "Please login to post your reply.";
// lbl_msg.ForeColor = System.Drawing.Color.Red;
// lbl_msg.Visible = true;
// }
// }
// catch (Exception ex)
// {
// lbl_msg.Text = "Reply not posted successfully.";
// lbl_msg.ForeColor = System.Drawing.Color.Red;
// lbl_msg.Visible = true;
// }
//}
//void GetCaptcha()
//{
// HiddenField hdn_captchaID = (HiddenField)rpt_Comment.FindControl("hdn_captchaID");
// Image imgCaptcha = (Image)rpt_Comment.FindControl("imgCaptcha");
// try
// {
// Class_Captcha cap1 = new Class_Captcha();
// cap1.captcha();
// if (cap1.OperationStatus != false)
// {
// DataTable dt = new DataTable();
// dt = cap1.CaptchaTable;
// imgCaptcha.ImageUrl = dt.Rows[0]["CaptchaImagePath"].ToString();
// hdn_captchaID.Value = dt.Rows[0]["CaptchaId"].ToString();
// }
// }
// catch (Exception ex)
// {
// lblMsg.Text = "Error : " + ex.Message;
// lblMsg.ForeColor = System.Drawing.Color.Red;
// }
//}
}
In Design View
<%@ Page Title="Abc Comments : Abc.in" Language="C#" MasterPageFile="~/Abc_Front.master" AutoEventWireup="true" CodeFile="~/TestRepeater.aspx.cs" Inherits="AbcsComment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script type="text/javascript">
function showpopup() {
var loggedin = '<%= returnStatus() %>';
if (loggedin == 'False') {
$("#newskloginForm").show();
$("#registerfromId1").hide();
$("#registerfromId2").show();
$("#registerfromId3").hide();
return false;
}
else return true;
}
function ShowEditComment() {
$(".recommentbtn04").show();
}
function HideEditComment() {
$(".recommentbtn04").hide();
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="quizBanner_container">
<img src="images/postcommentAbcs.jpg" style="width: 100%;" alt="Abc Comments" />
</div>
<div style="width: 100%; text-align: center; padding-top: 15px;">
<asp:Label ID="lbl_msg" runat="server" Visible="false"></asp:Label>
</div>
<div class="Repostcomment_container">
<asp:Repeater ID="rpt_Comment" runat="server">
<ItemTemplate>
<div class="newcommentbox01">
<div class="reviviewTop_container">
<div class="newcommmetboxImg">
<img src='<%# string.IsNullOrEmpty(Eval("ProfileImagePath").ToString()) ? Page.ResolveUrl("~/images/userclientimg.jpg") : Page.ResolveUrl(Eval("ProfileImagePath").ToString()) %>' alt="" />
</div>
<div class="newcommmetboxContant">
<asp:HiddenField ID="hdn_cmntID" runat="server" Value='<%#Eval("CommentsID") %>' />
<asp:HiddenField ID="hdn_username" runat="server" Value='<%# Eval("UserName") %>' />
<asp:HiddenField ID="hdn_useremail" runat="server" Value='<%# Eval("EmailID") %>' />
<div class="newcommentuser_name"><%#Eval("UserName") %></div>
<span style="font-size: 12px;">@Abc</span>
<div class="newcommentuser_date"><%#Eval("PostedDate","{0:d}") %> at <%#Eval("PostedDate","{0:t}") %></div>
<p class="more"><%# Eval("Description") %></p>
<div style="display: none;" id='<%#"inputreedit"+Eval("CommentsID")+"div" %>'>
<asp:TextBox ID="txt_editCommnt" runat="server" class="redesignForn_inputClassreedit" placeholder="Type your comment" TextMode="MultiLine"
Text='<%# Eval("Description").ToString() %>'></asp:TextBox>
<div style="width: 100%; float: left;">
<a href="javascript:void(0)" id='<%#"inputreedit"+Eval("CommentsID") +"di" %>' class="replysubmitBoxBtn02closeatag">Cancel</a>
<asp:Button ID="Btn_UpdateComment" runat="server" CssClass="replysubmitBoxBtn02close002" Text="Update" OnClick="Btn_UpdateComment_Click" />
</div>
</div>
</div>
<div class="reaplyComtainer_inpost">
<ul>
<li><a href="javascript:void(0)" id='<%#"inputreedit"+Eval("CommentsID") %>' class="recommentbtn04" style='<%# "display:" + (Convert.ToString(Eval("EmailID")) == Convert.ToString(Session["User"])?"block": "none") %>'>Edit</a></li>
<li>
<asp:LinkButton ID="Btn_DeleteCmnt" runat="server" Text="Delete" class="recommentbtn04" OnClick="Btn_DeleteCmnt_Click" OnClientClick="return confirm('Are you sure you want to delete this comment.')" Style='<%# "display:" + (Convert.ToString(Eval("EmailID")) == Convert.ToString(Session["User"])?"block": "none") %>' /></li>
<li><a href="javascript:void(0)" id='<%#"recommentbtn"+Eval("CommentsID") %>' class="recommentbtn">Reply</a></li>
<li><a href="javascript:void(0)" id='<%#"sendmailuserbtn"+Eval("CommentsID") %>' class="recommentbtn02">Send Mail</a></li>
</ul>
</div>
</div>
<!-------reply submit container------>
<!------- Inner Listing ------>
<asp:Repeater ID="rpt_InnerComment" runat="server" DataSourceID="SqlDataSource_CommentReply">
<ItemTemplate>
<div class="replysepratorCommnmain">
<div class="replysepratorCommnmain01">
<div class="newcommmetboxImg">
<img src='<%# string.IsNullOrEmpty(Eval("ProfileImagePath").ToString()) ? Page.ResolveUrl("~/images/userclientimg.jpg") : Page.ResolveUrl(Eval("ProfileImagePath").ToString()) %>' alt="" />
</div>
<div class="newcommmetboxContant">
<asp:HiddenField ID="hdn_ChildcmntID" runat="server" Value='<%#Eval("CommentReplyId") %>' />
<asp:HiddenField ID="hdn_Childusername" runat="server" Value='<%# Eval("FirstName") %>' />
<asp:HiddenField ID="hdn_Childuseremail" runat="server" Value='<%# Eval("ReplyBy") %>' />
<div class="newcommentuser_name"><%#Eval("FirstName") %></div>
<span style="font-size: 12px;">@Abc</span>
<div class="newcommentuser_date"><%#Eval("PostedDate") %></div>
<p class="more"><%#Eval("CommentReply") %></p>
<div style="display: none;" id='<%#"inputEditComntReply"+Eval("CommentReplyId")+"div" %>'>
<asp:TextBox ID="txt_editCommntReply" runat="server" class="redesignForn_inputClassreedit" placeholder="Type your comment" TextMode="MultiLine"
Text='<%# Eval("CommentReply").ToString() %>'></asp:TextBox>
<div style="width: 100%; float: left;">
<a href="javascript:void(0)" id='<%#"inputEditComntReply"+Eval("CommentReplyId") %>' class="replysubmitBoxBtn022closeatag">Cancel</a>
<asp:Button ID="Btn_UpdateCommentReply" runat="server" CssClass="replysubmitBoxBtn02close002" Text="Update" OnClick="Btn_UpdateCommentReply_Click" />
</div>
</div>
</div>
<div class="reaplyComtainer_inpost">
<ul>
<li><a href="javascript:void(0)" id='<%#"inputEditComntReply" + Eval("CommentReplyId") %>' class="recommentbtn05"
style='<%# "display:" + (Convert.ToString(Eval("ReplyBy")) == Convert.ToString(Session["User"])?"block": "none") %>'>Edit</a></li>
<li>
<asp:LinkButton ID="Btn_DeleteCmntReply" runat="server" Text="Delete" class="recommentbtn04" OnClick="Btn_DeleteCmntReply_Click" OnClientClick="return confirm('Are you sure you want to delete this comment.')" Style='<%# "display:" + (Convert.ToString(Eval("ReplyBy")) == Convert.ToString(Session["User"])?"block": "none") %>' /></li>
<%--<li><a href="javascript:void(0)" id='<%#"childcommentbtn_"+Eval("CommentsID") %>' class="recommentbtn">Reply</a></li>--%>
<li><a href="javascript:void(0)" class="recommentbtn02" id='<%#"childsendmailbtn_"+Eval("CommentsID") %>'>Send Mail</a></li>
</ul>
</div>
</div>
<%-- <div class="hiddencommentBoxchild" id='<%#"childcommentbtn_"+Eval("CommentsID")+"div" %>'>
<div class="replysepratorCommnet02">
<asp:TextBox ID="txt_childreply" runat="server" class="replypostcommentFeil" placeholder="Type Your Comments" TextMode="MultiLine"></asp:TextBox>
<a href="javascript:void(0)" class="replysubmitBoxBtn02close" id="childcommentboxclose" rel='<%#"childcommentbtn_"+Eval("CommentsID") %>'>Close</a>
<asp:Button ID="btn_childReply" class="replysubmitBoxBtn02" runat="server" Text="Submit" OnClick="btn_childReply_Click" />
</div>
</div>--%>
<!-----send mail comment user----->
<div class="sendmailusercomment" id='<%#"childsendmailbtn_"+Eval("CommentsID")+"div" %>'>
<div class="sendmailInner">
<%--<input type="text" class="replypostcommentFeil02" placeholder="Email Address" />--%>
<asp:TextBox ID="txt_childEmail" runat="server" CssClass="replypostcommentFeil02" placeholder="Email Address"></asp:TextBox>
<%-- <button type="submit" value="" class="replysubmitBoxBtn03">Submit</button>--%>
<asp:Button ID="btn_SendChildEMail" class="replysubmitBoxBtn03" runat="server" Text="Send Mail" OnClick="btn_SendChildEMail_Click"
OnClientClick="return showpopup()" />
</div>
</div>
<!-----send mail comment user----->
</div>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource_CommentReply" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SP_GetAllCommentReplyByCommentIdAndType" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="hdn_cmntID" Name="CommentId" DefaultValue="-1" ConvertEmptyStringToNull="true" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<!------- Inner Listing ------>
<!-------reply submit container------>
<!-----send mail comment user----->
<div class="sendmailusercomment" id='<%#"sendmailuserbtn"+Eval("CommentsID")+"div" %>'>
<div class="sendmailInner">
<asp:TextBox ID="txt_email" runat="server" class="replypostcommentFeil02" placeholder="Message"></asp:TextBox>
<asp:Button ID="btn_sendmail" runat="server" Text="Send Mail" class="replysubmitBoxBtn03" OnClick="btnSendMail_Click" OnClientClick="return showpopup()" />
</div>
</div>
<!-----send mail comment user----->
<div class="hiddencommentBox" id='<%#"recommentbtn"+Eval("CommentsID")+"div" %>'>
<asp:TextBox ID="txt_reply" runat="server" Placeholder="Type your comment" TextMode="MultiLine" CssClass="redesignForn_inputClass"></asp:TextBox>
<a href="javascript:void(0)" class="replysubmitBoxBtn02close" id="closebtncomment" rel='<%#"recommentbtn"+Eval("CommentsID") %>'>Cancel</a>
<asp:Button ID="btn_replysubmit" CssClass="replysubmitBoxBtn02" Text="Post" OnClick="btn_replySubmit_Click" runat="server" OnClientClick="return showpopup()" />
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<script type="text/javascript">
$(document).ready(function () {
$(".recommentbtn").click(function () {
var divid = "#" + $(this).attr("id") + "div";
$(divid).show();
});
$(".replysubmitBoxBtn02close").click(function () {
var divid1 = "#" + $(this).attr("rel") + "div";
$(divid1).hide();
});
$(".recommentbtn02").click(function () {
var divid2 = "#" + $(this).attr("id") + "div";
$(divid2).show();
});
$(".recommentbtn04").click(function () {
var divid3 = "#" + $(this).attr("id") + "div";
$(divid3).show();
});
$(".replysubmitBoxBtn02closeatag").click(function () {
var divid4 = "#" + $(this).attr("id") + "v";
$(divid4).hide();
});
$(".replysubmitBoxBtn022closeatag").click(function () {
var divid5 = "#" + $(this).attr("id") + "div";
$(divid5).hide();
});
$(".recommentbtn05").click(function () {
var divid6 = "#" + $(this).attr("id") + "div";
$(divid6).show();
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
// Configure/customize these variables.
var showChar = 100; // How many characters are shown by default
var ellipsestext = "...";
var moretext = "Show more >";
var lesstext = "Show less";
$('.more').each(function () {
var content = $(this).html();
if (content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);
var html = c + '<span class="moreellipses">' + ellipsestext + ' </span><span class="morecontent"><span>' + h + '</span> <a href="" class="morelink">' + moretext + '</a></span>';
$(this).html(html);
}
});
$(".morelink").click(function () {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});
</script>
</asp:Content>
<connectionStrings>
<add name="connectionstring" connectionString="Data Source=RIZVI-PC\SQLEXPRESS;Initial Catalog=ABCdb; User ID=ABC; Password=abc" />
</connectionStrings>
-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class AbcsComment : System.Web.UI.Page
{
Class_Comments _obj = new Class_Comments();
Class_Registration _objRegistration = new Class_Registration();
public static string _firstName = string.Empty;
public static string _lastName = string.Empty;
protected bool _userstatus = false;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
_obj.GetABCComments();
rpt_Comment.DataSource = _obj.ABCCommentsTable;
rpt_Comment.DataBind();
// GetCaptcha();
}
}
protected void btn_Submit_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
_objRegistration.EmailID = Convert.ToString(Session["User"]);
_objRegistration.GetUserDetailsByEmailId();
if (_objRegistration.OperationStatus)
{
_firstName = Convert.ToString(_objRegistration.UserManagementTable.Rows[0]["FirstName"]);
_lastName = Convert.ToString(_objRegistration.UserManagementTable.Rows[0]["LastName"]);
txt_Name.Text = _firstName + " " + _lastName;
if (txt_Name.Text != "" && txt_Comment.Text != "")
{
_obj.EmailID = Convert.ToString(Session["User"]);
_obj.UserName = txt_Name.Text.ToString();
_obj.Description = txt_Comment.Text.ToString();
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.CommentType = "ABCComment";
_obj.AddComment();
lblMsg.Text = "Comment added successfully.";
lblMsg.ForeColor = System.Drawing.Color.Green;
lblMsg.Visible = true;
txt_Name.Text = "";
txt_Comment.Text = "";
BindComment();
}
else
{
lblMsg.Text = "Please enter your comment.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
if (txt_Name.Text == "")
txt_Name.Focus();
else
txt_Comment.Focus();
}
}
else
{
lblMsg.Text = "Please login to post your comments.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
else
{
lblMsg.Text = "Please login to post your comments.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
catch (Exception ex)
{
lblMsg.Text = "Comment not added successfully.";
lblMsg.ForeColor = System.Drawing.Color.Red;
lblMsg.Visible = true;
}
}
private void Clear()
{
throw new NotImplementedException();
}
public bool returnStatus()
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
return true;
else return false;
}
protected void btnSendMail_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_email = (TextBox)rptcomment.FindControl("txt_email");
HiddenField hdn_username = (HiddenField)rptcomment.FindControl("hdn_username");
HiddenField hdn_useremail = (HiddenField)rptcomment.FindControl("hdn_useremail");
if (txt_email.Text != "")
{
string body = "Dear " + hdn_username.Value + ",<br/><br/>There is a new message for your comment.";
body += "<br/><br/><b> Message :</b> " + txt_email.Text + "<br/><br/>You can reply on <b>" + Convert.ToString(Session["User"]) + "</b>.<br/><br/>";
body += "<br/>Thank You<br/>abc.in";
Class_Additionalresources.Sendmail(hdn_useremail.Value, "New Message on abc.in", body, "New Message on abc.in", Convert.ToString(Session["User"]));
lbl_msg.Text = "Email sent successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
}
else
{
lbl_msg.Text = "Please enter your query to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
else
{
lbl_msg.Text = "Please login to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Email not sent successfully. Error : " + ex.Message;
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
protected void btn_replySubmit_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_reply = (TextBox)rptcomment.FindControl("txt_reply");
HiddenField hdn_cmntID = (HiddenField)rptcomment.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
if (txt_reply.Text != "")
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
_obj.EmailID = Convert.ToString(Session["User"]);
_obj.CommentReplyType = "ABCComment";
_obj.CommentReply = txt_reply.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.AddCommentReplyFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Reply posted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_reply.Focus();
}
}
else
{
lbl_msg.Text = "Please login to post your reply.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Reply not posted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Update Comment
protected void Btn_UpdateComment_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_editCommnt = (TextBox)rptcomment.FindControl("txt_editCommnt");
HiddenField hdn_cmntID = (HiddenField)rptcomment.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
if (txt_editCommnt.Text != "")
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
// _obj.EmailID = Convert.ToString(Session["User"]);
// _obj.CommentReplyType = "ABCComment";
_obj.Description = txt_editCommnt.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.UpdateABCCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_editCommnt.Focus();
}
}
else
{
lbl_msg.Text = "Please login to update your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Update Child Comment
protected void Btn_UpdateCommentReply_Click(object sender, EventArgs e)
{
try
{
Button btn = (Button)sender;
RepeaterItem rptCommentReply = (RepeaterItem)btn.NamingContainer;
TextBox txt_editCommntReply = (TextBox)rptCommentReply.FindControl("txt_editCommntReply");
HiddenField hdn_ChildcmntID = (HiddenField)rptCommentReply.FindControl("hdn_ChildcmntID");
if (returnStatus() == true)
{
if (txt_editCommntReply.Text != "")
{
_obj.ReplyID = Convert.ToInt32(hdn_ChildcmntID.Value);
_obj.CommentReply = txt_editCommntReply.Text;
_obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
_obj.UpdateABCChildCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please enter your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
txt_editCommntReply.Focus();
}
}
else
{
lbl_msg.Text = "Please login to update your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not updated successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Delete Comment
protected void Btn_DeleteCmnt_Click(object sender, EventArgs e)
{
try
{
LinkButton anchor = (LinkButton)sender;
RepeaterItem rptCommentReply = (RepeaterItem)anchor.NamingContainer;
HiddenField hdn_cmntID = (HiddenField)rptCommentReply.FindControl("hdn_cmntID");
if (returnStatus() == true)
{
_obj.CommentsID = Convert.ToInt32(hdn_cmntID.Value);
_obj.DeleteABCCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please login to delete your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// Delete Child Comment
protected void Btn_DeleteCmntReply_Click(object sender, EventArgs e)
{
try
{
LinkButton btn = (LinkButton)sender;
RepeaterItem rptCommentReply = (RepeaterItem)btn.NamingContainer;
HiddenField hdn_ChildcmntID = (HiddenField)rptCommentReply.FindControl("hdn_ChildcmntID");
if (returnStatus() == true)
{
_obj.ReplyID = Convert.ToInt32(hdn_ChildcmntID.Value);
_obj.DeleteABCChildCommentByIdFront();
if (_obj.OperationStatus)
{
lbl_msg.Text = "Comment deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
BindComment();
}
}
else
{
lbl_msg.Text = "Please login to delete your comment.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Comment not deleted successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
private void BindComment()
{
_obj.GetABCComments();
rpt_Comment.DataSource = _obj.ABCCommentsTable;
rpt_Comment.DataBind();
}
// Child Comment Email
protected void btn_SendChildEMail_Click(object sender, EventArgs e)
{
try
{
if (Convert.ToString(Session["User"]) != null && Convert.ToString(Session["User"]) != "")
{
Button btn = (Button)sender;
RepeaterItem rptcomment = (RepeaterItem)btn.NamingContainer;
TextBox txt_childEmail = (TextBox)rptcomment.FindControl("txt_childEmail");
HiddenField hdn_Childusername = (HiddenField)rptcomment.FindControl("hdn_Childusername");
HiddenField hdn_Childuseremail = (HiddenField)rptcomment.FindControl("hdn_Childuseremail");
if (txt_childEmail.Text != "")
{
string body = "Dear " + hdn_Childusername.Value + ",<br/><br/>There is a new message for your comment.";
body += "<br/><br/><b> Message :</b> " + txt_childEmail.Text + "<br/><br/>You can reply on <b>" + Convert.ToString(Session["User"]) + "</b>.<br/><br/>";
body += "<br/>Thank You<br/>abc.in";
Class_Additionalresources.Sendmail(hdn_Childuseremail.Value, "New Message for ABC on abc.in", body, "New Message on abc.in", Convert.ToString(Session["User"]));
lbl_msg.Text = "Email sent successfully.";
lbl_msg.ForeColor = System.Drawing.Color.Green;
lbl_msg.Visible = true;
}
else
{
lbl_msg.Text = "Please enter your query to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
else
{
lbl_msg.Text = "Please login to send email.";
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
catch (Exception ex)
{
lbl_msg.Text = "Email not sent successfully. Error : " + ex.Message;
lbl_msg.ForeColor = System.Drawing.Color.Red;
lbl_msg.Visible = true;
}
}
// ---------------------- Child Reply -----------------------------
//protected void btn_childReply_Click(object sender, EventArgs e)
//{
// try
// {
// Button btn = (Button)sender;
// RepeaterItem child_rptcomment = (RepeaterItem)btn.NamingContainer;
// TextBox txt_childreply = (TextBox)child_rptcomment.FindControl("txt_childreply");
// HiddenField hdn_ChildcmntID = (HiddenField)child_rptcomment.FindControl("hdn_ChildcmntID");
// if (returnStatus() == true)
// {
// _obj.CommentsID = Convert.ToInt32(hdn_ChildcmntID.Value);
// _obj.EmailID = Convert.ToString(Session["User"]);
// _obj.CommentReplyType = "ABCComment";
// _obj.CommentReply = txt_childreply.Text;
// _obj.PostedDate = Convert.ToDateTime(DateTime.Now.ToString());
// _obj.AddCommentReplyFront();
// if (_obj.OperationStatus)
// {
// lbl_msg.Text = "Reply posted successfully.";
// lbl_msg.ForeColor = System.Drawing.Color.Green;
// lbl_msg.Visible = true;
// }
// }
// else
// {
// lbl_msg.Text = "Please login to post your reply.";
// lbl_msg.ForeColor = System.Drawing.Color.Red;
// lbl_msg.Visible = true;
// }
// }
// catch (Exception ex)
// {
// lbl_msg.Text = "Reply not posted successfully.";
// lbl_msg.ForeColor = System.Drawing.Color.Red;
// lbl_msg.Visible = true;
// }
//}
//void GetCaptcha()
//{
// HiddenField hdn_captchaID = (HiddenField)rpt_Comment.FindControl("hdn_captchaID");
// Image imgCaptcha = (Image)rpt_Comment.FindControl("imgCaptcha");
// try
// {
// Class_Captcha cap1 = new Class_Captcha();
// cap1.captcha();
// if (cap1.OperationStatus != false)
// {
// DataTable dt = new DataTable();
// dt = cap1.CaptchaTable;
// imgCaptcha.ImageUrl = dt.Rows[0]["CaptchaImagePath"].ToString();
// hdn_captchaID.Value = dt.Rows[0]["CaptchaId"].ToString();
// }
// }
// catch (Exception ex)
// {
// lblMsg.Text = "Error : " + ex.Message;
// lblMsg.ForeColor = System.Drawing.Color.Red;
// }
//}
}
In Design View
<%@ Page Title="Abc Comments : Abc.in" Language="C#" MasterPageFile="~/Abc_Front.master" AutoEventWireup="true" CodeFile="~/TestRepeater.aspx.cs" Inherits="AbcsComment" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script type="text/javascript">
function showpopup() {
var loggedin = '<%= returnStatus() %>';
if (loggedin == 'False') {
$("#newskloginForm").show();
$("#registerfromId1").hide();
$("#registerfromId2").show();
$("#registerfromId3").hide();
return false;
}
else return true;
}
function ShowEditComment() {
$(".recommentbtn04").show();
}
function HideEditComment() {
$(".recommentbtn04").hide();
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div class="quizBanner_container">
<img src="images/postcommentAbcs.jpg" style="width: 100%;" alt="Abc Comments" />
</div>
<div style="width: 100%; text-align: center; padding-top: 15px;">
<asp:Label ID="lbl_msg" runat="server" Visible="false"></asp:Label>
</div>
<div class="Repostcomment_container">
<asp:Repeater ID="rpt_Comment" runat="server">
<ItemTemplate>
<div class="newcommentbox01">
<div class="reviviewTop_container">
<div class="newcommmetboxImg">
<img src='<%# string.IsNullOrEmpty(Eval("ProfileImagePath").ToString()) ? Page.ResolveUrl("~/images/userclientimg.jpg") : Page.ResolveUrl(Eval("ProfileImagePath").ToString()) %>' alt="" />
</div>
<div class="newcommmetboxContant">
<asp:HiddenField ID="hdn_cmntID" runat="server" Value='<%#Eval("CommentsID") %>' />
<asp:HiddenField ID="hdn_username" runat="server" Value='<%# Eval("UserName") %>' />
<asp:HiddenField ID="hdn_useremail" runat="server" Value='<%# Eval("EmailID") %>' />
<div class="newcommentuser_name"><%#Eval("UserName") %></div>
<span style="font-size: 12px;">@Abc</span>
<div class="newcommentuser_date"><%#Eval("PostedDate","{0:d}") %> at <%#Eval("PostedDate","{0:t}") %></div>
<p class="more"><%# Eval("Description") %></p>
<div style="display: none;" id='<%#"inputreedit"+Eval("CommentsID")+"div" %>'>
<asp:TextBox ID="txt_editCommnt" runat="server" class="redesignForn_inputClassreedit" placeholder="Type your comment" TextMode="MultiLine"
Text='<%# Eval("Description").ToString() %>'></asp:TextBox>
<div style="width: 100%; float: left;">
<a href="javascript:void(0)" id='<%#"inputreedit"+Eval("CommentsID") +"di" %>' class="replysubmitBoxBtn02closeatag">Cancel</a>
<asp:Button ID="Btn_UpdateComment" runat="server" CssClass="replysubmitBoxBtn02close002" Text="Update" OnClick="Btn_UpdateComment_Click" />
</div>
</div>
</div>
<div class="reaplyComtainer_inpost">
<ul>
<li><a href="javascript:void(0)" id='<%#"inputreedit"+Eval("CommentsID") %>' class="recommentbtn04" style='<%# "display:" + (Convert.ToString(Eval("EmailID")) == Convert.ToString(Session["User"])?"block": "none") %>'>Edit</a></li>
<li>
<asp:LinkButton ID="Btn_DeleteCmnt" runat="server" Text="Delete" class="recommentbtn04" OnClick="Btn_DeleteCmnt_Click" OnClientClick="return confirm('Are you sure you want to delete this comment.')" Style='<%# "display:" + (Convert.ToString(Eval("EmailID")) == Convert.ToString(Session["User"])?"block": "none") %>' /></li>
<li><a href="javascript:void(0)" id='<%#"recommentbtn"+Eval("CommentsID") %>' class="recommentbtn">Reply</a></li>
<li><a href="javascript:void(0)" id='<%#"sendmailuserbtn"+Eval("CommentsID") %>' class="recommentbtn02">Send Mail</a></li>
</ul>
</div>
</div>
<!-------reply submit container------>
<!------- Inner Listing ------>
<asp:Repeater ID="rpt_InnerComment" runat="server" DataSourceID="SqlDataSource_CommentReply">
<ItemTemplate>
<div class="replysepratorCommnmain">
<div class="replysepratorCommnmain01">
<div class="newcommmetboxImg">
<img src='<%# string.IsNullOrEmpty(Eval("ProfileImagePath").ToString()) ? Page.ResolveUrl("~/images/userclientimg.jpg") : Page.ResolveUrl(Eval("ProfileImagePath").ToString()) %>' alt="" />
</div>
<div class="newcommmetboxContant">
<asp:HiddenField ID="hdn_ChildcmntID" runat="server" Value='<%#Eval("CommentReplyId") %>' />
<asp:HiddenField ID="hdn_Childusername" runat="server" Value='<%# Eval("FirstName") %>' />
<asp:HiddenField ID="hdn_Childuseremail" runat="server" Value='<%# Eval("ReplyBy") %>' />
<div class="newcommentuser_name"><%#Eval("FirstName") %></div>
<span style="font-size: 12px;">@Abc</span>
<div class="newcommentuser_date"><%#Eval("PostedDate") %></div>
<p class="more"><%#Eval("CommentReply") %></p>
<div style="display: none;" id='<%#"inputEditComntReply"+Eval("CommentReplyId")+"div" %>'>
<asp:TextBox ID="txt_editCommntReply" runat="server" class="redesignForn_inputClassreedit" placeholder="Type your comment" TextMode="MultiLine"
Text='<%# Eval("CommentReply").ToString() %>'></asp:TextBox>
<div style="width: 100%; float: left;">
<a href="javascript:void(0)" id='<%#"inputEditComntReply"+Eval("CommentReplyId") %>' class="replysubmitBoxBtn022closeatag">Cancel</a>
<asp:Button ID="Btn_UpdateCommentReply" runat="server" CssClass="replysubmitBoxBtn02close002" Text="Update" OnClick="Btn_UpdateCommentReply_Click" />
</div>
</div>
</div>
<div class="reaplyComtainer_inpost">
<ul>
<li><a href="javascript:void(0)" id='<%#"inputEditComntReply" + Eval("CommentReplyId") %>' class="recommentbtn05"
style='<%# "display:" + (Convert.ToString(Eval("ReplyBy")) == Convert.ToString(Session["User"])?"block": "none") %>'>Edit</a></li>
<li>
<asp:LinkButton ID="Btn_DeleteCmntReply" runat="server" Text="Delete" class="recommentbtn04" OnClick="Btn_DeleteCmntReply_Click" OnClientClick="return confirm('Are you sure you want to delete this comment.')" Style='<%# "display:" + (Convert.ToString(Eval("ReplyBy")) == Convert.ToString(Session["User"])?"block": "none") %>' /></li>
<%--<li><a href="javascript:void(0)" id='<%#"childcommentbtn_"+Eval("CommentsID") %>' class="recommentbtn">Reply</a></li>--%>
<li><a href="javascript:void(0)" class="recommentbtn02" id='<%#"childsendmailbtn_"+Eval("CommentsID") %>'>Send Mail</a></li>
</ul>
</div>
</div>
<%-- <div class="hiddencommentBoxchild" id='<%#"childcommentbtn_"+Eval("CommentsID")+"div" %>'>
<div class="replysepratorCommnet02">
<asp:TextBox ID="txt_childreply" runat="server" class="replypostcommentFeil" placeholder="Type Your Comments" TextMode="MultiLine"></asp:TextBox>
<a href="javascript:void(0)" class="replysubmitBoxBtn02close" id="childcommentboxclose" rel='<%#"childcommentbtn_"+Eval("CommentsID") %>'>Close</a>
<asp:Button ID="btn_childReply" class="replysubmitBoxBtn02" runat="server" Text="Submit" OnClick="btn_childReply_Click" />
</div>
</div>--%>
<!-----send mail comment user----->
<div class="sendmailusercomment" id='<%#"childsendmailbtn_"+Eval("CommentsID")+"div" %>'>
<div class="sendmailInner">
<%--<input type="text" class="replypostcommentFeil02" placeholder="Email Address" />--%>
<asp:TextBox ID="txt_childEmail" runat="server" CssClass="replypostcommentFeil02" placeholder="Email Address"></asp:TextBox>
<%-- <button type="submit" value="" class="replysubmitBoxBtn03">Submit</button>--%>
<asp:Button ID="btn_SendChildEMail" class="replysubmitBoxBtn03" runat="server" Text="Send Mail" OnClick="btn_SendChildEMail_Click"
OnClientClick="return showpopup()" />
</div>
</div>
<!-----send mail comment user----->
</div>
</ItemTemplate>
</asp:Repeater>
<asp:SqlDataSource ID="SqlDataSource_CommentReply" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SP_GetAllCommentReplyByCommentIdAndType" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="hdn_cmntID" Name="CommentId" DefaultValue="-1" ConvertEmptyStringToNull="true" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<!------- Inner Listing ------>
<!-------reply submit container------>
<!-----send mail comment user----->
<div class="sendmailusercomment" id='<%#"sendmailuserbtn"+Eval("CommentsID")+"div" %>'>
<div class="sendmailInner">
<asp:TextBox ID="txt_email" runat="server" class="replypostcommentFeil02" placeholder="Message"></asp:TextBox>
<asp:Button ID="btn_sendmail" runat="server" Text="Send Mail" class="replysubmitBoxBtn03" OnClick="btnSendMail_Click" OnClientClick="return showpopup()" />
</div>
</div>
<!-----send mail comment user----->
<div class="hiddencommentBox" id='<%#"recommentbtn"+Eval("CommentsID")+"div" %>'>
<asp:TextBox ID="txt_reply" runat="server" Placeholder="Type your comment" TextMode="MultiLine" CssClass="redesignForn_inputClass"></asp:TextBox>
<a href="javascript:void(0)" class="replysubmitBoxBtn02close" id="closebtncomment" rel='<%#"recommentbtn"+Eval("CommentsID") %>'>Cancel</a>
<asp:Button ID="btn_replysubmit" CssClass="replysubmitBoxBtn02" Text="Post" OnClick="btn_replySubmit_Click" runat="server" OnClientClick="return showpopup()" />
</div>
</div>
</ItemTemplate>
</asp:Repeater>
</div>
<script type="text/javascript">
$(document).ready(function () {
$(".recommentbtn").click(function () {
var divid = "#" + $(this).attr("id") + "div";
$(divid).show();
});
$(".replysubmitBoxBtn02close").click(function () {
var divid1 = "#" + $(this).attr("rel") + "div";
$(divid1).hide();
});
$(".recommentbtn02").click(function () {
var divid2 = "#" + $(this).attr("id") + "div";
$(divid2).show();
});
$(".recommentbtn04").click(function () {
var divid3 = "#" + $(this).attr("id") + "div";
$(divid3).show();
});
$(".replysubmitBoxBtn02closeatag").click(function () {
var divid4 = "#" + $(this).attr("id") + "v";
$(divid4).hide();
});
$(".replysubmitBoxBtn022closeatag").click(function () {
var divid5 = "#" + $(this).attr("id") + "div";
$(divid5).hide();
});
$(".recommentbtn05").click(function () {
var divid6 = "#" + $(this).attr("id") + "div";
$(divid6).show();
});
});
</script>
<script type="text/javascript">
$(document).ready(function () {
// Configure/customize these variables.
var showChar = 100; // How many characters are shown by default
var ellipsestext = "...";
var moretext = "Show more >";
var lesstext = "Show less";
$('.more').each(function () {
var content = $(this).html();
if (content.length > showChar) {
var c = content.substr(0, showChar);
var h = content.substr(showChar, content.length - showChar);
var html = c + '<span class="moreellipses">' + ellipsestext + ' </span><span class="morecontent"><span>' + h + '</span> <a href="" class="morelink">' + moretext + '</a></span>';
$(this).html(html);
}
});
$(".morelink").click(function () {
if ($(this).hasClass("less")) {
$(this).removeClass("less");
$(this).html(moretext);
} else {
$(this).addClass("less");
$(this).html(lesstext);
}
$(this).parent().prev().toggle();
$(this).prev().toggle();
return false;
});
});
</script>
</asp:Content>
No comments:
Post a Comment