Link to home
Start Free TrialLog in
Avatar of simshp
simshpFlag for Israel

asked on

Get fileupload filename from edittemplate in listview

How would I get the Filename of a FileUpload control which is in an edittemplate of a listview ... I need to store the value in a db. The listview is populated with a sqldatasource, which handles all the selection and updating, so I am not sure how to capture its value on the listview update (how to bind it to datasource)  ...
I have tried what I have attached, but not working.

Thanks you
protected void ImageListings_OnUpdating(object sender, SqlDataSourceCommandEventArgs e)
        {
            
            FileUpload FileToUpload = (lvImages.FindControl("ImageEditFile") as FileUpload);
            if (FileToUpload.HasFile)
             {
                 e.Command.Parameters["@image"].Value = FileToUpload.FileName;
             }
        }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of guru_sami
guru_sami
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of simshp

ASKER

Thanks that did it ... just needed to remove the @ from @images