473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using Invoke

Hello everyone,
While loading a page
(http://www.edmonton.ca/portal/server...ommunityID=239)
into a webbrowser control I use invokemember on the 'onclick' event from
'cmdBusStopScheduleSubmit' element - see below.
ONCLICK
=========
<input type="submit" name="cmdBusStopScheduleSubmit" value="Get Bus Stop
Schedule" id="cmdBusStopScheduleSubmit" class="formBtnText"
onclick="if (ValidateBusStopSchedule())
{
gfnTransit_SwitchPostBackUrl('BusStopSchedule.aspx |BusStopLookup.aspx','BusStopSchedule_Results.aspx ','frmBusStopScheduleForm','_blank','NOVIEWSTATE') ;
}
else {
return false;
}"
style="height:40px;width:155px;" />
FUNCTIONS
===========
I have located the two functions inside the onclick event:

function RouteSchedulePostBack(eventTarget, eventArgument,strFormName,
strTargetField, strTargetValue)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
//check if value needs to be passed through to form submit
if (strTargetField != '')
theform[strTargetField].value = strTargetValue;
theform.submit();
}

function gfnTransit__doPostBack(eventTarget, eventArgument, strFormName) {
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The page does not refresh nor does it load any other page. However, if I use
Focus and have the cmdBusStopSchedule focused, I can press the space bar and
it will work as planned. If I leave the Bus Stop field empty, I get an alert
with either method - Invokemember or focus/space bar.

It must be the gfnTransit or the RouteSchedulePostBack functions. What I do
not understand is why the Focus and Space bar makes a difference? Is it
possible to remove the onclick event and put in my own? I just want the
BusStopSchedule.aspx to run.

Would it be best to find a javascript form?

Any thoughts would be apreciated...

-James
Jun 27 '08 #1
4 1718
The terms you are using are very confusing. Web browser control is typically
a windows browser control used to navigate a web page, Invoke as well is
something different than what you use here. Point is, after looking at the
code, I think you are referring to an ordinary web page and a web control
right? If that's the case, your if statement is evaluating to false on the
first call. When you press spacebar it is evaluating to true. Why? You'd
need to debug ValidateBusStopSchedule() to find the reason.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:82**********************************@microsof t.com...
Hello everyone,
While loading a page
(http://www.edmonton.ca/portal/server...ommunityID=239)
into a webbrowser control I use invokemember on the 'onclick' event from
'cmdBusStopScheduleSubmit' element - see below.
ONCLICK
=========
<input type="submit" name="cmdBusStopScheduleSubmit" value="Get Bus Stop
Schedule" id="cmdBusStopScheduleSubmit" class="formBtnText"
onclick="if (ValidateBusStopSchedule())
{
gfnTransit_SwitchPostBackUrl('BusStopSchedule.aspx |BusStopLookup.aspx','BusStopSchedule_Results.aspx ','frmBusStopScheduleForm','_blank','NOVIEWSTATE') ;
}
else {
return false;
}"
style="height:40px;width:155px;" />
FUNCTIONS
===========
I have located the two functions inside the onclick event:

function RouteSchedulePostBack(eventTarget, eventArgument,strFormName,
strTargetField, strTargetValue)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
//check if value needs to be passed through to form submit
if (strTargetField != '')
theform[strTargetField].value = strTargetValue;
theform.submit();
}

function gfnTransit__doPostBack(eventTarget, eventArgument, strFormName) {
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The page does not refresh nor does it load any other page. However, if I
use Focus and have the cmdBusStopSchedule focused, I can press the space
bar and it will work as planned. If I leave the Bus Stop field empty, I
get an alert with either method - Invokemember or focus/space bar.

It must be the gfnTransit or the RouteSchedulePostBack functions. What I
do not understand is why the Focus and Space bar makes a difference? Is it
possible to remove the onclick event and put in my own? I just want the
BusStopSchedule.aspx to run.

Would it be best to find a javascript form?

Any thoughts would be apreciated...

-James

Jun 27 '08 #2
Thanks for your reply Alvin,
I am using a web browser control. I am using the InvokeMember method. The
problem is I cannot dig deeper into the web page as it is not mine - just
public access. Was thinking about something like:

cmdFirst.Attributes.Remove("onclick")
cmdFirst.Attributes.Add("onclick", "BusStopSchedule_Results.aspx")

I suspect this would fail as I would need access rights to Remove/Add a new
onclick event. Do you think it would be possible to setup a delagate for the
onclick to insure the BusStopSchedule.aspx is run (MyClick.Invoke)?

Have you used either method successfully on a public webpage?


"Alvin Bruney [ASP.NET MVP]" <vapor dan using hot male spam filterwrote in
message news:12**********************************@microsof t.com...
The terms you are using are very confusing. Web browser control is
typically a windows browser control used to navigate a web page, Invoke as
well is something different than what you use here. Point is, after
looking at the code, I think you are referring to an ordinary web page and
a web control right? If that's the case, your if statement is evaluating
to false on the first call. When you press spacebar it is evaluating to
true. Why? You'd need to debug ValidateBusStopSchedule() to find the
reason.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:82**********************************@microsof t.com...
>Hello everyone,
While loading a page
(http://www.edmonton.ca/portal/server...ommunityID=239)
into a webbrowser control I use invokemember on the 'onclick' event from
'cmdBusStopScheduleSubmit' element - see below.
ONCLICK
=========
<input type="submit" name="cmdBusStopScheduleSubmit" value="Get Bus Stop
Schedule" id="cmdBusStopScheduleSubmit" class="formBtnText"
onclick="if (ValidateBusStopSchedule())
{
gfnTransit_SwitchPostBackUrl('BusStopSchedule.asp x|BusStopLookup.aspx','BusStopSchedule_Results.asp x','frmBusStopScheduleForm','_blank','NOVIEWSTATE' );
}
else {
return false;
}"
style="height:40px;width:155px;" />
FUNCTIONS
===========
I have located the two functions inside the onclick event:

function RouteSchedulePostBack(eventTarget, eventArgument,strFormName,
strTargetField, strTargetValue)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
//check if value needs to be passed through to form submit
if (strTargetField != '')
theform[strTargetField].value = strTargetValue;
theform.submit();
}

function gfnTransit__doPostBack(eventTarget, eventArgument, strFormName)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The page does not refresh nor does it load any other page. However, if I
use Focus and have the cmdBusStopSchedule focused, I can press the space
bar and it will work as planned. If I leave the Bus Stop field empty, I
get an alert with either method - Invokemember or focus/space bar.

It must be the gfnTransit or the RouteSchedulePostBack functions. What I
do not understand is why the Focus and Space bar makes a difference? Is
it possible to remove the onclick event and put in my own? I just want
the BusStopSchedule.aspx to run.

Would it be best to find a javascript form?

Any thoughts would be apreciated...

-James

Jun 27 '08 #3
So you have a webbrowser control that loads someone else's page and when a
button on that web page is clicked, you want it to run your code? Did I get
that right? That's an odd request. You can't attach to their handler because
the events aren't exposed to you. hmm, I'm lost here. totally.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:72**********************************@microsof t.com...
Thanks for your reply Alvin,
I am using a web browser control. I am using the InvokeMember method. The
problem is I cannot dig deeper into the web page as it is not mine - just
public access. Was thinking about something like:

cmdFirst.Attributes.Remove("onclick")
cmdFirst.Attributes.Add("onclick", "BusStopSchedule_Results.aspx")

I suspect this would fail as I would need access rights to Remove/Add a
new onclick event. Do you think it would be possible to setup a delagate
for the onclick to insure the BusStopSchedule.aspx is run
(MyClick.Invoke)?

Have you used either method successfully on a public webpage?


"Alvin Bruney [ASP.NET MVP]" <vapor dan using hot male spam filterwrote
in message news:12**********************************@microsof t.com...
>The terms you are using are very confusing. Web browser control is
typically a windows browser control used to navigate a web page, Invoke
as well is something different than what you use here. Point is, after
looking at the code, I think you are referring to an ordinary web page
and a web control right? If that's the case, your if statement is
evaluating to false on the first call. When you press spacebar it is
evaluating to true. Why? You'd need to debug ValidateBusStopSchedule() to
find the reason.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:82**********************************@microso ft.com...
>>Hello everyone,
While loading a page
(http://www.edmonton.ca/portal/server...ommunityID=239)
into a webbrowser control I use invokemember on the 'onclick' event from
'cmdBusStopScheduleSubmit' element - see below.
ONCLICK
=========
<input type="submit" name="cmdBusStopScheduleSubmit" value="Get Bus Stop
Schedule" id="cmdBusStopScheduleSubmit" class="formBtnText"
onclick="if (ValidateBusStopSchedule())
{
gfnTransit_SwitchPostBackUrl('BusStopSchedule.as px|BusStopLookup.aspx','BusStopSchedule_Results.as px','frmBusStopScheduleForm','_blank','NOVIEWSTATE ');
}
else {
return false;
}"
style="height:40px;width:155px;" />
FUNCTIONS
===========
I have located the two functions inside the onclick event:

function RouteSchedulePostBack(eventTarget, eventArgument,strFormName,
strTargetField, strTargetValue)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
//check if value needs to be passed through to form submit
if (strTargetField != '')
theform[strTargetField].value = strTargetValue;
theform.submit();
}

function gfnTransit__doPostBack(eventTarget, eventArgument, strFormName)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The page does not refresh nor does it load any other page. However, if I
use Focus and have the cmdBusStopSchedule focused, I can press the space
bar and it will work as planned. If I leave the Bus Stop field empty, I
get an alert with either method - Invokemember or focus/space bar.

It must be the gfnTransit or the RouteSchedulePostBack functions. What I
do not understand is why the Focus and Space bar makes a difference? Is
it possible to remove the onclick event and put in my own? I just want
the BusStopSchedule.aspx to run.

Would it be best to find a javascript form?

Any thoughts would be apreciated...

-James

Jun 27 '08 #4
Sorry for the late reply Alvin. Comes down to the scripts the webmaster is
running. I get two different results. 1) clicking mouse, new page loads with
info; 2) using the invokemember I get nothing. However, there is a
validation function that runs first, using either method that works.

