Hello Folks!
I've created an upload utility for some of our editors that allows them to post up various media files to a media server. I've also created a management ui for them to view the files and info, etc.. My only problem now is giving them the ability to delete the same said files as they feel is necessary.
I'm using a DataList
You can see that when I click on Delete, its supposed to trigger this sub call:
My problem is that whenever I try this, I get a server error about a postback error (the error is a bit long but here it is):
I've created an upload utility for some of our editors that allows them to post up various media files to a media server. I've also created a management ui for them to view the files and info, etc.. My only problem now is giving them the ability to delete the same said files as they feel is necessary.
I'm using a DataList
HTML:
<asp:DataList id="PictureFiles" Runat="Server"
RepeatColumns="1"
CellPadding="3"
OnItemCommand="Delete_File" RepeatLayout="Flow" ShowFooter="False" ShowHeader="False">
<ItemTemplate>
<asp:Label ID="Label1" Text='<%# Container.DataItem %>' Runat="Server"/>
<asp:Button ID="Button1" Text="Delete" Runat="Server" Font-Size="7pt" CommandName='<%# Container.DataItem %>'/>
</ItemTemplate>
</asp:DataList>
VB.NET:
Sub Delete_File(ByVal Src As Object, ByVal Args As DataListCommandEventArgs)
File.Delete(Server.MapPath("Podcasts") & "\" & Args.CommandName)
Bind_Picture_Files()
End Sub
My problem is that whenever I try this, I get a server error about a postback error (the error is a bit long but here it is):
I don't see anything about postback being allowed on this control or what exactly this may mean that I'm doing wrong. Can anyone assist please?Server Error in '/WebSite' Application.
--------------------------------------------------------------------------------
Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[ArgumentException: Invalid postback or callback argument. Event validation is enabled using <pages enableEventValidation="true"/> in configuration or <%@ Page EnableEventValidation="true" %> in a page. For security purposes, this feature verifies that arguments to postback or callback events originate from the server control that originally rendered them. If the data is valid and expected, use the ClientScriptManager.RegisterForEventValidation method in order to register the postback or callback data for validation.]
System.Web.UI.ClientScriptManager.ValidateEvent(String uniqueId, String argument) +2127900
System.Web.UI.Control.ValidateEvent(String uniqueID, String eventArgument) +106
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +32
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
Last edited by a moderator: