473,804 Members | 2,959 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can I insert a Response.Write with JavaScript inside of Web Servic

Hi everybody,

I'm trying to insert a piece of javascript inside of a web service method
but It's not working. Have somebody already tryed to do it?
Folow a piece of my code below.
---------
Private Sub InsertReportTab le(ByVal path As String, ByVal exp As String,
ByVal app As Boolean, ByVal rep As Boolean)
Dim tableAdapter As New IDReportsTableA dapter
Dim grid As New GridView
Dim count As Integer
Try
grid.DataSource = tableAdapter.Ge tAllReports()
grid.DataBind()
count = grid.Rows.Count
tableAdapter.In sertReport(path , exp, app, rep, False)
HttpContext.Cur rent.Response.W rite("<script language=" + Chr(34)
+ "javascript " + Chr(34) + ">")
HttpContext.Cur rent.Response.W rite("window.op en(" + Chr(34) +
"ReportViewer.a spx?ID=" & (count + 1) & Chr(34) + "," + Chr(34) + "_blank" +
Chr(34) + "," + _
Chr(34) +
"titlebar=no,le ft=100,top=100, toolbar=no,loca tion=no,status= no,height=600,W idth=950,scroll bars=yes" + Chr(34) + ")")
HttpContext.Cur rent.Response.W rite("</script>")
HttpContext.Cur rent.ClearError ()
Catch ex As Exception

End Try

End Sub
------
<WebMethod(Buff erResponse:=Fal se)_
Public Sub InsertReport(By Val path As String, ByVal exp As String, ByVal
app As Boolean, ByVal rep As Boolean)
InsertReportTab le(path, exp, app, rep)
End Sub
-------

Any idea?
Thanks a lot.

Tiago Vieira
Aug 15 '06 #1
1 2068
Hi Tiago,

You can not do that, the web services were not designed to return HTML. A
web service receives a xml request message (SOAP) and returns a xml response
message according to that.
In your case, you need a use a HTTP handler, which receives some parameters
(Http POST or Http GET) and return a HTML response.

Regards,
Pablo Cibraro
http://weblogs.asp.net/cibrax

"Tiago Vieira" <Tiago Vi****@discussi ons.microsoft.c omwrote in message
news:72******** *************** ***********@mic rosoft.com...
Hi everybody,

I'm trying to insert a piece of javascript inside of a web service method
but It's not working. Have somebody already tryed to do it?
Folow a piece of my code below.
---------
Private Sub InsertReportTab le(ByVal path As String, ByVal exp As String,
ByVal app As Boolean, ByVal rep As Boolean)
Dim tableAdapter As New IDReportsTableA dapter
Dim grid As New GridView
Dim count As Integer
Try
grid.DataSource = tableAdapter.Ge tAllReports()
grid.DataBind()
count = grid.Rows.Count
tableAdapter.In sertReport(path , exp, app, rep, False)
HttpContext.Cur rent.Response.W rite("<script language=" +
Chr(34)
+ "javascript " + Chr(34) + ">")
HttpContext.Cur rent.Response.W rite("window.op en(" + Chr(34) +
"ReportViewer.a spx?ID=" & (count + 1) & Chr(34) + "," + Chr(34) + "_blank"
+
Chr(34) + "," + _
Chr(34) +
"titlebar=no,le ft=100,top=100, toolbar=no,loca tion=no,status= no,height=600,W idth=950,scroll bars=yes"
+ Chr(34) + ")")
HttpContext.Cur rent.Response.W rite("</script>")
HttpContext.Cur rent.ClearError ()
Catch ex As Exception

End Try

End Sub
------
<WebMethod(Buff erResponse:=Fal se)_
Public Sub InsertReport(By Val path As String, ByVal exp As String,
ByVal
app As Boolean, ByVal rep As Boolean)
InsertReportTab le(path, exp, app, rep)
End Sub
-------

Any idea?
Thanks a lot.

Tiago Vieira

Aug 16 '06 #2

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

Similar topics

3
6792
by: Ian Griffiths | last post by:
I'm having issues witht the code I'm writing. I've dealt with SQL before, although only for extracting data, not adding it to the database. I've been intensively learning ASP/ADO over the past week or so. I have a HTML form that posts data to the following ASP file: <HTML> <HEAD> <TITLE>Sight Bites</TITLE> </HEAD>
2
13400
by: george | last post by:
This is like the bug from hell. It is kind of hard to explain, so please bear with me. Background Info: SQL Server 7.0, on an NT box, Active Server pages with Javascript, using ADO objects. I'm inserting simple records into a table. But one insert command is placing 2 or 3 records into the table. The 'extra' records, have the same data as the previous insert incident, (except for the timestamp).
2
1417
by: Gnarlodious | last post by:
I'm hoping someone can explain this and give a tip what I'm doing wrong. This doesn't work (simplified for readability): <style type="text/css"> <SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'> if ( navigator.platform.substring(0,3).toLowerCase() == 'win') document.write('body { font-family: Arial} ') else document.write('body {font-family: Gadget } ') </SCRIPT>
0
1358
by: isaac2004 | last post by:
im trying to make a page that reads simple user information and posts them to a table. the user can edit, delete and add new records, through a form on the page.using SQLs modifications like insert and delete, how would you go about doing this. the script executes an if then statment that tests a submit button and initiates the insert portion of the SQL statement .
6
1868
by: MrHelpMe | last post by:
Hello experts, O.k I give up on this. I have an LDAP query from asp working correctly. It is returning data fine. Now I need to know how to take this data and then submitt it into the database. Can this be done in one page and is there any other way to do this without putting a submit button on a page. Almost like a file that I can pass to the user and he can click it to insert into a database. My way of do it is to simply to put...
1
1664
by: davemcdonald | last post by:
ASP Javascript (Dreamweaver) insert and retreive Primary Key -------------------------------------------------------------------------------- Been pulling my hair out all week. I am working on a registration database, and need to get the last primary key allocated to a insert within the MySQL database. I am trying to use the LAST_INSERT_ID() function to return the value to a session variable. if (!MM_abortEdit) { // execute the...
1
4833
by: clayalphonso | last post by:
Here is the code: <% dim testArray, testArray2 dim Conn, rs dim sSQL, sConnString 'response.write request.form("sel1") 'testArray = split(request.form("sel1"),",") 'for each gidstuff In testArray 'Response.Write gidstuff & "<br />"
6
3477
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns, there's another column in the DB table named 'RegDateTime' whose datatype is Date/Time which is...
3
3316
by: =?Utf-8?B?SmFzb24gSGFydHNvZQ==?= | last post by:
I get the error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write...when i postback to the page. The problem is, i need to write some dynamic javascript on postback and make sure it's rendered to the page. I'm setting up Omniture analytics for my site, <script language="JavaScript"...
0
9704
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
9571
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,...
0
10318
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10302
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
9132
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
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();...
1
4277
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
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2976
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.