Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

WWWXXXDOCO, nu vot, WWWXXXAPC, dhcpd lease file "binding state", WWWXXXDOCO, how to setup procmail to process html2text, how to setup procmail html2text, WWWXXXAPC., XXXCNZZZ, ss4000 recovery array

Links

XODOX
Impressum

#1: simulate button click

Posted on 2005-12-03 00:36:19 by xzzy

I have several pages in a frame and need the code behind of a page in one of
the frames to cause a button in that page to click so the javascript in that
button will execute on the client computer..

Thank you,

John Bickmore

Report this message

#2: Re: simulate button click

Posted on 2005-12-03 01:26:20 by Kevin Spencer

Use Page.RegisterStartupScript to add a JavaScript to the page that clicks
the button.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"xzzy" <mrbikejoc1@comcast.net> wrote in message
news:M4Sdna99w5XrRw3eRVn-vg@comcast.com...
>I have several pages in a frame and need the code behind of a page in one
>of
> the frames to cause a button in that page to click so the javascript in
> that
> button will execute on the client computer..
>
> Thank you,
>
> John Bickmore
>
>

Report this message

#3: Re: simulate button click

Posted on 2005-12-03 02:04:07 by Jim Suruda

John-

You can try something like such:

this.Response.Redirect("WebForm1.aspx?__EVENTTARGET=ButtonA" );

If you have a button called ButtonA, this code will redirect the browser
to WebForm1 and trigger the event handler for the button. (It is indeed
two underscores before EVENTTARGET)

Hope this helps,
Jim Suruda


On Fri, 2 Dec 2005, xzzy wrote:
> I have several pages in a frame and need the code behind of a page in one of
> the frames to cause a button in that page to click so the javascript in that
> button will execute on the client computer..
>
> Thank you,
>
> John Bickmore
>
>
>

Report this message

#4: Re: simulate button click

Posted on 2005-12-03 04:50:49 by xzzy

this.Response.Redirect("WebForm1.aspx?__EVENTTARGET=ButtonA" );

Does execute ButtonA 's code in that page after loading into the frame

but does not actually "click" ButtonA

I need to "click" ButtonA because it just had different javascript added to
Attributes that needs to be executed

Report this message

#5: Re: simulate button click

Posted on 2005-12-03 05:50:09 by xzzy

the next reply in the thread - from Jim Suruda -
that code does fire the code behind named ButtonA_OnClick, but it does not
click the button

clicking the button is important because
ButtonA just had different javascript added to Attributes that needs to
be executed


PS Kevin
> You can lead a fish to a bicycle, but you can't make it stink.

actually, you can lead a swimmer to a bicycle and they race faster in the
rain

Report this message

#6: Re: simulate button click

Posted on 2005-12-03 18:17:40 by Kevin Spencer

> PS Kevin
>> You can lead a fish to a bicycle, but you can't make it stink.
>
> actually, you can lead a swimmer to a bicycle and they race faster in the
> rain

Cute! But it doesn't sound anything like the original "horse to water"
saying. So, my Uncle Chutney would never go for it. He likes to play around
with old sayings, to give them new meaning. I must admit, though, the new
meaning in this case is a mystery to me! Oh well, as Uncle Chutney sez,
"Ambiguity has a certain quality to it."

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"xzzy" <mrbikejoc1@comcast.net> wrote in message
news:zdOdnV4QytecuQzeRVn-rQ@comcast.com...
> the next reply in the thread - from Jim Suruda -
> that code does fire the code behind named ButtonA_OnClick, but it does
> not
> click the button
>
> clicking the button is important because
> ButtonA just had different javascript added to Attributes that needs
> to
> be executed
>
>
> PS Kevin
>> You can lead a fish to a bicycle, but you can't make it stink.
>
> actually, you can lead a swimmer to a bicycle and they race faster in the
> rain
>
>
>

Report this message

#7: Re: simulate button click

Posted on 2005-12-03 18:57:37 by xzzy

Kevin, your suggestion about RegisterStartupScript got me thinking that if
I was okay with not clicking a button and thus having to load a different
page into that frame, then this works:

Thanks for your help,
John

PS I find it funny that the more I do .net, the more I learn Javascript



Code behind:
// the next line means: in this frame, replace the page belonging to
this code behind with Blank.htm
this.Response.Redirect("blank.htm");


Blank.htm
<script language="javascript">
function IveBeenSlimed()
{
do things here
}
</script>
<html>
<head>
<title></title>
</head>
<body onload="IveBeenSlimed()">
</body>
</html>

Report this message

#8: Re: simulate button click

Posted on 2005-12-03 20:25:59 by Kevin Spencer

Hi John,

> PS I find it funny that the more I do .net, the more I learn Javascript

Shouldn't be funny at all. It's not .Net per se, but ASP.Net. To do ASP.Net,
one must learn and understand a wide variety of disciplines, including HTML,
CSS, JavaScript, XML, HTTP, SOAP, web server technology, etc. It's a lot
harder than writing Windows desktop apps! I can't tell you how many hours
I've spent poring over sites like the W3C web site, the ECMA web site, etc.
etc. My voluminous collection of bookmarks speaks for itself!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but you can't make it stink.

"xzzy" <mrbikejoc1@comcast.net> wrote in message
news:p86dnTBfnOYOQQzenZ2dnUVZ_tOdnZ2d@comcast.com...
> Kevin, your suggestion about RegisterStartupScript got me thinking that
> if
> I was okay with not clicking a button and thus having to load a different
> page into that frame, then this works:
>
> Thanks for your help,
> John
>
> PS I find it funny that the more I do .net, the more I learn Javascript
>
>
>
> Code behind:
> // the next line means: in this frame, replace the page belonging to
> this code behind with Blank.htm
> this.Response.Redirect("blank.htm");
>
>
> Blank.htm
> <script language="javascript">
> function IveBeenSlimed()
> {
> do things here
> }
> </script>
> <html>
> <head>
> <title></title>
> </head>
> <body onload="IveBeenSlimed()">
> </body>
> </html>
>
>
>

Report this message