Re: create custom button asp.net



On 17 Apr 2005 11:03:29 -0700 in
microsoft.public.dotnet.framework.aspnet, csgraham74@xxxxxxxxxxx
(Colin Graham) wrote:

>i have created my own button in fireworks and want to insert it in my
>code an call this function but it does not work - code below
>

The problem is that the <asp:Button> is a server-side control and the
<INPUT> is client-side. If you need to process an event and have some
code run on the server, then you should use a server-side control.

Try this instead:

<ASP:ImageButton id="Button1" onclick="upload" runat="server"
Width="119px" ImageUrl="Buttons/EditImage.gif"></asp:ImageButton>

'ImageUrl' refers to the image you created. Similar to 'src'.

When this button is clicked, a postback occurs and your upload()
method on the server is called. (By using onclick in the <INPUT> tag
the way you had it, the browser is expecting the name of a client-side
(javascript) method.)

> Can anyone please tell me what the problem is and how can i get round
>this issue. i do not really understand the (ByVal s As Object, ByVal e
>As EventArgs) in my sub routine can this be removed ???

You need to keep the two parameters in your upload() method the way
you have them. It won't compile without them. 's' is the object that
caused the event (in this case it will be Button1) and 'e' refers to
the event that occured (an OnClick event in this case.)

Roger

.