Here i am getting values from database to outer repeater in page load event, and the inner repeater values are populated in outer repeater_Item_Databound event.
Now i want to delete some data of inner repeater on click event of a button that is in inner repeater.
Give me the logic please.
<asp:Repeater ID="rptrnotes" runat="server"
OnItemCommand="rptrnotes_ItemCommand"
OnItemDataBound="rptrnotes_ItemDataBound">
<ItemTemplate>
<div class="col-md-12">
<div class="card comp-card" style="border: 1px groove black;">
<div class="card-body">
<div class="row align-items-center">
<div class="col">
<h6 class="m-b-1" style="display:none;">
<%# Convert.ToDateTime(Eval("Created_Date")).ToString("dd-MM-yy") %></h6>
<h6 class="m-b-2" style="font-family:'Times New Roman'">
<%# Eval("Notes_Description") %>
</h6>
<p class="m-b-0" style="font-size:x-small">
<%# Eval("Created_By") %> created a note on <%# Eval("Created_Date") %>
</p>
<br />
<asp:Label ID="lblleadnoteid" runat="server" Visible="false" Text='<%# Eval("LN_ID") %>'></asp:Label>
</div>
<div class="col-auto">
<asp:Button ID="btndeletenote" runat="server" CssClass="btn waves-effect waves-light btn-danger" Text="Delete" OnClick="btndeletenote_Click"/>
</div>
<div class="col-auto">
<asp:Button ID="btneditnote" runat="server" class="btn waves-effect waves-light btn-success" Text="Edit" OnClick="btneditnote_Click"/>
</div>
</div>
<div class="card-block">
<div class="page-header-breadcrumb">
<div id="divreplysection" runat="server" visible="false">
<div class="form-group row">
<div class="col-sm-12">
<asp:TextBox ID="txtrepli" runat="server" TextMode="MultiLine" Rows="3" Columns="5" CssClass="form-control" MaxLength="500"></asp:TextBox>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3">
<asp:Button ID="btnsavereply" runat="server" CssClass="btn btn-success waves-effect waves-light" Text="Save Reply" CommandName="SaveReply"/>
</div>
</div>
</div>
<div id="divreplylistsection" runat="server">
<asp:Repeater ID="gvreplylist" runat="server"
OnItemCommand="gvreplylist_ItemCommand"
ClientIDMode="Static">
<ItemTemplate>
<ul class="breadcrumb">
<li class="breadcrumb-item">
<div class="row">
<div class="col-md-10">
<%# Eval("Reply_Description") %>
</div>
<div class="col-md-1">
<asp:Button ID="btndeletenotereply" runat="server"
CssClass="btn waves-effect waves-light btn-danger"
Text="X"
CommandArgument='<%# Container.ItemIndex %>'
CommandName="DeleteNotesReplyDiv"/>
</div>
</div>
</li>
</ul>
<asp:Label ID="lblleadnotereplyid" runat="server" Visible="false" Text='<%# Eval("LNR_ID") %>'></asp:Label>
<asp:Label ID="lblleadnoteparentid" runat="server" Visible="false" Text='<%# Eval("Lead_Note_ID") %>'></asp:Label>
</ItemTemplate>
</asp:Repeater>
</div>
</div>
</div>
<hr />
<asp:LinkButton ID="replynoteslink" runat="server" CssClass="btn btn-mat waves-effect waves-light btn-info" CommandName="NotesReplyDiv">Reply</asp:LinkButton>
</div>
</div>
</div>
</ItemTemplate>
</asp:Repeater>
public void BindLeadNotesList()
{
try
{
Lead_Notes_BAL bo = new Lead_Notes_BAL();
bo.Procedure = "SP_Lead_Notes";
bo.Action = "SELECT_Lead_Notes";
bo.Lead_ID = Convert.ToInt32(Request.QueryString["LEADID"].ToString());
Lead_Notes_DAL dal = new Lead_Notes_DAL();
DataTable dt = dal.GetLeadNotesFilterDetails(bo);
if (dt.Rows.Count > 0)
{
NotesCount = dt.Rows.Count;
div_notes_empty.Visible = false;
rptrnotes.DataSource = dt;
rptrnotes.DataBind();
}
else
{
rptrnotes.DataSource = null;
rptrnotes.DataBind();
}
}
catch (Exception ex)
{
//ErrorShow(ex.ToString(), null);
}
}
protected void rptrnotes_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Repeater ChildGridView = (Repeater)e.Item.FindControl("gvreplylist");
Label lblleadnoteid = e.Item.FindControl("lblleadnoteid") as Label;
ChildGridView.DataSource = GetNotesReply(Convert.ToInt32(lblleadnoteid.Text));
ChildGridView.DataBind();
}
}
public DataTable GetNotesReply(int lead_note_id)
{
DataTable dt = new DataTable();
try
{
Lead_Notes_Reply_BAL bo = new Lead_Notes_Reply_BAL();
bo.Operation = "SELECT_Lead_Notes_Reply";
bo.Procedure = "SP_Lead_Notes_Reply";
bo.Lead_Note_ID = lead_note_id;
Lead_Notes_Reply_DAL dal = new Lead_Notes_Reply_DAL();
dt = dal.GetLeadLeadNotesReplyFilterDetails(bo);
}
catch (Exception ex)
{
ErrorShow(ex.Message, null);
}
return dt;
}