473,326 Members | 2,175 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,326 software developers and data experts.

Invoke C#-Function calls in aspx pages

hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing,
lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro
Nov 16 '05 #1
8 1154
Hi Sandro

Is this what you mean?
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///

Grant

"Sandro" <sa******@gmx.ch> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing,
lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro

Nov 16 '05 #2
hello GrantMagic

thx for you reply...

hmmm, well not exactly.

i have businesslogic implemented in my c# codebehind page(s). now on the
client i want to call one of those functions
depending on the user action on the client.

any further hint?

tia
sandro
"GrantMagic" <gr***@magicalia.com> schrieb im Newsbeitrag
news:Ow**************@TK2MSFTNGP14.phx.gbl...
Hi Sandro

Is this what you mean?
\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');} </script>"
RegisterStartupScript("Startup", str)
///

Grant

"Sandro" <sa******@gmx.ch> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing, lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro


Nov 16 '05 #3
Hi,
Well, I'm not very sure what you want to do, if you use webcontrols then
you can perform actions in the server depending of the user actions.
Be aware of one thing, it does mean that the page will need to be reloaded .
you have to think carefuly how to implement it.

if this does not solve your problem, just post back with more especific
details.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Sandro" <sa******@gmx.ch> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
hello GrantMagic

thx for you reply...

hmmm, well not exactly.

i have businesslogic implemented in my c# codebehind page(s). now on the
client i want to call one of those functions
depending on the user action on the client.

any further hint?

tia
sandro
"GrantMagic" <gr***@magicalia.com> schrieb im Newsbeitrag
news:Ow**************@TK2MSFTNGP14.phx.gbl...
Hi Sandro

Is this what you mean?
\\\
Dim str As String
str = "<script language=javascript>

{window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///

Grant

"Sandro" <sa******@gmx.ch> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any other better way?

there any links leading to good samples, components, sources implementing, lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro



Nov 16 '05 #4
hello,

well, not easy to explain :-)

lets assume, that i use an third party component (DbNetGrid) which is
implemented as a DHTML behaviour
(*.htc). This grid uses a compiled .Net assembly written in C# and using
ADO.NET to connect to the database.

Because this grid is implemented as DHTML behaviour it cannot be added to
the VS.NET toolbox. It can however still be used
within VS.NET projects.

#############
Adding DbNetGrid to a web page consists of 2 basic steps:
(1)
Define the HTML element that will act as the container for the grid. Any
HTML element that supports the innerHTML property can be used e.g <DIV> or
<TD>. The
element must have two properties set:

It must be given a unique 'id' value. This will allow it to be addressed
correctly when accessed from the client-side script.
The component must be attached to the element using the behavior property of
the style object. e.g.

<div id=dbnetgrid1 style='behavior:url(/dbnetgrid/dbnetgrid.htc)'></div>

The url given must correspond to the virtual directory in which DbNetGrid
has been installed. For example, the url for DbNetGrid.Net would typically
be /dbnetgrid/dbnetgrid.htc

If you create applications outside of the DbNetGrid installation folder you
do not need to copy any DbNetGrid files to your project folder. All
DbNetGrid functionality is reference by the full
path assigned to the url property of the behavior.

(2)
The second step is to use some client script to initialise any other
properties on the grid and call the loadData method to populate the grid.
This would typically be placed in a function
that is called by the onload event of the body tag. e.g.

....
<script language=JScript>
function initialise()
{
with (document.all.dbnetgrid1)
{
connectionString = "samples"
fromPart = "customers"
loadData()
}
}
</script>
</head>>
<body onload=initialise()>
....

#############

the whole grid is configured, initialized and controled via jscript on the
client. the problem now is that i have businesslogik which i want
to fire which has to act in relation with data located in the grid on the
client.

considering the fact, that this grid isn't instantiated in my aspx-page
during design time, i need the possibility to "interact" with this grid.

this means, that i explictly have to call functions which are implemented by
my ClassFileXYZ.aspx.cs, respectively
are located in the .net assembly-dll.

Lets say the user selects a record in the grid, clicks on a customized
grid-button and then a specific function (from my codebehind page)
should be called with the id of the selected record as parameter.

any further ideas?

tia
sandro
Nov 16 '05 #5
There used to be something called "Remote scripting" which was done to call
methods on server side without reloading the client pages. If that is what
you are looking for, you will need to basically implement your own.

