Fille Upload control issue

FileUpload control not posting to server within WizardControl in an AJ

Page 1 of 1

5 Replies - 7880 Views - Last Post: 22 July 2010 - 08:02 AM Rate Topic: -----

#1 Sonic88  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 166
  • Joined: 19-February 08

Fille Upload control issue

Post icon  Posted 19 February 2008 - 03:52 PM

Hello Everyone. Long time reader, first time poster haha. Anyways, Ive been working on this weird issue concerning a fileupload control that is within a wizard control step and then all this is within an AJAX update panel. Ive searched and searched on the internet and I know the problem is that the file upload control wont work unless you do a full postback. Now, everything I have found has said to use a trigger within the update panel for the the control you wish to cause the postback. This works fine if the fileupload is just within the update panel and not the wizard, but within the wizard i can not seem to get the submit button (which uploads the file etc.) to trigger the full postback. Has anyone else had this issue? I have found a few people with the same problem online but no solutions as of yet.

Any help is greatly appreciated. Right now as a temp fix I have set the trigger control to the wizard control itself, but this basically defeats the whole purpose of the update panel as the full postback is triggered for every event of the Wizard control and I lose the nice pretty "no-flicker" effect of the ajax panel.

I would post some code but it is on my system at work, so for now I was just seeing if anyone has encountered this or found a suitable workaround.

Thanks alot.

This post has been edited by Sonic88: 19 February 2008 - 03:54 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Fille Upload control issue

#2 Sonic88  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 166
  • Joined: 19-February 08

Re: Fille Upload control issue

Posted 20 February 2008 - 07:06 AM

OK well back at work and i thought id post a little code that may illustrate my issue more. I have left out some wizard steps as it is a very large wizard and will just give the needed arts.

			
			<asp:UpdatePanel ID="UpdatePanel1" runat="server">
			<Triggers>
				<asp:PostBackTrigger ControlID="btnSubmitImage" />
			</Triggers>
			<ContentTemplate>
			
			<asp:Wizard ID="Wizard1" runat="server" BackColor="#E6E2D8" Font-Names="Verdana" Font-Size="0.8em" Width="800px" ActiveStepIndex="5" OnActiveStepChanged="Wizard1_ActiveStepChanged">
				<WizardSteps>
<!--other wizard steps here-->
					<asp:WizardStep runat="server" Title="Store Image">
					<span class="subHeadingGrn">Store Image<br />
					</span>
						<br />
						<table>
							<tr>
								<td class="topAlignCenter" colspan="2" style="height: 15px">
									Current Store Image<br />
									<asp:Image ID="imgStoreImage" runat="server" BorderColor="Black" BorderStyle="Solid"
										BorderWidth="1px" />
								</td>
							</tr>
							<tr>
								<td class="topAlignLeft" colspan="2">
									To replace this image, select the image from your computer in the form below and<br />
									click the submit button.</td>
							</tr>
							<tr>
								<td colspan="2">
									<asp:FileUpload ID="fuStoreImage" runat="server" />
									<asp:Button id = "btnSubmitImage" runat="server" CssClass="btnRed" Text="Submit" OnClientClick="return confirm('Are you sure you want to replace the current image?');" onclick="btnSubmitImage_Click"/>
								</td>
							</tr>
						</table>
						<asp:Label ID="lblImgMsg" runat="server"></asp:Label>
						<br />
					
					</asp:WizardStep>
				</WizardSteps>
				
				
				<StepStyle BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderStyle="Solid" BorderWidth="2px"
					CssClass="contentCell" Width="680px"/>
				<SideBarStyle CssClass="leftNav" />
				<NavigationStyle CssClass="nav" Height="10px"/>
				<NavigationButtonStyle CssClass="btnRed" />
				<SideBarButtonStyle CssClass="noLineWhite"/>
				</asp:Wizard>
			</ContentTemplate>
			</asp:UpdatePanel>



Note the trigger declaration at the beggining of the update panal. I need this trigger to fire when the btnSubmitImage button of the wizard step is clicked so that the full postback is only triggered when a file uploaded and not on every step. I hope this clarifies things and any help is greatly appreciated as this project is at its deadline and I really want that nice AJAX update panel effect. Otherwise Ill have to leave as is for now. Being a client utility and not public app it would be acceptable but my OCD wont allow me to let go of the AJAX lol
Was This Post Helpful? 0
  • +
  • -

