I am having Repeater bind with database on Page_Load. Repeater is placed between UpdatePanel. Having linkbutton on each row. When click on linkbutton page going to postback. Why does repeater page going to postback if repeater kept under UpdatePanel?
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="row">
<asp:Repeater ID="repeater1" runat="server">
<HeaderTemplate>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Post</th>
<th>Sanctioned</th>
<th>Filled</th>
<%--<th>Surplus/Deployed</th>--%>
<th>Vacant</th>
<th>Paydrawal Orders</th>
<th>Supernumerary Post</th>
<th>Deployed Working Without Post</th>
<th>Inposition Only</th>
<th>Non-Teaching<br />In-position Samagra</th>
<th>Remarks</th>
<th></th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<%# Eval("sanctioned").ToString() == "0" ? "<tr style='display:none;'>" : "<tr>" %>
<td><asp:Label ID="LabelPostname" runat="server" Text='<%# Server.HtmlEncode(Eval("postname").ToString()) %>' Font-Bold="true"></asp:Label>
<asp:Label ID="LabelPostid" runat="server" Text='<%# Server.HtmlEncode(Eval("post_id").ToString()) %>' Visible="false"></asp:Label></td>
<td><%# Server.HtmlEncode(Eval("sanctioned").ToString()) %></td>
<td><%# Server.HtmlEncode(Eval("inposition").ToString()) %></td>
<%--<td><%# Server.HtmlEncode(Eval("surplusdeployed").ToString()) %></td>--%>
<td><%# Server.HtmlEncode(Eval("vacant").ToString()) %></td>
<td><asp:TextBox ID="TextBoxPaydrawalOrders" runat="server" Text='<%# Server.HtmlEncode(Eval("PaydrawalOrders").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td><asp:TextBox ID="TextBoxSupernumeraryPost" runat="server" Text='<%# Server.HtmlEncode(Eval("SupernumeraryPost").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td><asp:TextBox ID="TextBoxDeployedWorkingwithoutpost" runat="server" Text='<%# Server.HtmlEncode(Eval("DeployedWorkingWithoutPost").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td><asp:TextBox ID="TextBoxInpositionOnly" runat="server" Text='<%# Server.HtmlEncode(Eval("InpositionOnly").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td><asp:TextBox ID="TextBoxNonTeachingInpositionSamagra" runat="server" Text='<%# Server.HtmlEncode(Eval("NonTeachingInpositionSamagra").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td><asp:TextBox ID="TextBoxRemarks" runat="server" Text='<%# Server.HtmlEncode(Eval("Remarks").ToString()) %>' CssClass="form-control" MaxLength="300" placeholder="Max 300 Chars" Width="120px" TextMode="MultiLine" Height="50px" style="font-size:12px;"></asp:TextBox></td>
<td><asp:LinkButton ID="LinkButtonUpdate" OnClick="LinkButtonUpdate_Click" runat="server" CssClass="btn btn-sm btn-primary">Save</asp:LinkButton></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</ContentTemplate>
</asp:UpdatePanel>
HTML
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebFormProject.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
th {
width: 140px;
}
</style>
</head>
<body>
<div>
<form runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="row">
<asp:Repeater ID="repeater1" runat="server">
<HeaderTemplate>
<table class="table table-bordered">
<thead class="thead-light">
<tr>
<th>Post</th>
<th>Sanctioned</th>
<th>Filled</th>
<th>Vacant</th>
<th>Paydrawal Orders</th>
<th>Supernumerary Post</th>
<th>Deployed Working Without Post</th>
<th>Inposition Only</th>
<th>Non-Teaching<br />
In-position Samagra</th>
<th>Remarks</th>
<th></th>
</tr>
</thead>
<tbody>
</HeaderTemplate>
<ItemTemplate>
<%# Eval("sanctioned").ToString() == "0" ? "<tr style='display:none;'>" : "<tr>" %>
<td>
<asp:Label ID="LabelPostname" runat="server" Text='<%# Server.HtmlEncode(Eval("postname").ToString()) %>' Font-Bold="true"></asp:Label>
<asp:Label ID="LabelPostid" runat="server" Text='<%# Server.HtmlEncode(Eval("post_id").ToString()) %>' Visible="false"></asp:Label></td>
<td><%# Server.HtmlEncode(Eval("sanctioned").ToString()) %></td>
<td><%# Server.HtmlEncode(Eval("inposition").ToString()) %></td>
<td><%# Server.HtmlEncode(Eval("vacant").ToString()) %></td>
<td>
<asp:TextBox ID="TextBoxPaydrawalOrders" runat="server" Text='<%# Server.HtmlEncode(Eval("PaydrawalOrders").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBoxSupernumeraryPost" runat="server" Text='<%# Server.HtmlEncode(Eval("SupernumeraryPost").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBoxDeployedWorkingwithoutpost" runat="server" Text='<%# Server.HtmlEncode(Eval("DeployedWorkingWithoutPost").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBoxInpositionOnly" runat="server" Text='<%# Server.HtmlEncode(Eval("InpositionOnly").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBoxNonTeachingInpositionSamagra" runat="server" Text='<%# Server.HtmlEncode(Eval("NonTeachingInpositionSamagra").ToString()) %>' CssClass="form-control" MaxLength="3"></asp:TextBox></td>
<td>
<asp:TextBox ID="TextBoxRemarks" runat="server" Text='<%# Server.HtmlEncode(Eval("Remarks").ToString()) %>' CssClass="form-control" MaxLength="300" placeholder="Max 300 Chars" Width="120px" TextMode="MultiLine" Height="50px" Style="font-size: 12px;"></asp:TextBox></td>
<td>
<asp:LinkButton ID="LinkButtonUpdate" OnClick="LinkButtonUpdate_Click" runat="server" CssClass="btn btn-sm btn-primary">Save</asp:LinkButton></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</tbody>
</table>
</FooterTemplate>
</asp:Repeater>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</div>
</body>
</html>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
GetData();
}
}
private void GetData()
{
try
{
DataTable dt = new DataTable();
dt.Columns.Add("sanctioned");
dt.Columns.Add("postname");
dt.Columns.Add("post_id");
dt.Columns.Add("inposition");
dt.Columns.Add("vacant");
dt.Columns.Add("PaydrawalOrders");
dt.Columns.Add("SupernumeraryPost");
dt.Columns.Add("DeployedWorkingWithoutPost");
dt.Columns.Add("InpositionOnly");
dt.Columns.Add("NonTeachingInpositionSamagra");
dt.Columns.Add("Remarks");
dt.Rows.Add("sanctioned-1", "postname", "post_id", "inposition", "vacant", "PaydrawalOrders", "SupernumeraryPost", "DeployedWorkingWithoutPost", "InpositionOnly", "NonTeachingInpositionSamagra", "Remarks");
dt.Rows.Add("sanctioned-2", "postname", "post_id", "inposition", "vacant", "PaydrawalOrders", "SupernumeraryPost", "DeployedWorkingWithoutPost", "InpositionOnly", "NonTeachingInpositionSamagra", "Remarks");
dt.Rows.Add("sanctioned-3", "postname", "post_id", "inposition", "vacant", "PaydrawalOrders", "SupernumeraryPost", "DeployedWorkingWithoutPost", "InpositionOnly", "NonTeachingInpositionSamagra", "Remarks");
dt.Rows.Add("sanctioned-4", "postname", "post_id", "inposition", "vacant", "PaydrawalOrders", "SupernumeraryPost", "DeployedWorkingWithoutPost", "InpositionOnly", "NonTeachingInpositionSamagra", "Remarks");
dt.Rows.Add("sanctioned-5", "postname", "post_id", "inposition", "vacant", "PaydrawalOrders", "SupernumeraryPost", "DeployedWorkingWithoutPost", "InpositionOnly", "NonTeachingInpositionSamagra", "Remarks");
repeater1.DataSource = dt;
repeater1.DataBind();
}
catch (Exception ex)
{
throw;
}
}
protected void LinkButtonUpdate_Click(object sender, EventArgs e)
{
}