By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,503 Members | 1,278 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,503 IT Pros & Developers. It's quick & easy.

What happened to client side code???

P: n/a
I am having a really hard time trying to get some client side code hooked up
in VS2005, ASP 2.0.

The code is in an .inc file (vbscript). The first problem I am encountering
is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
Second, the page throws fits about the server side code tags (<% ...
%>),...are these supported anymore? Third, when I set the onclick event of a
client side HTML button it does not recognize the "public" method that I
specify (that is in the include file). I feel like there is some key piece of
information that I am missing that will make all of these issues fall into
place.

Essentially, what I need to do is access one or more local files on the
computer based on parameters that are sent to the server for processing. For
example, if a user clicks on a link I can pass a parameter to the server that
specifies the report the user is requesting, I can then return some
information about where to get the report (the file path...on another Report
Server), and then also where to put this report on the Users machine (client
code).

When I implemented this in ASP, I got it to work flawlessly and I was able
to do some string manipulation to get the client side code and the server
side code to work together nicely. I would like to get it updated to work
with our new ASP 2.0 webpages.

Any ideas on "re-inventing the wheel" in .NET?
Thanks,
- Mike

Jan 23 '06 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Just use the Page.ClientScript.RegisterClientScriptBlock to embed your client
script into the page. You can do this in the Page_Load event handler. You can
even load the script text from a file off the file system if you want.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
I am having a really hard time trying to get some client side code hooked up
in VS2005, ASP 2.0.

The code is in an .inc file (vbscript). The first problem I am encountering
is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
Second, the page throws fits about the server side code tags (<% ...
%>),...are these supported anymore? Third, when I set the onclick event of a
client side HTML button it does not recognize the "public" method that I
specify (that is in the include file). I feel like there is some key piece of
information that I am missing that will make all of these issues fall into
place.

Essentially, what I need to do is access one or more local files on the
computer based on parameters that are sent to the server for processing. For
example, if a user clicks on a link I can pass a parameter to the server that
specifies the report the user is requesting, I can then return some
information about where to get the report (the file path...on another Report
Server), and then also where to put this report on the Users machine (client
code).

When I implemented this in ASP, I got it to work flawlessly and I was able
to do some string manipulation to get the client side code and the server
side code to work together nicely. I would like to get it updated to work
with our new ASP 2.0 webpages.

Any ideas on "re-inventing the wheel" in .NET?
Thanks,
- Mike

Jan 24 '06 #2

P: n/a
Peter,
Thanks for the suggestion. It did get me further than I was. But, I am still
running into at least one issue. I can see the client code when I View Source
on the page. The problem seems to be that the client side button control does
not see the method that I am calling. When I run the project an error comes
up on the onclick="SystemTest()", when I highlight the onclick to get more
info. it just shows {...} and no further information on the error. (Note, the
script was in vbscript, but I updated it to work with VB.)

Here is the sample code:
....
<SCRIPT LANGUAGE="VB">
Sub TestSystem()

Dim shl_Test As Object
Dim lExecRet_Test AS Long
Dim sCalc_Path As String

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

Any ideas?
Thanks,
- Mike
"Peter Bromberg [C# MVP]" wrote:
Just use the Page.ClientScript.RegisterClientScriptBlock to embed your client
script into the page. You can do this in the Page_Load event handler. You can
even load the script text from a file off the file system if you want.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
I am having a really hard time trying to get some client side code hooked up
in VS2005, ASP 2.0.

The code is in an .inc file (vbscript). The first problem I am encountering
is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
Second, the page throws fits about the server side code tags (<% ...
%>),...are these supported anymore? Third, when I set the onclick event of a
client side HTML button it does not recognize the "public" method that I
specify (that is in the include file). I feel like there is some key piece of
information that I am missing that will make all of these issues fall into
place.

Essentially, what I need to do is access one or more local files on the
computer based on parameters that are sent to the server for processing. For
example, if a user clicks on a link I can pass a parameter to the server that
specifies the report the user is requesting, I can then return some
information about where to get the report (the file path...on another Report
Server), and then also where to put this report on the Users machine (client
code).

When I implemented this in ASP, I got it to work flawlessly and I was able
to do some string manipulation to get the client side code and the server
side code to work together nicely. I would like to get it updated to work
with our new ASP 2.0 webpages.

Any ideas on "re-inventing the wheel" in .NET?
Thanks,
- Mike

Jan 24 '06 #3

P: n/a
Try this:

