GetTheText\TemplateField

  • Thread starter Thread starter gh
  • Start date Start date
G

gh

Below is the code for my GriView Columns. When the user clicks the
update button I am going to need to get the value of the FileUpload text
box, for the edited row. I was thinking of using the RowUpdating event
for this. How do I get at the FileUpload Text.

TIA

<Columns>
<asp:BoundField readonly="True" datafield="ExternalId"
sortexpression="ExternalId" headertext="ExternalId"></asp:BoundField>
<asp:BoundField datafield="PhotoID"
sortexpression="PhotoID" headertext="PhotoID"></asp:BoundField>
<asp:BoundField datafield="PhotoDate"
sortexpression="PhotoDate" headertext="PhotoDate"></asp:BoundField>
<asp:BoundField datafield="Description"
sortexpression="Description" headertext="Description"></asp:BoundField>
<asp:BoundField datafield="Notes" sortexpression="Notes"
headertext="Notes"></asp:BoundField>
<asp:BoundField datafield="Photographer"
sortexpression="Photographer" headertext="Photographer"></asp:BoundField>
<asp:BoundField datafield="PhotographerWebsite"
sortexpression="PhotographerWebsite"
headertext="PhotographerWebsite"></asp:BoundField>
<asp:BoundField datafield="PhotoPath"
sortexpression="PhotoPath" headertext="PhotoPath"></asp:BoundField>
<asp:TemplateField headertext="Select File">
<ItemTemplate>
<asp:FileUpload id="FileUpload1"
runat="server"></asp:FileUpload>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField showeditbutton="True"></asp:CommandField>
</Columns>
 
http://www.dotnetspider.com/kb/Article2098.aspx

From link above.

If there is only a single file control then we can use the PostedFile
property of the file control to upload files.
This property is of type HttpPostedFile class and contains the following
methods and properties which aids file uploading.
FileName -- Returns the full path and name of the uploaded file.
ContentType -- Returns the full path and name of the uploaded file
ContentLength -- The size in bytes of the uploaded file.
Methods used are SaveAs(Path) Saves the uploaded file to the specified path.
First paste this inside form tag for file field
 
Back
Top