Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP:HyperLink control and client-side scripting

Reply
Thread Tools

ASP:HyperLink control and client-side scripting

 
 
Brian W
Guest
Posts: n/a
 
      03-01-2004
Hi All,

I know this is a dumb question, but I'll ask it anyway...

How do you do client-side scripting with an ASP control?

For example I have:

<asp:hyperlink id="Hyperlink1" runat="server" NavigateUrl="~/"
onclick="return false;">Home</asp:hyperlink>

When I run this it works as expected, except the IDE sees it as and error.

I know I can add the attribute in the codebehind, but is this possible in
the HTML designer side?

TIA
Brian W


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-01-2004
not with the webcontrol controls, as asp.net assumes these are postback
events

-- bruce (sqlwork.com)

"Brian W" <brianw@gold_death_2_spam_rush.com> wrote in message
news:uT7wcz9$...
> Hi All,
>
> I know this is a dumb question, but I'll ask it anyway...
>
> How do you do client-side scripting with an ASP control?
>
> For example I have:
>
> <asp:hyperlink id="Hyperlink1" runat="server" NavigateUrl="~/"
> onclick="return false;">Home</asp:hyperlink>
>
> When I run this it works as expected, except the IDE sees it as and error.
>
> I know I can add the attribute in the codebehind, but is this possible in
> the HTML designer side?
>
> TIA
> Brian W
>
>



 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-02-2004
Hi Brain,


Thanks for posting in the community!
As for your question that "whether possible to add client side attributes
in the ASP.NET server control's html source(aspx page)", I agree with bruce
that we can only specify the Server control's specified attributes in its
tag such as
<asp:Button...> <asp:Label ...> ..
In fact, when the asp.net runtime parsing the aspx page, it'll parse the
asp.net server controls( not html server controls) according to its class
in framework, and these classes has their buildin attributes which are
quite different from html element's attributes( only for serverside code's
controling). The runtime construct a server control's instance via the
attribuets and finally render it out to client via some certain mapping
(from these attributes to the proper html element attributes). So we can't
add clientside used attributes in ASP.NET server control's source template
in aspx page(html view). One way to do this is via their' "Attributes"
collection in code behind as you've mentioned. If you do want to add
clientside attributes in aspx file(html view), I think you can try using
the HtmlServerControls instead, because they're directly mapping to html
element. Do you think so?

In addition, here are some tech ariticles on the ASP.NET servercontrols and
html server controls:

#ASP.NET Server Controls Recommendations
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconchoosingwebformscontrols.asp

#ASP.NET Server Controls and Browser Capabilities
http://msdn.microsoft.com/library/en...msControlsBrow
serCapabilities.asp?frame=true

#HTML Server Controls
http://msdn.microsoft.com/library/en...SyntaxForHTMLC
ontrols.asp?frame=true

#The Forgotten Controls: HTML Server Controls
http://msdn.microsoft.com/library/en...gottenControls
.asp?frame=true

Hope these also helpful.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

 
Reply With Quote
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      03-04-2004
Hi Brain,

Have you had a chance to check out my suggestions in the last reply or have
you got any further ideas on this issue? If you have any further questions,
please feel free to post here.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

 
Reply With Quote
 
Brian W
Guest
Posts: n/a
 
      03-04-2004
I'm good, Thanks!

BrianW



"Steven Cheng[MSFT]" <v-> wrote in message
news:...
> Hi Brain,
>
> Have you had a chance to check out my suggestions in the last reply or

have
> you got any further ideas on this issue? If you have any further

questions,
> please feel free to post here.
>
>
> Regards,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
> Get Preview at ASP.NET whidbey
> http://msdn.microsoft.com/asp.net/whidbey/default.aspx
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Client-side scripting on server control Mantorok ASP .Net 9 07-07-2005 04:16 PM
Using a Scripting Language as Your Scripting Language DaveInSidney Python 0 05-09-2005 03:13 AM
How to mark ActiveX control (VB6.0) as save for scripting Chris Zoper ASP .Net 1 09-10-2004 03:14 PM
How to mark ActiveX control save for scripting Chris Zoper ASP .Net Building Controls 0 09-07-2004 06:31 AM
Python is the best and most popular general purpose scripting language; the universal scripting language Ron Stephens Python 23 04-12-2004 05:32 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57