if (!this.IsPostBack) {
num = 4;ViewState["num"] = num; BindRepeater(num);
num = 4;
ViewState["num"] = num;
BindRepeater(num);
}
DataTable dt = new DataTable(); SqlCommand cmd = null; SqlDataAdapter adp = null;
try {
int rCount = rowCount(); if (numOfRows > rCount) {
int rCount = rowCount();
if (numOfRows > rCount)
{
btnLoadMore.Visible = false;
cmd = new SqlCommand("GetStudentDetails_SP", con); cmd.Parameters.AddWithValue("@topVal", numOfRows); cmd.CommandType = CommandType.StoredProcedure; adp = new SqlDataAdapter(cmd); adp.Fill(dt);
cmd = new SqlCommand("GetStudentDetails_SP", con);
cmd.Parameters.AddWithValue("@topVal", numOfRows);
cmd.CommandType = CommandType.StoredProcedure;
adp = new SqlDataAdapter(cmd);
adp.Fill(dt);
if (dt.Rows.Count > 0) {
if (dt.Rows.Count > 0)
rptStudentDetails.DataSource = dt; rptStudentDetails.DataBind();
rptStudentDetails.DataSource = dt;
rptStudentDetails.DataBind();
} else {
else
rptStudentDetails.DataSource = null; rptStudentDetails.DataBind();
rptStudentDetails.DataSource = null;
} catch (Exception ex) {
ScriptManager.RegisterStartupScript(this, this.GetType(), "Message", "alert('Oops!! Error occured: " + ex.Message.ToString() + "');", true);
} finally {
con.Close(); cmd.Dispose(); adp = null; dt.Clear(); dt.Dispose();
con.Close();
cmd.Dispose();
adp = null;
dt.Clear();
dt.Dispose();
int NoOfRows = 0; SqlCommand cmd = new SqlCommand("GetStudentDetailsCount_SP", con); cmd.CommandType = CommandType.StoredProcedure; try {
con.Open(); NoOfRows = Convert.ToInt32(cmd.ExecuteScalar());
con.Open();
NoOfRows = Convert.ToInt32(cmd.ExecuteScalar());
con.Close(); cmd.Dispose();
int numVal = Convert.ToInt32(ViewState["num"]) + 4; BindRepeater(numVal); ViewState["num"] = numVal;
<asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<fieldset style="width:100%;"> <asp:Repeater runat="server" ID="rptStudentDetails">
<HeaderTemplate> </HeaderTemplate>
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate> <div class="single-product">
<ItemTemplate>
<div class="single-product">
<a href=""><img src="images/p1.png" alt="Item Image"/></a> <p class="productname"><a><%#Eval("SM_NAME") %></a></p> <asp:Button ID="Button1" runat="server" Text="View All" Height="24" Width="75" BackColor="#50A748" ForeColor="#FFFFFF" CssClass="product_button" />
<a href=""><img src="images/p1.png" alt="Item Image"/></a>
<p class="productname"><a><%#Eval("SM_NAME") %></a></p>
<asp:Button ID="Button1" runat="server" Text="View All" Height="24" Width="75" BackColor="#50A748" ForeColor="#FFFFFF" CssClass="product_button" />
</div> </ItemTemplate>
</div>
</ItemTemplate>
<FooterTemplate> </FooterTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
</fieldset>
<div style="width: 59%; height: 50px; padding-top: 10px; padding-left: 42%; float: left;">
<asp:Button ID="btnLoadMore" runat="server" Text="Load More Data" onclick="btnLoadMore_Click" /> <asp:UpdateProgress runat="server" ID="UpdateProgress1" DisplayAfter="10">
<asp:Button ID="btnLoadMore" runat="server" Text="Load More Data"
onclick="btnLoadMore_Click" />
<asp:UpdateProgress runat="server" ID="UpdateProgress1" DisplayAfter="10">
<ProgressTemplate>
<img src="images/loading.gif" alt="wait image" />
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>