1. Implement the methods in C# and make it a web service. [Be sure to
enable HttpGet or HttpPost so that you dont have to incur the SOAP call
things]

2. Make up a jscript which knows the Url for 1 and does a request to that
URL either use XmlHttp or any of the number of COM objects available on the
client side. Process the response.
(or, you can just use postback events and implement the methods on server
side and reload the page).


--
Girish Bharadwaj
http://msmvps.com/gbvb
"Sandro" <sa******@gmx.ch> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing,
lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro

Nov 16 '05 #6
you can use XmlHttp, but service packs are getting more restrictive, and
your users may get an alert. a hidden iframe is probably the best way to go.
this is the approach used by smart nav. you can create a seperate form and
fields (don't use runat=server) that the client script posts. then when the
postback is rendered, call client script in the parent to access the
postback data.

-- bruce (sqlwork.com)

"Sandro" <sa******@gmx.ch> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing,
lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro

Nov 16 '05 #7
hello,

thanx for the replies.

i just have read an article discussing "Webservice Behaviour" -> client-side
script to invoke remote methods exposed by Web Services

http://msdn.microsoft.com/library/de...node_entry.asp

what do you think about this possibility?

tia
sandro
"Sandro" <sa******@gmx.ch> schrieb im Newsbeitrag
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing,
lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro

Nov 16 '05 #8
Oh,yeah. Just make sure that you test it on XP sp2. I believe there were
some fixes around here.

--
Girish Bharadwaj
http://msmvps.com/gbvb
"Sandro" <sa******@gmx.ch> wrote in message
news:Oq****************@TK2MSFTNGP09.phx.gbl...
hello,

thanx for the replies.

i just have read an article discussing "Webservice Behaviour" -> client-side script to invoke remote methods exposed by Web Services

http://msdn.microsoft.com/library/de...node_entry.asp
what do you think about this possibility?

tia
sandro
"Sandro" <sa******@gmx.ch> schrieb im Newsbeitrag
news:e$**************@TK2MSFTNGP11.phx.gbl...
hello ng

i know, probably i am not the first asking about this, but i am really
dependent on it.

i have an asp.net application (aspx/jscript with c# codebehind) and i am
searching for a possibility
to invoke c# funtioncalls in the jscript-code.

as i know there is a possible way by using XmlHttp, but isn't there any
other better way?

there any links leading to good samples, components, sources implementing, lets say com-components, dealing with
this?

any help/hint is really appreciated

tia
sandro


Nov 16 '05 #9

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

Similar topics

1
by: John Altland | last post by:
Here is my basic problem. I have a form that executes a cpu instensive algorithm occupying the first thread. When the algorithm is executed another form pops up telling the user the progress that...
10
by: Charles Law | last post by:
I have a user control created on the main thread. Let's say, for arguments sake, that it has a single property that maintains a private variable. If I want to set that property from a worker...
2
by: Tom | last post by:
Hi Everybod I want to update some controls in a form from another threads. I did it by passing the form to that thread and calling a delegate with Form1.Invoke, I want to have just one delegeate...
5
by: RickDee | last post by:
Please help, anybody. I am trying to write a program so that it can launch an exe file ( which is also genereated in C# ) and then simulate the button clicking and invoke the methods inside the...
2
by: rawCoder | last post by:
Hi I am having this InvalidOperationException with message Cannot call Invoke or InvokeAsync on a control until the window handle has been created This is raised when i try to invoke a method...
3
by: Manfred Braun | last post by:
Hi All, I am able to invoke some methods from an instance of a loaded assembly, but I am not able to invoke the loaded assemblie's "Main" method. I try it this way: Assembly assembly =...
14
by: stic | last post by:
Hi, I'm in a middle of writing something like 'exception handler wraper' for a set of different methodes. The case is that I have ca. 40 methods form web servicem, with different return values...
3
by: m.posseth | last post by:
Hello does someone know how i can invoke a method in the underlying thread without the usage of a window handle ?? This works perfect in a form Me.Invoke(New MethodInvoker(AddressOf...
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...
2
by: =?Utf-8?B?a2VubmV0aG1Abm9zcGFtLm5vc3BhbQ==?= | last post by:
vs2005, c# Trying to understand why one way works but the other doesnt. I have not tried to create a simpler mdi/child/showdialog app for posting purposes (I think even this would not be so small...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.