FormView + FileUpload - can I change a bound field based on the fileupload?
<p>I have a FormView control in an ASP.NET 2.0 app.  I've got the database storing a filename (a person's picture) in a column.  I can't bind the value of the column to a fileupload control - so I'm trying to use a hidden form field.  Here's what I have:</p>

<pre><code>&lt;asp:HiddenField ID="pictureLink" runat="server" Value='&lt;%# Bind("pictureLink") %&gt;' /&gt;
&lt;asp:FileUpload ID="pic" runat="server" /&gt;
</code></pre>

<p>Code Behind:</p>

<pre><code>//ItemUpdating event handler
void do_update(object sender, FormViewUpdateEventArgs e)
{
    FileUpload newpic = (FileUpload)profile_edit.FindControl("pic");
    if (newpic.HasFile)
    {
      //do a bunch of file uploading "stuff" which makes a new file name
      e.Keys["pictureLink"] = new_filename;
    }
}
</code></pre>

<p>My goal is to update the hidden form field's value to the newly updated file name so the database is properly updated.</p>

<p>I think I'm close - but it seems like I can't programmatically alter any of the bound data fields after-the-fact.</p>

<p>I've tried using javascript to change the control - but the new file name will actually be different than what they upload; which javascript can't necessarily "predict" and reliably put the correct file name into the hidden form field</p>

<p>Any suggestions?</p>

<p>Thanks</p>
