Hi,
I would appreciate it a lot if someone could please help me with this. I have an updatepanel which has a button, which when clicked shows the web dialog window, within the dialog window I have a file upload and a button upload. Apparently ajax does not like the upload control. HasFile is always returning false. What way can I work around this? I have tried using the <Triggers><asp:PostBackTrigger ControlID="" /></Triggers> of the update panel but get an error that it can't find the control.
Can anyone please help?
>_< if only i knew how to make this code look more readable
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:PostBackTrigge<asp:ScriptManager ID="ScriptMaID="UpdatePanel1"
<ContentTemplate>
<
asp:Button ID="btnVendorAdd" runat="server" Text="Add" onclick="btnVendorAdd_Click"/>
<%
--Dialog control for attaching the document--%>
<ig:WebDialogWindow ID="dlgAttachment" runat="server" Height="200px" Width="400px" Modal="True" InitialLocation="Centered" WindowState="Hidden" Font-Names="Calibri" Font-Size="Small" ForeColor="DimGray">
Header CaptionAlignment="Left" CaptionText="Browse for slip...">
<MaximizeBox AltText="Maximize"></MaximizeBox>
<MinimizeBox AltText="Minimize"></MinimizeBox>
<CloseBox Visible="false" />
</Header>
<ContentPane>
<Template>
<asp:Panel ID="pnlFileUpPrompt" runat="server" Visible="true" Width="100%">
<asp:FileUpload ID="fUp" runat="server" />
<asp:Button ID="btnUpload" runat="server" Text="Attach"onclick="btnUpload_Click"/>
</
asp:Panel>
</Template>
</ContentPane>
</ig:WebDialogWindow>
</ContentTemplate>
asp:UpdatePanel>
asp:UpdateProgress ID="UpdateProgress1" runat="server" DynamicLayout="false" AssociatedUpdatePanelID="UpdatePanel1"></asp:UpdateProgress>
asp:Content>
protected void btnVendorAdd_Click(object sender, EventArgs e)
{
dlgAttachment.WindowState = Infragistics.Web.UI.LayoutControls.DialogWindowState.Normal;
}
protected
void btnUpload_Click(object sender, EventArgs e)
this is always returning false.
if
(fUp.HasFile)
Hi Mizu,
I tested your codes. I think, that problem is not related to WebDialogWindow. Because, exactly the same happened if I moved content of dialog directly into UpdatePanel.
I also tried to set trigger to Unique, but it had same result. Though, postback was (probably) full, the file upload failed. To set trigger, I used following:
protected void Page_Load(object sender, EventArgs e) { PostBackTrigger trigger = new PostBackTrigger(); trigger.ControlID = this.btnUpload.UniqueID; this.UpdatePanel1.Triggers.Add(trigger);}
I think that you should move your "upload" controls out of UpdatePanel.
Regards,Viktor
Hi Viktor,
I am experencing the same issue in my application. I have webupload control and webdatagrid in a update panel (say, updPanel1), and a dropdownlist in another update panel (say, updPanel2). I have the triggers in updPanel1 as:
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddl1" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="WebUpload1" EventName="UploadFinished"
/>
</Triggers>
When I upload a file, it should read the value form the dropdownlist, but it always return the original value unless I do a full postback or have postback trigger instead of AsynPostBackTrigger. I cannot have my webupload control outside the update panel and also, I do not want to trigger a full post back!
Is there other workaround for this? I am using 11.1 build 2158 version. Please let me know.
Thanks.
Preet.
Hi Preet,
It is not clear if your application uses upload within WebDialogWindow. If yes, then I suggest you to test exactly same functionality without WebDialogWindow? I think that upload will fail by exactly same way as in case when it is located in WebDialogWindow.I assume that failure of upload within async postback is limitaion for that control.
No, it is not in the WebDialogWindow.
So there is not other solution without doing the full post back? I really want to avoid a full postback.
Please let me know.
The way I ended up getting around the problem was to add a postback event to my checkboxes and put them insid the update panel so when they were checked it did a post back that the upload control could read. It's not graceful, and I have an empty handler sitting in my codebehind, but it worked.
Ian.
Yeah I don't think you can use an AsyncPostback if yo want to beable to see th values. I wrapped th checkboxes in their own update panel with no trigger, just leaving it to update always.
div class="BU_Section">
<asp:UpdatePanel ID="upCheckBoxes" runat="server" RenderMode="Inline">
<div class="Table FullWidth">
<div class="TR">
<div class="TD BU_CheckBox">
<asp:CheckBox ID="cbBackgroundProcess" runat="server" Text="Use Background Processing" AutoPostBack="True" oncheckedchanged="cbBackgroundProcess_CheckedChanged" OnClick="cbBackgroundProcess_ClientCheckCheckChanged()" TextAlign="Left" />
</div>
<div class="TD">
<asp:Label ID="lblBPInfo" runat="server" Text="- Required for processing multiple files at once."></asp:Label>
<asp:CheckBox ID="cbValidationOnly" runat="server" Text="Validation Only" AutoPostBack="True" oncheckedchanged="cbValidationOnly_CheckedChanged" TextAlign="Left" />
<asp:Label ID="lblValidationOnlyDesc" runat="server" Text=" - Will validate the file without updating the database."></asp:Label>
</asp:UpdatePanel>
div>
Int he code behind Iam handling the check changed event, but I am not sure tht's necessary. I needed to make them mutually exclusive as well set som other properties
void cbBackgroundProcess_CheckedChanged(object sender, EventArgs e)
IsBackgroundProcess = cbBackgroundProcess.Checked;
if (IsBackgroundProcess)
cbValidationOnly.Enabled =
false;
else
true;
void cbValidationOnly_CheckedChanged(object sender, EventArgs
e)
IsValidationOnly = cbValidationOnly.Checked;
cbBackgroundProcess.Enabled =
="Inline">
>
="Table FullWidth">
="TR">
="TD BU_CheckBox">
AutoPostBack="True" oncheckedchanged="cbBackgroundProcess_CheckedChanged" OnClick
="cbBackgroundProcess_ClientCheckCheckChanged()"
="TD">
AutoPostBack="True" oncheckedchanged="cbValidationOnly_CheckedChanged"
TextAlign="Left"
Hi Ian,
I am doing asyncpostback for a dropdownlist in a updatepanel that triggers the other updatepanel where I have the webupload and webdatagrid. But the webupload is not reading the selected value of the dropdownlist from the first updatepanel. And AutoPostBack is set to true for the dropdownlist. Are you suggesting to do a postback trigger instead of asyncpostback?
Please let me know. I really appreciate your input. I am glad too that someone else had experienced the same behavior :)
As long as it's inside the update panel it's only a partial postback. My feeling is tht because this control is just a wrapper that creates an instance of the jQuery upload control which is entirely client side, that is why it doesnt see other page properties properly without a postback. Make sure you wrap your code inth page_load in an if(!Page.IsPostback){ ....} for anything you only want to happen on the initial pageload and it mkes the partial postback a lot more palatable. It's not ideal, but fr the life of me it was the only solution I could find that worked at all. I still had issues accessing h httpContext frm insidethe upload complte event during a multiple file upload and I never found decent workaround for tht othr tha to redirect to anothr page ad do the processing here.
Ian
Thanks. Yes, I had tried to put the Postabck Trigger, it works. As you said, it is not graceful. It does the full postback and hence the webuploads reads the new value. I was just wondering if there is any other workaround.
Thanks again.