473,800 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

simulate button click

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
Dec 2 '05 #1
7 3620
John-

You can try something like such:

this.Response.R edirect("WebFor m1.aspx?__EVENT TARGET=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

Dec 3 '05 #2
Use Page.RegisterSt artupScript 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" <mr********@com cast.net> wrote in message
news:M4******** ************@co mcast.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

Dec 3 '05 #3
this.Response.R edirect("WebFor m1.aspx?__EVENT TARGET=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
Dec 3 '05 #4
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

Dec 3 '05 #5
> 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" <mr********@com cast.net> wrote in message
news:zd******** ************@co mcast.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

Dec 3 '05 #6
Kevin, your suggestion about RegisterStartup Script 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.R edirect("blank. htm");
Blank.htm
<script language="javas cript">
function IveBeenSlimed()
{
do things here
}
</script>
<html>
<head>
<title></title>
</head>
<body onload="IveBeen Slimed()">
</body>
</html>

Dec 3 '05 #7
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" <mr********@com cast.net> wrote in message
news:p8******** *************** *******@comcast .com... Kevin, your suggestion about RegisterStartup Script 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.R edirect("blank. htm");
Blank.htm
<script language="javas cript">
function IveBeenSlimed()
{
do things here
}
</script>
<html>
<head>
<title></title>
</head>
<body onload="IveBeen Slimed()">
</body>
</html>

Dec 3 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
5175
by: johnny | last post by:
On a form I would like to simulate a button click when the Enter is pressed. My form is setup and it works if the delegate for the key pressed on the form calls the delegate for the button pressed. But can we simulate a button click instead? This way if later the delegate is changed for the button, we don't forget to do the changes on other events?
5
818
by: Max | last post by:
Hi Is it possible to somehow simulate button click in C# Thanks
2
29496
by: Eli | last post by:
HI! I made some quiz using one HTML form (few question with few radio-button each like potential answers) that have one Submit button. I would like to simulate click on this button (e.g. named "Finish") after some time, 10 minute or so, which be equal like click on submit button and terminate quiz (open another page or so). I tried to solve it by JavaScript but won't, always error, like can't detect button like object. What to do? Listing...
3
29916
by: John Dalberg | last post by:
I have an app that keeps popping up a windows with a 'Yes' or 'OK' button on it. I am trying to write a little app that automates hitting the enter key so I don't have to do it myself. I used the FindWindow method to get a handle of the window and then issued: SendMessage(hwnd, 273, 0, IntPtr.Zero) to send an ENTER key to it but it didn't work. If I need to get the handle of the 'OK' button, how do I do it? (How do you
4
7518
by: flplini | last post by:
I want to ask how to use C++ to simulate the mouse control? ex:Let the mouse double-click the left key functions,thanks!
18
22121
by: eliss.carmine | last post by:
Is it possible to simulate a mouse click in the window I made (it's a Form), but not give it focus? I tried using WinAPI's mouseevent and SendMessage of WM_LBUTTONDOWN/WM_LBUTTONUP as suggested by the folks in #winapi on EFnet, but I think those require the window to have focus. Either that, or I'm doing something else wrong. The click actually seems to work once, and then stops working... I have no idea what is the problem actually....
9
3826
by: =?Utf-8?B?TWFyYyBXb29sZnNvbg==?= | last post by:
I have what seems to be a relatively simple problem when attempting to simulate a postback in ASP.NET from JavaScript. My scenario is (and please don't ask me why) that I have an HTML <a>nchor which is generated dynamically using the DOM, and when clicked should force an <asp:Buttonto do a postback so that some server-side processing can be done. The relevant JavaScript is below: function GetAnchor() { theAnchor =...
1
1909
by: Hooyoo | last post by:
Hi, everyone. I want "steal" data from a web page :), but their data are stored in a data grid, and more than 1,000 pages in the data grid. Everytime I need click "Next Page" to view next page data. Would you please share me a free application to simulate this button click operation? I hope this application also can save the page content after a button click. If you can tell me how to DIY such a simulator, I will appreciate you more...
5
30698
by: nuhfeken | last post by:
We have a C# winform that uses the MVP design pattern for the user interface. For reasons I'd rather not explain we need to simulate a right mouse click on a specific control to deactivate the control. I found code that almost does what we need. private static extern void mouse_event( UInt32 dwFlags, // motion and click options UInt32 dx, // horizontal position or change UInt32 dy, //...
0
9690
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10251
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10033
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.