By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,646 Members | 1,175 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,646 IT Pros & Developers. It's quick & easy.

question about HTML control with runat="server"

P: n/a
Bob
Hi,

in aspx file, i defined this:

<input id="Button2" type="button" value="button" runat="server"
onclick="klik()"/>

This 'onclick' event is a clientclick (starting the Javascript function
"klik()" ).
I want to do a 'server onclick', just like the <asp:Buttoncontrol, but it
doesn't appear in the Intellisense nor in code-behind.

My question is:
is it possible to do an onclick event on the server?
If yes: how?
If no: what's the purpose of using an HTML input control with
runat="server"? What's the difference with a HTML input control not running
on the server (except it runs on the server), since it's not possible to
'onclick' on the server?

Thanks
Bob
May 21 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
when you put a runat=server on an html control, it means the codebehind
can access the control and its properties. except for a small list of
html control, most end up as a generic html control. (asp.net does
support all input button varients).

in your case the <input type="button"does not postback normally. it an
html control that only fires a client click in the browser. you can
cause a postback with client code or switch to type=submit which does
perform a browser postback. in this case you use onserverclick to
respond in the codebehind.
-- bruce (sqlwork.com)
Bob wrote:
Hi,

in aspx file, i defined this:

<input id="Button2" type="button" value="button" runat="server"
onclick="klik()"/>

This 'onclick' event is a clientclick (starting the Javascript function
"klik()" ).
I want to do a 'server onclick', just like the <asp:Buttoncontrol, but it
doesn't appear in the Intellisense nor in code-behind.

My question is:
is it possible to do an onclick event on the server?
If yes: how?
If no: what's the purpose of using an HTML input control with
runat="server"? What's the difference with a HTML input control not running
on the server (except it runs on the server), since it's not possible to
'onclick' on the server?

Thanks
Bob

May 21 '07 #2

P: n/a
Bob
Thanks

"bruce barker" <no****@nospam.comschreef in bericht
news:ei**************@TK2MSFTNGP06.phx.gbl...
when you put a runat=server on an html control, it means the codebehind
can access the control and its properties. except for a small list of html
control, most end up as a generic html control. (asp.net does support all
input button varients).

in your case the <input type="button"does not postback normally. it an
html control that only fires a client click in the browser. you can cause
a postback with client code or switch to type=submit which does perform a
browser postback. in this case you use onserverclick to respond in the
codebehind.
-- bruce (sqlwork.com)
Bob wrote:
>Hi,

in aspx file, i defined this:

<input id="Button2" type="button" value="button" runat="server"
onclick="klik()"/>

This 'onclick' event is a clientclick (starting the Javascript function
"klik()" ).
I want to do a 'server onclick', just like the <asp:Buttoncontrol, but
it doesn't appear in the Intellisense nor in code-behind.

My question is:
is it possible to do an onclick event on the server?
If yes: how?
If no: what's the purpose of using an HTML input control with
runat="server"? What's the difference with a HTML input control not
running on the server (except it runs on the server), since it's not
possible to 'onclick' on the server?

Thanks
Bob
May 21 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.