471,075 Members | 1,274 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,075 software developers and data experts.

UserControl LinkButton Javascript Error

Hi All,

Ive just attempted to use a <ASP:LinkButton> on a ASCX
User Control. The .NET system produces the
HTML/Javascript that doesnt work...

Now before you all scream OnCommand, OnClick Event
Handlers etc. etc.. Or RTFM, I'm not stupid, been there,
done that, so please keep on reading... to the end...

Heres the .ascx file declaration
-----------------------------------------------------
<asp:LinkButton Runat="server" ID="lnk1"
OnClick="lnk1_OnClick">Hello</asp:LinkButton>

Here's what .NET produces as HTML for the browser
-----------------------------------------------------
<a id="MyBasket_lnk1" href="javascript:__doPostBack
('MyBasket$lnk1','')">Hello</a>

Even the form declaration is interesting...
<form name="MyBasket:frmBasket"

Now, this works beautifully on a single .ASPX page, but
the framework does special things to the naming of
objects when they're from an embedded user control.. and
this seems to stop the javascript from correctly
identifying the object involved.

[ <a id="MyBasket_lnk1" href="javascript:__doPostBack
('MyBasket$lnk1','')">Hello</a> ]

Note how the ID of the object and the ID passed into the
postback function are DIFFERENT??? So, my page gets a
Javascript Error "Object Expected". This is automatically
generated by .net for me, so theres NOTHING i can do
about it!!

Now, this strikes me as being a bug, if there is a work
around I love to know it, otherwise hopefully someone at
MS might want to acknowledge this bug.

Sorry for the pushy tone, but i get so tired of people
reading the first line, and then diluting the
conversation thread with rubbish comments.

Many thanks all,

Matt
Jul 21 '05 #1
0 1098

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Rob Koch | last post: by
reply views Thread by scott | last post: by
reply views Thread by Colin Ramsay | last post: by
3 posts views Thread by Eric | last post: by
5 posts views Thread by comshiva | last post: by
6 posts views Thread by Shivakumar | last post: by
reply views Thread by Matt Law | last post: by
1 post views Thread by =?Utf-8?B?S3lsZSBNLiBCdXJucw==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.