I have given up an sent them an email to see if web-services are in their
future... the webpage is for a local bus transit schedule.

Thanks for you assistance Alvin, and again sorry for the late reply.

"Alvin Bruney [ASP.NET MVP]" <vapor dan using hot male spam filterwrote in
message news:7D**********************************@microsof t.com...
So you have a webbrowser control that loads someone else's page and when a
button on that web page is clicked, you want it to run your code? Did I
get that right? That's an odd request. You can't attach to their handler
because the events aren't exposed to you. hmm, I'm lost here. totally.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:72**********************************@microsof t.com...
>Thanks for your reply Alvin,
I am using a web browser control. I am using the InvokeMember method. The
problem is I cannot dig deeper into the web page as it is not mine - just
public access. Was thinking about something like:

cmdFirst.Attributes.Remove("onclick")
cmdFirst.Attributes.Add("onclick", "BusStopSchedule_Results.aspx")

I suspect this would fail as I would need access rights to Remove/Add a
new onclick event. Do you think it would be possible to setup a delagate
for the onclick to insure the BusStopSchedule.aspx is run
(MyClick.Invoke)?

Have you used either method successfully on a public webpage?


"Alvin Bruney [ASP.NET MVP]" <vapor dan using hot male spam filterwrote
in message news:12**********************************@microsof t.com...
>>The terms you are using are very confusing. Web browser control is
typically a windows browser control used to navigate a web page, Invoke
as well is something different than what you use here. Point is, after
looking at the code, I think you are referring to an ordinary web page
and a web control right? If that's the case, your if statement is
evaluating to false on the first call. When you press spacebar it is
evaluating to true. Why? You'd need to debug ValidateBusStopSchedule()
to find the reason.

