simulate button click

simulate button click

am 03.12.2005 00:36:19 von 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

Re: simulate button click

am 03.12.2005 01:26:20 von 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" 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
>
>

Re: simulate button click

am 03.12.2005 02:04:07 von 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
>
>
>

Re: simulate button click

am 03.12.2005 04:50:49 von 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

Re: simulate button click

am 03.12.2005 05:50:09 von 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

Re: simulate button click

am 03.12.2005 18:17:40 von 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" 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
>
>
>

Re: simulate button click

am 03.12.2005 18:57:37 von 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







Re: simulate button click

am 03.12.2005 20:25:59 von 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" 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
>
>
>
>
>
>
>
>
>
>
>