Simple question about form submission

S

Stephen

Hi,
I have a page with 2 forms.
First form has a html input box and an html submit button
Second form has a html input box and an <asp: image button>

if I have the focus/click on the first form's input button, and hit the
"Enter key" then the button fires and does the action specified.

if I have the focus/click on the second form's input button, and hit the
"Enter key" then the <asp:image button> does not fire... unless I click on
the button..

I want to make the second form to work like the first form
Please advice.

Thanks,
Stephen
 
P

psb

you can only have one server form on a page, so I am assumming the first
form is html non "runat='server'".

make the second html input box have attribute runat="server" then add it to
the handles of the imagebutton_click event like this...
---------------------html------------------
<input type="text" id="txb1" runat="server"/>
<asp:imagebutton id="btn" runat="server"/>
----------------code behind-----------------
Private Sub Btn_Click(ByVal sender As Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles Btn.Click, txb1.TextChanged
 
S

Stephen

Hi,

I am trying the code you suggested but I get the following error:

Method 'ImageButton1_Click' cannot handle Event 'TextChanged' because they
do not have the same signature.
please advice,

Stephen
 
P

psb

what I usually do is: in design mode, I double click on the image button,
then go back to design mode and double click on the textbox. I then add the
handles from the textbox to the image button click event handles. i then
delete the function that was created for the double click of the textbox.

if that still doesn't work, make sure the text box is an <asp:textbox...>
not a <input type="text" runat="sever"> (basically a webcontrol instead of a
htmlcontrol). I also still use framework 1.0 sp2, so this might not work
with sp3 which came out a couple of weeks ago or framework 1.1. sp3.

I hope this helps a little bit more.
-Psb
 
P

psb

ok. I know I have done this in the past, but I have only done <asp:buttons>
and <input type="submit" runat="Server">

I just tested it and you are right, they don't have same signature. I would
try to use CSS for your button with a background image rather than try to
make an image button.

something like this....
<input type="submit" class="btnYelo" runat="Server" .../>
..input.btnYelo
{
background-image:url(../Images/YOURIMAGE.gif);
font-family: arial, helvetica, sans-serif;
font-size: 12px;
font-weight:bold;
border-right: #000000 1px solid;
border-top: #000000 1px solid;
border-left: #000000 1px solid;
border-bottom: #000000 1px solid;
color: #000000;
text-decoration :none;
cursor: hand;
}

-psb
 

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,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top