Bruce,
Thanks for the reply. My question wasn't really worded very well and of
course your suggested code is the simple part which I have done. My question
was really about the way in which GetPostBackEven tReference was working. I
had set-up my client-side handler using javascript passing a var from the
onclick call as you suggested. My problem was with the output of the asp.net
method GetPostBackEven tReference of the ClientScriptMan ger class as below;
__doPostBack('c tl00$BDTabMenu1 ','Menu1');
Because, I had passed a var to my function i.e. funtion fname(x) {....}
I was trying to find a way to output a varname in the argument part of the
GetPostBackEven tReference but couldn't get round the way it was rendering it
in a string! My fix was to iterate over my data source and output script for
a switch statement, then allowing me to use the explicit
__doPostBack('c tl00$BDTabMenu1 ','Menu1'); calls in each case, as below;
switch(x)
{
case 'Menu1' :
{
aElement.value= 0;
__doPostBack('c tl00$BDTabMenu1 ','Menu1');
break;
}
case 'Menu2' :
{
aElement.value= 1;
__doPostBack('c tl00$BDTabMenu1 ','Menu2');
break;
}
}
anyway, I now have a different gripe with master and content pages and
events within my custom control, which I have posted to verious other threads!
Thanks again!
"bruce barker" wrote:
define a property (say OnClientClick) then if set add it to the onclick
attribute before the get:
writer.AddAttri butes("onclick" ,
OnClientClick + GetPostBackEven tReference(opti ons);
-- bruce (sqlwork.com)
Mark wrote:
I am writing a control and want to handle an OnClick event on the client-side
before then conforming to the postback mechanism. I have got the server-side
events working for my OnClick event by adding to the rendered element's
OnClick handler using GetPostBackEven tReference. How can I provide a
client-side onclick handler and then to use the aspnet form submit method
such that I can also subscribe to the server-side events too?