Saturday, March 24, 2012

please help , build datatable of FileUpload , or DataColumn , datatype of FileUpload

hello , I'm trying to create tatatable to store list of fileuploads to use them to patch upoad

my problem is to create the (DataColum)

this is my code

1DataTable My_Dt =new DataTable();23 DataColumn myDataColumn =new DataColumn("ColName", Type.GetType("System.Web.UI.WebControls.FileUpload",true));4 My_Dt.Columns.Add(myDataColumn);5
 It gives me error
/*****/ 
 Could not load type 'System.Web.UI.WebControls.FileUpload' from assembly 'App_Web_5dgo8bbt, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'.
 /******/
so anyone provide any help to do this ?
thanks in advance,. 
 

I don't think you can create a datacolumn with a datatype of FileUpload control.
If you are trying contain the file name, then all you need is a text column. Then, when populating your datatable, add in the string equivalent of the filename.
Hope this helps.


well, thank you rof your response

I got it

let me share it with you

DataTable My_Dt = new DataTable();
Type type = FileUpload1.GetType();//it's in my form
DataColumn myDataColumn = new DataColumn("ColName", type);
My_Dt.Columns.Add(myDataColumn);

I hope this helps you in future, lol

0 comments:

Post a Comment