User-2117647399 posted
I have added an HtmlInputFile HtmlControl to my .aspx page using a "devicespecific" mobile control as follows:
<mobile:panel id="pnlAttachment" runat="server">
<mobile:devicespecific id="dspAttachment" runat="server">
<choice>
<contenttemplate>
<input id="fleAttachment" type="file" size="60" runat="server">
</contenttemplate>
</choice>
</mobile:devicespecific>
</mobile:panel>
I then try to access the value of the HtmlInputFile control in my C# code as follows:
System.Web.UI.HtmlControls.HtmlInputFile fleAttachment = (System.Web.UI.HtmlControls.HtmlInputFile) pnlAttachment.Controls[0].FindControl("fleAttachment");
if (fleAttachment.Value.Trim() != string.Empty)
{
//process attachment
}
I have used the same technique to obtain the value entered for a multiline TextBox WebControl object, but for some reason the "Value" property of my HtmlInputFile object is always an empty string, even if a value is set on the client by browsing to a file.
Does anyone have any idea why the value is not being passed back to the server?