G
Guest
I keep getting an error that my listbox control is incompatible with the
source as follows:
The base class includes the field 'IMGList', but its type
(System.IO.DirectoryInfo) is not compatible with the type of control
(System.Web.UI.WebControls.ListBox).
the following is the codebehind:
public class EventBroadcast : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Table EBroadcast;
protected System.Web.UI.WebControls.LinkButton ImageAttach;
protected System.IO.DirectoryInfo ImgList;
protected System.Web.UI.WebControls.ListBox IMGList;
public string stringpath
{
get{return Server.MapPath(@"..\BroadcastIMG\");}
}
private void Page_Load(object sender, System.EventArgs e)
ImageAttach.Attributes.Add("onClick","javascript:window.open('../Secured/EmailIMG.aspx','imgWindow','width=700, height=275');");
GetDirPath(stringpath);
}
public void GetDirPath(string Path)
{
ImgList=new DirectoryInfo(Path);
FileInfo[] files=ImgList.GetFiles();
foreach(FileInfo file in files)
{
IMGList.Items.Add("Name");
}
}
what am I missing here? How to make the DirectoryInfo compatible with a
listbox?
Sam-
source as follows:
The base class includes the field 'IMGList', but its type
(System.IO.DirectoryInfo) is not compatible with the type of control
(System.Web.UI.WebControls.ListBox).
the following is the codebehind:
public class EventBroadcast : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Table EBroadcast;
protected System.Web.UI.WebControls.LinkButton ImageAttach;
protected System.IO.DirectoryInfo ImgList;
protected System.Web.UI.WebControls.ListBox IMGList;
public string stringpath
{
get{return Server.MapPath(@"..\BroadcastIMG\");}
}
private void Page_Load(object sender, System.EventArgs e)
ImageAttach.Attributes.Add("onClick","javascript:window.open('../Secured/EmailIMG.aspx','imgWindow','width=700, height=275');");
GetDirPath(stringpath);
}
public void GetDirPath(string Path)
{
ImgList=new DirectoryInfo(Path);
FileInfo[] files=ImgList.GetFiles();
foreach(FileInfo file in files)
{
IMGList.Items.Add("Name");
}
}
what am I missing here? How to make the DirectoryInfo compatible with a
listbox?
Sam-