server side or client side buttton

C

Colin Graham

Hello again!!

my understanding of the principles of this stuff are a bit vague so i
apologise in advance - sort of thrown in at the deep end. Anyway - I
am working on a project at the minute and i have created a button
using the following code.

<asp:button id="Button1" onclick="upload" runat="server" Width="119px"
text="Upload"></asp:button>

this button calls and runs some code ie. sub upload - see below

Public Sub upload(ByVal s As Object, ByVal e As EventArgs)

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
<INPUT id="btn_EditImage" type="image" src="Buttons/EditImage.gif"
onclick="upload" runat="server"></TD>.

i can change my button to a server control and call the function from
there but there is an issue with the arguments in the code. any ideas
appreciated .

CG
 
L

Lucas Tam

(e-mail address removed) (Colin Graham) wrote in
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
<INPUT id="btn_EditImage" type="image" src="Buttons/EditImage.gif"
onclick="upload" runat="server"></TD>.

The onClick method is for Javascript functions - not server side functions.

Since you're using fireworks for your button (it's a graphic right?) use an
imageButton instead of a regular .NET button. That'll allow you to bind the
button to .NET functions.
 
C

Colin Graham

thanks lucas ive tried that and the button works fine unfortunately i
now get the following error

Parser Error Message: The base class includes the field 'button1', but
its type (System.Web.UI.WebControls.Button) is not compatible with the
type of control (System.Web.UI.WebControls.ImageButton).

does this mean i have to change my asp.net function??

any help appreciated

CG
 
L

Lucas Tam

(e-mail address removed) (Colin Graham) wrote in
thanks lucas ive tried that and the button works fine unfortunately i
now get the following error

Parser Error Message: The base class includes the field 'button1', but
its type (System.Web.UI.WebControls.Button) is not compatible with the
type of control (System.Web.UI.WebControls.ImageButton).

does this mean i have to change my asp.net function??


Check your codebehind... is button1 still declared as a
System.Web.UI.WebControls.Button not as a
System.Web.UI.WebControls.ImageButton? Make sure button one is declared as
a ImageButton.

Take a look at the "hidden" code VS.NET auto generates. Sometimes it
doesn't update the code properly.
 

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

Top