 |
|
 |
I've tried to add a postback trigger to my updatepanel, but get the following message. Async triggers don't give the message, but then they don't make the fileupload control work, either. I see from other posts here that people have been able to make this work. What do you suppose I'm doing wrong? By the way, asp seems to be adding the code at line 301. I search the source and don't find it, but it is in the processed page. - Jeremy Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls. Source Error:
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Only Content controls are allowed directly in a content page that contains Content controls. Source Error:
<!--Line 299: </asp:UpdatePanel> --> [commented so it will show up- jeremy] <!--Line 300:</asp:Content> --> Line 301: <triggers></triggers>
|
|
|
|
 |
|
 |
Thanks for the tip and it has saved my time when I started to stuggle with this issue. Thanks to postbacktrigger too.
|
|
|
|
 |
|
 |
Didn't know there was a limitation on using the upload control within an update panel... Now I do and know how to work around it. Looks like the some of the other comments are people who just don't get this.
Aaron Barker
www.tapconsulting.com
|
|
|
|
 |
|
 |
When u use
<%-- asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" --%>
that time shows updateprogress bar but file name is not accesible in button click event
and when u use
<%-- asp:PostBackTrigger ControlID="Button1" --%>
that time file name is accesible but not shows progress bar
Then how can i access the filename with showing the progress bar?
Plz help me
shan
-- modified at 3:04 Monday 1st October, 2007
|
|
|
|
 |
|
 |
shan,
you cannot do that. ASP.NET AJAX is just a layer on top of the javascript and javascript doesn't allow you to access the client's file.
some people use WebService to send binary packages via SOAP protocol, some people use IFRAME technique.
you need to considering your option.
supernont
((-supernont-))
|
|
|
|
 |
|
 |
Here's a more reliable way to ensure that the control you want is found by the script manager and the trigger:
Override your OnPreRender for the page like this:
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
ScriptManager1.RegisterPostBackControl(m_btnSaveLogo);
//
//--If your ScriptManager is in a master page, use the following instead:
//
//ScriptManager sm = Master.FindControl("ScriptManager1") as ScriptManager;
//sm.RegisterPostBackControl(m_btnSaveLogo);
}
This method works much better than the "Triggers" tag, because your code will always find the control no matter where it is inside any naming-container type control.
Bruce Pierson
|
|
|
|
 |
|
 |
Thanks Bruce... Worked like a Charm
Mike Kushner
|
|
|
|
 |
|
 |
hi,
how do i use the trigger if my button is inside a Formview's edit mode?
currently just referencing the button won't work as the control can't be found
|
|
|
|
 |
|
 |
Use this syntax:
formviewname:buttonname
|
|
|
|
 |
|
 |
tried it..but i got an
A control with ID 'FormView1:Update' could not be found for the trigger in UpdatePanel 'updatepanel1'.
|
|
|
|
 |
|
 |
I have the same exact error for my DetailsView control.
A control with ID 'dtvAuthor:btnUpdate' could not be found for the trigger in UpdatePanel 'UpdatePanel_main'
Any help is greatly appreciated.
|
|
|
|
 |
|
 |
Did anyone ever find a solution to this w/o using iframes? I sure would like to know.
Anyone remember the PDP11?
|
|
|
|
 |
|
 |
I am a newbie to Dot Net and I am developing a web application using a Wizard control. I have 8 steps on this wizard, steps 3,4,5,6 has a file upload control on each of these steps.
The HasFile returns false for the file upload control on the 3rd step of the wizard.
If I place the File upload control on the final step, it returns true.
I dont know where to place this trigger inside the source page.
I tried placing it after the Wizard control before wizard step and I get an error.
Appreciate your help.
Regards.
|
|
|
|
 |
|
 |
Hi,
If you are not using AJAX then you do not need triggers. If you are using UpdatePanels then the element goes inside the .
|
|
|
|
 |
|
 |
Thanks Bob. I have an AJAX enabled website. I used this as I wanted to use the Calendar Control and in the future will be using accordian control.
If I dont need triggers, then how can I make the Finsih Button recognize the file attached in steps 3,4,5,6?
Because my final step is to upload these files on the file server and store the location info in the database.
|
|
|
|
 |
|
 |
Each time the user leaves a wizard page that has a fileupload you will need to check FileUpload.HasFile and save the file. You will need to ensure that a postback occurs when moving between pages of the wizard, otherwise the files will not upload. I expect that you will have to create a postback trigger for the wizard control itself.
|
|
|
|
 |
|
 |
When i click on upload button first time,it doesn't fire click event.Then after it's working fine. what' wrong woth it. please tell me as soon as possible which version of ajax used in example ?
-- modified at 9:30 Friday 18th May, 2007
|
|
|
|
 |
|
 |
I'm having the same problem. Does anyone know the cause of the HasFile property being false on the first click?
Brenda
|
|
|
|
 |
|
 |
I have the same problem.
The first time you click on the button, there is an empty string in FileName property, but if you browse and send a second time, the file uploads correctly.
I tried the other way suggested above (override OnPreRender to configure ScriptManager) but there's no change.
Can anyone help us?
Thks
Goudax
|
|
|
|
 |
|
 |
I actually ended up getting this to work by using a PostBackTrigger rather than an AsynchPostBackTrigger. It does a full postback rather than a partial, but your page doesn't blink like or scroll like a traditional postback. It ends up working pretty well.
Brenda
|
|
|
|
 |
