Friday, 8 November 2019

Dynamically Bind Repeater Control In ASP.NET From


Dynamically Bind Repeater Control In ASP.NET 

See below

 <asp:Repeater ID="Repeater1" runat="server">
                <ItemTemplate>
                    <table class="table table-bordered">
                        <tr>
                            <td style="width: 20%;">
                                <img alt="" width="150" class="img-thumbnail" src='<%#Eval("Profile_Picture")%>' />
                            </td>
                       
                        </tr>
                    </table>
                </ItemTemplate>
            </asp:Repeater>

 private void BindRepeator()
    {
        con.Open();
        try
        {

            SqlCommand cmd = new SqlCommand("Select * from Student_Master", con);
            SqlDataAdapter sda = new SqlDataAdapter(cmd);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
        }
        catch (SqlException)
        {

        }
        finally
        {
            con.Close();
        }
     
    }
This will help you

No comments:

Post a Comment