Hii,
i have a datalist in my page containing a image button as item template.The design page is as follows
<asp:DataList id="ddlist" runat="server" RepeatDirection="Horizontal" Width="30px" Height="134px" RepeatColumns="5" CellPadding="1" CellSpacing="5" >
<ItemTemplate>
<table>
<tr><td> <asp:ImageButton ID="img" runat="server" Height="75" Width="100" ImageUrl='<%#DataBinder.Eval(Container.DataItem,"filename")%>'></asp:ImageButton></td></tr>
</table>
</ItemTemplate>
</asp:DataList>
th ecode behind is as follows
public void attachimages()
{
int i;
strgrt="bday";
string[] FileArray;
DataTable dlist = new DataTable();
dlist.Columns.Add("filename");
dlist.Columns.Add("picture");
System.IO.DirectoryInfo folder = new System.IO.DirectoryInfo(Server.MapPath("~\\source\\Live\\student\\" + strgrt + "\\small\\"));
FileArray = System.IO.Directory.GetFiles(Server.MapPath("~\\source\\Live\\student\\ecards\\" + strgrt + "\\small\\"));
for (i = 0; i <= FileArray.Length - 1; i++)
{
DataRow r = dlist.NewRow();
r[0] = (string)FileArray;
r[1] = "Picture" + Convert.ToString(i + 1);
dlist.Rows.Add(r);
}
ds.Tables.Add(dlist);
ddlist.DataSource = ds;
ddlist.DataBind();
}
iam not able to get the images displayed but iam getting the exact no of images displayed in the page present in the folder.need u r help as soon as possible