|
 |
I'm already working with PostbackTrigger in place of AsyncPostbackTrigger, but it doesn't work better.
Do you have another idea ?
Thanks
|
|
|
|
 |
|
 |
I found what was my problem.
FileUpload control is in a panel which his visible property is set to false. Once a button is clicked in another panel, the FileUpload panel becomes visible and that is why there's no file in the FileUpload control.
I tried to add a postback trigger to the button which makes the panl visible, but it doesn't work.
Anyone any idea ?
Thanks
|
|
|
|
 |
|
 |
Hi there!
I had used this example the other day at work and it worked fine. However, using it on a web site I'm working on at home it acted the same way you mention. The difference is at work, I had the panel and update panel shown by a ModalPopupExtender.
aspx html side code:
<asp:LinkButton ID="UploadLinkButton" runat="server" OnClick="UploadLinkButton_Click">Upload Homework
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<asp:PostBackTrigger ControlID="UploadButton" />
<asp:Panel ID="Panel1" runat="server" Width="350" Height="200" CssClass="modalPopup" Style="Display:none">
<asp:TextBox ID="PathLocationTextBox" runat="server" Style="Display:None">
Select Class |
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="conditional">
<asp:DropDownList ID="ClassLocationDropDownList" runat="server" OnSelectedIndexChanged="ClassLocationDropDownList_SelectedIndexChanged" AutoPostBack="True">
|
<asp:Label ID="ErrorLabel" runat="server" BackColor="#C00000" Font-Bold="True" ForeColor="White"
Text="You cannot upload files to that Location." Visible="False" Width="198px"> |
<asp:FileUpload ID="FileUpload1" runat="server" /> |
<asp:Label ID="Label1" runat="server"> |
<asp:Button ID="CancelUploadButton" runat="server" Text="Cancel" OnClick="CancelUploadButton_Click" /> |
<asp:Button ID="UploadButton" runat="server" Text="Upload" OnClick="UploadButton_Click" /> |
<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground" TargetControlID="UploadLinkButton" PopupControlID="Panel1" DropShadow="true"/>
aspx.cs code behind
protected void UploadButton_Click(object sender, EventArgs e)
{
FileUpload FUpload = null;
FUpload = (FileUpload)Panel1.FindControl("FileUpload1");
if (FUpload.HasFile)
{
Label1.BackColor = System.Drawing.Color.Transparent;
Label1.ForeColor = System.Drawing.Color.Green;
Label1.Text = FUpload.FileName;
}
else
{
Label1.Text = "You must select a file to upload.";
Label1.ForeColor = System.Drawing.Color.White;
Label1.BackColor = System.Drawing.Color.Red;
}
ModalPopupExtender1.Show();
}
protected void CancelUploadButton_Click(object sender, EventArgs e)
{
ModalPopupExtender1.Hide();
}
All you should have to do now is the FileUpload1.SaveAs() method to complete your task.
HTH
BostLabs
|
|
|
|
 |
|
 |
rats! aspx code didn't show. This should though. <code> <asp:LinkButton ID="UploadLinkButton" runat="server" OnClick="UploadLinkButton_Click">Upload Homework</asp:LinkButton> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <Triggers> <asp:PostBackTrigger ControlID="UploadButton" /> </Triggers> <ContentTemplate> <asp:Panel ID="Panel1" runat="server" Width="350" Height="200" CssClass="modalPopup" Style="Display:none"> <asp:TextBox ID="PathLocationTextBox" runat="server" Style="Display:None"></asp:TextBox> <table> <tr> <td colspan="2"> Select Class</td> <td style="width: 100px"> <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="conditional"> <ContentTemplate> <asp:DropDownList ID="ClassLocationDropDownList" runat="server" OnSelectedIndexChanged="ClassLocationDropDownList_SelectedIndexChanged" AutoPostBack="True"> </asp:DropDownList></td> </tr> <tr> <td colspan="3"> <asp:Label ID="ErrorLabel" runat="server" BackColor="#C00000" Font-Bold="True" ForeColor="White" Text="You cannot upload files to that Location." Visible="False" Width="198px"></asp:Label></td> </ContentTemplate> </asp:UpdatePanel> </tr> <tr> <td colspan="3"> <asp:FileUpload ID="FileUpload1" runat="server" /></td> </tr> <tr> <td colspan="3"> <asp:Label ID="Label1" runat="server"></asp:Label></td> </tr> <tr> <td colspan="1"> <asp:Button ID="CancelUploadButton" runat="server" Text="Cancel" OnClick="CancelUploadButton_Click" /></td> <td colspan="2"> <asp:Button ID="UploadButton" runat="server" Text="Upload" OnClick="UploadButton_Click" /></td> </tr> </table> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BackgroundCssClass="modalBackground" TargetControlID="UploadLinkButton" PopupControlID="Panel1" DropShadow="true"/> </code> BostLabs
|
|
|
|
 |
|
 |
Put the following outside of your UpdatePanel (browser security requires at least one input type="file" [the underlying FileUpload element] be present at the initial GET in order to use any including those inserted dynamically via the UpdatePanel):
<asp:FileUpload ID="dummyFU" runat="server" style="visibility:hidden;" />
|
|
|
|
 |