<SCRIPT LANGUAGE="VBScript">
Sub TestSystem()
Dim shl_Test
Dim lExecRet_Test
Dim sCalc_Path

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
set shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
Peter,
Thanks for the suggestion. It did get me further than I was. But, I am still
running into at least one issue. I can see the client code when I View Source
on the page. The problem seems to be that the client side button control does
not see the method that I am calling. When I run the project an error comes
up on the onclick="SystemTest()", when I highlight the onclick to get more
info. it just shows {...} and no further information on the error. (Note, the
script was in vbscript, but I updated it to work with VB.)

Here is the sample code:
...
<SCRIPT LANGUAGE="VB">
Sub TestSystem()

Dim shl_Test As Object
Dim lExecRet_Test AS Long
Dim sCalc_Path As String

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

Any ideas?
Thanks,
- Mike
"Peter Bromberg [C# MVP]" wrote:
Just use the Page.ClientScript.RegisterClientScriptBlock to embed your client
script into the page. You can do this in the Page_Load event handler. You can
even load the script text from a file off the file system if you want.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
I am having a really hard time trying to get some client side code hooked up
in VS2005, ASP 2.0.

The code is in an .inc file (vbscript). The first problem I am encountering
is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
Second, the page throws fits about the server side code tags (<% ...
%>),...are these supported anymore? Third, when I set the onclick event of a
client side HTML button it does not recognize the "public" method that I
specify (that is in the include file). I feel like there is some key piece of
information that I am missing that will make all of these issues fall into
place.

Essentially, what I need to do is access one or more local files on the
computer based on parameters that are sent to the server for processing. For
example, if a user clicks on a link I can pass a parameter to the server that
specifies the report the user is requesting, I can then return some
information about where to get the report (the file path...on another Report
Server), and then also where to put this report on the Users machine (client
code).

When I implemented this in ASP, I got it to work flawlessly and I was able
to do some string manipulation to get the client side code and the server
side code to work together nicely. I would like to get it updated to work
with our new ASP 2.0 webpages.

Any ideas on "re-inventing the wheel" in .NET?
Thanks,
- Mike

Jan 24 '06 #4

P: n/a
Peter,
Thanks. I got it working. I pasted the code into the page, rather than using
the Register method and then realized that the code was the problem. More
specifically the language tag, the script tag being capatilized and the
absence of the type attribute (the code I used was my original vbscript
code). Once I got those sorted out, it worked nicely. Then I moved it back to
the include file and used the Register method and it worked fine.
Thanks for taking the time on this, I really appreciate it!
- Mike

"Peter Bromberg [C# MVP]" wrote:
Try this:

<SCRIPT LANGUAGE="VBScript">
Sub TestSystem()
Dim shl_Test
Dim lExecRet_Test
Dim sCalc_Path

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
set shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
Peter,
Thanks for the suggestion. It did get me further than I was. But, I am still
running into at least one issue. I can see the client code when I View Source
on the page. The problem seems to be that the client side button control does
not see the method that I am calling. When I run the project an error comes
up on the onclick="SystemTest()", when I highlight the onclick to get more
info. it just shows {...} and no further information on the error. (Note, the
script was in vbscript, but I updated it to work with VB.)

Here is the sample code:
...
<SCRIPT LANGUAGE="VB">
Sub TestSystem()

Dim shl_Test As Object
Dim lExecRet_Test AS Long
Dim sCalc_Path As String

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

Any ideas?
Thanks,
- Mike
"Peter Bromberg [C# MVP]" wrote:
Just use the Page.ClientScript.RegisterClientScriptBlock to embed your client
script into the page. You can do this in the Page_Load event handler. You can
even load the script text from a file off the file system if you want.

Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:

> I am having a really hard time trying to get some client side code hooked up
> in VS2005, ASP 2.0.
>
> The code is in an .inc file (vbscript). The first problem I am encountering
> is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
> Second, the page throws fits about the server side code tags (<% ...
> %>),...are these supported anymore? Third, when I set the onclick event of a
> client side HTML button it does not recognize the "public" method that I
> specify (that is in the include file). I feel like there is some key piece of
> information that I am missing that will make all of these issues fall into
> place.
>
> Essentially, what I need to do is access one or more local files on the
> computer based on parameters that are sent to the server for processing. For
> example, if a user clicks on a link I can pass a parameter to the server that
> specifies the report the user is requesting, I can then return some
> information about where to get the report (the file path...on another Report
> Server), and then also where to put this report on the Users machine (client
> code).
>
> When I implemented this in ASP, I got it to work flawlessly and I was able
> to do some string manipulation to get the client side code and the server
> side code to work together nicely. I would like to get it updated to work
> with our new ASP 2.0 webpages.
>
> Any ideas on "re-inventing the wheel" in .NET?
> Thanks,
> - Mike
>

