Disable Event Checking for gridview image

M

msch-prv

I have a gridview with an icon. Clicking on the icon via the OnCommand
event causes a pop up form to appear. This however generates an
'Invalid postback or callback argument' at run time.

To disable the error message, I set EnableEventValidation="false" in
the page directive. However, because I am concerned by possible
injection attacks, I don't like the idea of having to disable this
feature on the whole page.

Question: How can I suspend validation for this control? I looked up K.
Scott Allen's article
http://odetocode.com/Blogs/scott/archive/2006/03/20/3145.aspx. Being a
newbie, I am really reluctant to dig into ASP's advanced design
spheres. Is there a simpler approach? Would removing the
CausesValidation="False" statement in a tag carry out control
validation despite the page directive?

TIA for any hints, Mark

Template code:

<ItemTemplate>
<asp:ImageButton ID="ImageButton1" runat="server"
CausesValidation="False"
CommandArgument='<%# Bind("ActID")%>'
ImageUrl="~/icons/icon_edit.gif" OnCommand="ImageButton1_Command" />

</ItemTemplate>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,196
Latest member
ScottChare

Latest Threads

Top