--

Regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
The O.W.C. Black Book, 2nd Edition
Exclusively on www.lulu.com/owc $19.99
-------------------------------------------------------
"James" <ja**********@hotmail.comiwrote in message
news:82**********************************@micros oft.com...
Hello everyone,
While loading a page
(http://www.edmonton.ca/portal/server...ommunityID=239)
into a webbrowser control I use invokemember on the 'onclick' event
from 'cmdBusStopScheduleSubmit' element - see below.
ONCLICK
=========
<input type="submit" name="cmdBusStopScheduleSubmit" value="Get Bus
Stop
Schedule" id="cmdBusStopScheduleSubmit" class="formBtnText"
onclick="if (ValidateBusStopSchedule())
{
gfnTransit_SwitchPostBackUrl('BusStopSchedule.a spx|BusStopLookup.aspx','BusStopSchedule_Results.a spx','frmBusStopScheduleForm','_blank','NOVIEWSTAT E');
}
else {
return false;
}"
style="height:40px;width:155px;" />
FUNCTIONS
===========
I have located the two functions inside the onclick event:

function RouteSchedulePostBack(eventTarget, eventArgument,strFormName,
strTargetField, strTargetValue)
{
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget.replace(/\$/g, ":");
theform.__EVENTARGUMENT.value = eventArgument;
//check if value needs to be passed through to form submit
if (strTargetField != '')
theform[strTargetField].value = strTargetValue;
theform.submit();
}

function gfnTransit__doPostBack(eventTarget, eventArgument,
strFormName) {
var theform = document.forms[strFormName];
theform.__EVENTTARGET.value = eventTarget;
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}

The page does not refresh nor does it load any other page. However, if
I use Focus and have the cmdBusStopSchedule focused, I can press the
space bar and it will work as planned. If I leave the Bus Stop field
empty, I get an alert with either method - Invokemember or focus/space
bar.

It must be the gfnTransit or the RouteSchedulePostBack functions. What
I do not understand is why the Focus and Space bar makes a difference?
Is it possible to remove the onclick event and put in my own? I just
want the BusStopSchedule.aspx to run.

Would it be best to find a javascript form?

Any thoughts would be apreciated...

-James

Jun 27 '08 #5

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

Similar topics

11
by: JPRoot | last post by:
Hi I wish to set/get a property using System.ComponentModel.ISynchronizeInvoke.Invoke but I cannot find the exact syntax.. Any clue how to do this (right now I am making GetEnabled/SetEnabled...
23
by: Thomas Due | last post by:
Hi, I have a class which monitors a TCP socket. This will on occasion raise an event which can be handled by a GUI. Now, I am aware of the if(InvokeRequire) { EventHandler d = new...
3
by: =?Utf-8?B?Sm9l?= | last post by:
I know that I have posted this question before, but it is still unresolved and I don't know where to turn to next. I have code that is creating a user (works fine), then sets the account flags...
3
by: Phillip Taylor | last post by:
I'm having a problem with this code. I can't really understand why it won't work if, for example, I pass in a linked list of 0 records. Public Sub ConversionUpdateComplete(ByRef records As...
5
by: iLL | last post by:
So why is it that we need to use the Invoke method when updating the GUI? The following is the way we are suppose to update GUI components: delegate void textIt(object o); public partial...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.