#3 Sonic88  Icon User is offline

  • D.I.C Head

Reputation: 3
  • View blog
  • Posts: 166
  • Joined: 19-February 08

Re: Fille Upload control issue

Posted 21 February 2008 - 03:52 PM

Cmon I know someone has at least encountered this issue in some form or another? I know im new but this has been driving me crazy. Anyone? Someone?
Was This Post Helpful? 0
  • +
  • -

#4 aaaaaaanuj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-June 09

Re: Fille Upload control issue

Posted 11 June 2009 - 07:15 AM

Hi, just declare you update panel at wizard step level. means, if you have three wizardSteps, then you need to declare thre different update panels.
Was This Post Helpful? 0
  • +
  • -

#5 Guest_haiyang*


Reputation:

Re: Fille Upload control issue

Posted 21 July 2010 - 08:33 AM

Just download ajax control toolkit
Was This Post Helpful? 0

#6 Frinavale  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 205
  • View blog
  • Posts: 776
  • Joined: 03-June 10

Re: Fille Upload control issue

Posted 22 July 2010 - 08:02 AM

@haiyang: the Ajax control toolkit is not going to fix this issue, in fact it has nothing to do with it.

@Sonic88: I use a technique that involves of placing the FileUpload control inside another UpadatePanel (within the main UpdatePanel) in order to trigger a full page postback all the time.

But I've never tried doing this within a wizard control before so it might not work but try this:
			
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
  <Triggers>
   <asp:PostBackTrigger ControlID="btnSubmitImage" />
  </Triggers>
  <ContentTemplate>

    <asp:Wizard ID="Wizard1" runat="server" BackColor="#E6E2D8" Font-Names="Verdana" Font-Size="0.8em" Width="800px" ActiveStepIndex="5" OnActiveStepChanged="Wizard1_ActiveStepChanged">
      <WizardSteps>
      <!--other wizard steps here-->
        <asp:WizardStep runat="server" Title="Store Image">
          <span class="subHeadingGrn">Store Image<br />
          </span>
          <br />
          <table>
            <tr>
              <td class="topAlignCenter" colspan="2" style="height: 15px">
                Current Store Image<br />
                <asp:Image ID="imgStoreImage" runat="server" BorderColor="Black" BorderStyle="Solid"
                  BorderWidth="1px" />
              </td>
            </tr>
            <tr>
              <td class="topAlignLeft" colspan="2">
                To replace this image, select the image from your computer in the form below and<br />
                click the submit button.</td>
            </tr>
            <tr>
              <td colspan="2">

<asp:UpdatePanel ID="ImageUpdate" runat="server">
  <Triggers>
    <asp:PostBackTrigger ControlID="ImageUploadSection" />
  </Triggers>
  <ContentTemplate>
    <asp:Panel ID="ImageUploadSection" runat="server">
                <asp:FileUpload ID="fuStoreImage" runat="server" />
                <asp:Button id = "btnSubmitImage" runat="server" CssClass="btnRed" Text="Submit" OnClientClick="return confirm('Are you sure you want to replace the current image?');" onclick="btnSubmitImage_Click"/>
    </asp:Panel>

    </ContentTemplate>
  </asp:UpdatePanel>
              </td>
            </tr>
          </table>
          <asp:Label ID="lblImgMsg" runat="server"></asp:Label>
          <br />
					
        </asp:WizardStep>
      </WizardSteps>
				
      <StepStyle BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderStyle="Solid" BorderWidth="2px"
					CssClass="contentCell" Width="680px"/>
				<SideBarStyle CssClass="leftNav" />
				<NavigationStyle CssClass="nav" Height="10px"/>
				<NavigationButtonStyle CssClass="btnRed" />
				<SideBarButtonStyle CssClass="noLineWhite"/>
    </asp:Wizard>
  </ContentTemplate>
</asp:UpdatePanel>


If this doesn't work, consider moving the FileUpload and the button into a page of their own, then use an iframe to display it in your wizard.

[Edit] Ok I just realized that I answered a question that was asked 2 years ago because someone post a useless answer to it yesterday. I hope this is helpful to anyone else facing this problem[/Edit]

-Frinny

This post has been edited by Frinavale: 22 July 2010 - 08:18 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1