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