I'm working in a solution created in ASP.NET - Framework 3.5.
This solution has a WebForm (child from a Site.master
) with contains multiple UpdatePanels
, TabContainer
and a single AsyncFileUpload
control.
Locally (i.e. in developer enviroment), the WebForm loads and works successfully, but, once published the WebForm in an different server - when a file is selected (by using the AsyncFileUpload
control), the following message shows:
Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "AjaxControlToolkit.Properties.Resources.resources" was correctly embedded or linked into assembly "AjaxControlToolkit" at compile time, or that all the satellite assemblies required are loadable and fully signed.
In my local developer enviroment, this error does not occur and the file can be selected and processed as expected.
While searching for the causes of this error, most of the suggestions are:
ScriptManager
or ToolkitScriptManager
- source. When tried this option (by adding any of those ScriptManager controls), the WebForm is loaded blank and in the output window - shown in runtime - says: only a single ScriptManager can be added in the page - this is correct, since the ToolkitScriptManager
control is already in the Site.master.AjaxControlToolkit.dll
is on the bin
folder. Checked also and this dll is in the bin
folder.I also tried:
AjaxControlToolkit.dll
and AjaxControlToolkit.resources.dll
is on the bin folder. Those dlls are in the bin
folder.AsyncFileUpload
for FileUpload
, but, since this WebForm already uses UpdatePanels
, the FileUpload wont work for security reasons - as I tested and the results of Google says so (like this answer, for example).Trigger
and PostBackTrigger
or AsyncPostBackTrigger
. For this reason, I gave up and ended using the AsyncFileUpload
control.What else can be done for check the missing resources and/or the cause of this error and fix this issue?
I couldn't solve the problem with the AsyncFileUpload
control, but, as a good side, while searching about how to solve this issue, I tried again changing the code and use both FileUpload
and UpdatePanel
controls.
I came across with this entry - in spanish where it links another thread on another page where it's explained how to use both FileUpload
and UpdatePanel
controls.
The linked thread is this: Using FileUpload Control inside ASP.Net AJAX UpdatePanel Control
I changed my code for (instead using AsyncFileUpload
) for use FileUpload
inside a UpdatePanel
, but, here is the catch:
For select and send the file to the server side, the Button that sends the file (once selected with the
FileUpload
control) must have its ownUpdatePanel
with its respectiveTriggers
tag.
Example: I'm using here a LinkButton
control, but, with a Button
control should work flawlessly.
In the .aspx:
<asp:UpdatePanel ID="updPnlbtnFileUploadDevols" runat="server">
<ContentTemplate>
<asp:LinkButton ID="btnLoadClassFileDevoluciones" runat="server" Text="Cargar Archivo"
CssClass="chxbx" ForeColor="Teal" OnClick="BtnLoadChargeFileDevoluciones_Click" ValidationGroup="valChrgFileDevoluciones" CausesValidation="true" />
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="btnLoadClassFileDevoluciones" />
</Triggers>
</asp:UpdatePanel>
In the aspx.cs:
/// <summary>
/// Load file.
/// </summary>
/// <param name="sender">sender</param>
/// <param name="e">e</param>
protected void BtnLoadChargeFileDevoluciones_Click(object sender, EventArgs e)
{
try
{
if (fupld_cargue.HasFile)
{
// Here, the file is detected in server-side
// and it's been handled as logic demands it.
}
else
{
// File not detected in server-side.
MessageBox("Please, select a file");
}
}
catch (Exception handledException)
{
// Omitted exception-handling code in this sample.
}
}
With the previous explanation, I finally could solve the issue I had about sending a file using FileUpload
- which was inside an UpdatePanel
control.