Jan 25 '06 #5

P: n/a
Is it possible to translate that script in javascript?
--
JLobo
"Peter Bromberg [C# MVP]" wrote:
Try this:

<SCRIPT LANGUAGE="VBScript">
Sub TestSystem()
Dim shl_Test
Dim lExecRet_Test
Dim sCalc_Path

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
set shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Mike Rand" wrote:
Peter,
Thanks for the suggestion. It did get me further than I was. But, I am still
running into at least one issue. I can see the client code when I View Source
on the page. The problem seems to be that the client side button control does
not see the method that I am calling. When I run the project an error comes
up on the onclick="SystemTest()", when I highlight the onclick to get more
info. it just shows {...} and no further information on the error. (Note, the
script was in vbscript, but I updated it to work with VB.)

Here is the sample code:
...
<SCRIPT LANGUAGE="VB">
Sub TestSystem()

Dim shl_Test As Object
Dim lExecRet_Test AS Long
Dim sCalc_Path As String

sCalc_Path = "C:\WINDOWS\system32\calc.exe"
shl_Test = CreateObject("WScript.Shell")
lExecRet_Test = Shl_Test.Run(sCalc_Path,1,true)

END Sub
</SCRIPT>
<div>
<input id="Button1" style="z-index: 100; left: 136px; width: 155px;
position: absolute;
top: 106px; height: 57px" type="button" value="button"
onclick="TestSystem()" />
</div>
</form>
</body>
</html>

Any ideas?
Thanks,
- Mike
"Peter Bromberg [C# MVP]" wrote:
Just use the Page.ClientScript.RegisterClientScriptBlock to embed your client
script into the page. You can do this in the Page_Load event handler. You can
even load the script text from a file off the file system if you want.
>
Peter
>
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com
>
>
>
>
"Mike Rand" wrote:
>
I am having a really hard time trying to get some client side code hooked up
in VS2005, ASP 2.0.

The code is in an .inc file (vbscript). The first problem I am encountering
is the ASP.NET page doesn't like vbscript and throws fits about the syntax.
Second, the page throws fits about the server side code tags (<% ...
%>),...are these supported anymore? Third, when I set the onclick event of a
client side HTML button it does not recognize the "public" method that I
specify (that is in the include file). I feel like there is some key piece of
information that I am missing that will make all of these issues fall into
place.

Essentially, what I need to do is access one or more local files on the
computer based on parameters that are sent to the server for processing. For
example, if a user clicks on a link I can pass a parameter to the server that
specifies the report the user is requesting, I can then return some
information about where to get the report (the file path...on another Report
Server), and then also where to put this report on the Users machine (client
code).

When I implemented this in ASP, I got it to work flawlessly and I was able
to do some string manipulation to get the client side code and the server
side code to work together nicely. I would like to get it updated to work
with our new ASP 2.0 webpages.

Any ideas on "re-inventing the wheel" in .NET?
Thanks,
- Mike
Sep 20 '07 #6

P: n/a
"JLobo" <JL***@discussions.microsoft.comwrote in message
news:0F**********************************@microsof t.com...
Is it possible to translate that script in javascript?
<script type="text/javascript>
function TestSystem()
{
var shl_Test;
var lExecRet_Test;
var sCalc_Path;

sCalc_Path = "C:\\WINDOWS\\system32\\calc.exe";
shl_Test = new ActiveXObject("WScript.Shell");
lExecRet_Test = shl_Test.Run(sCalc_Path,1,true);
}
</script>

N. B. I haven't tested this...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 20 '07 #7

P: n/a
Thank you, it works.
--
JLobo
"Mark Rae [MVP]" wrote:
"JLobo" <JL***@discussions.microsoft.comwrote in message
news:0F**********************************@microsof t.com...
Is it possible to translate that script in javascript?

<script type="text/javascript>
function TestSystem()
{
var shl_Test;
var lExecRet_Test;
var sCalc_Path;

sCalc_Path = "C:\\WINDOWS\\system32\\calc.exe";
shl_Test = new ActiveXObject("WScript.Shell");
lExecRet_Test = shl_Test.Run(sCalc_Path,1,true);
}
</script>

N. B. I haven't tested this...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Sep 20 '07 #8

This discussion thread is closed

Replies have been disabled for this discussion.