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)
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 :)
Thanks.
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.
Preet.
Hi Preet,
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.