<%# Eval("Name") %> | |
|---|---|
<%# Eval("ContentType") %> | |
Image: | Height="75px" Width="75px"/> |
Name: <%# Eval("Name")%> | |
ContentType: <%# Eval("ContentType")%> | |
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = this.GetData();
dlCustomers.DataSource = dt;
dlCustomers.DataBind();
}
}
private DataTable GetData()
{
string conString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;
using (SqlConnection con = new SqlConnection(conString))
{
using (SqlCommand cmd = new SqlCommand("SELECT id, Name, ContentType,Data from tblFiles "))
{
using (SqlDataAdapter sda = new SqlDataAdapter())
{
cmd.Connection = con;
sda.SelectCommand = cmd;
using (DataTable dt = new DataTable())
{
sda.Fill(dt);
return dt;
}
}
}
}
}
varun sharmaPosted Jun 2, 2018, 12:44 PM
shafeek ckPosted Apr 7, 2018, 9:31 AM