Re: Web - Multiple ImageButtons calling the came function
From: DalePres (don-t-spa-m-me_at_lea-ve-me-a-lone--.com)
Date: 03/16/05
- Next message: Bob Calvanese: "Re: Child Form variables postback to MDI Parent"
- Previous message: Philippe: "Child Form variables postback to MDI Parent"
- In reply to: David P. Donahue: "Re: Web - Multiple ImageButtons calling the came function"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 15 Mar 2005 18:05:47 -0600
Create your event handler as follows. Make sure you set the accessibility
to protected as shown.
protected void ImageButtonClick(object sender,
System.Web.UI.ImageClickEventArgs e)
{
Response.Write("the image was clicked");
}
Then, in the aspx file, add this attribute within your <ASP:IMAGEBUTTON >
tag:
ONCLICK="ImageButtonClick"
HTH
DalePres
MCAD, MCDBA, MCSE\
"David P. Donahue" <ddonahue@ccs.neu.edu> wrote in message
news:%23hs2TOWKFHA.1620@TK2MSFTNGP14.phx.gbl...
>> 1) Why use a WebServer Control such as the ImageButton if you want to
>> handle the event on the client side?
>
> Mostly because I have some additional security that must be put in place
> on the server side, and having the server-side and client-side code
> intermingling may work, but wouldn't give me the confidence that I need in
> the security implementation. In this particular case, the security needs
> outweigh the minor performance hit. Not to mention that the only way I
> know how to pass values from page to page on the client side is through a
> URL query string, which is just ugly :)
>
> Your code for part 2 of my question looks great, that will definitely be
> the way to go in this case. The only thing now is putting something in
> the DataList's ItemTemplate that tells the image to run a server-side
> function when the image is clicked (html image or asp image button,
> whatever's easier to point to a server-side function). And, from within
> that function, be able to access the properties of the specific image (its
> SRC or its ImageURL) that was clicked.
>
>
> Regards,
> David P. Donahue
> ddonahue@ccs.neu.edu
- Next message: Bob Calvanese: "Re: Child Form variables postback to MDI Parent"
- Previous message: Philippe: "Child Form variables postback to MDI Parent"
- In reply to: David P. Donahue: "Re: Web - Multiple ImageButtons calling the came function"
- Messages sorted by: [ date ] [ thread ]