Escape characters in RegisterClientScriptBlock

D

deepa.ravikiran

Escape characters in RegisterClientScriptBlock

I am using the RegisterClientScriptBlock to emit client script. What I
am trying to do here is:

User can open a popup window to build an MS Access connection string.
From the popup window, user can browse to a file.
When he clicks OK from the popup window, the connection string is built
using the file he selected and a text box in the parent window has to
be filled with this connection string.


The script that is being emitted is as below.
"<script lang=javascript>
window.opener.document.forms(0).ctl00_ContentPlaceHolder2_txtConnection.value
= 'Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=C:\\1Temp\\GG.mdb';self.close() </script>"

The problem I am having is : The parent text box doesnt get the file
path in the connection string properly. The text I see in the text box
is this:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:TempGG.mdb

Any ideas/suggestions really appreciated.

Thanks,
Deepa
 
D

deepa.ravikiran

I figured out!! I have to escape the backslashes twice in the string

So this works -
Source=C:\\\\1Temp\\\\GG.mdb
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,186
Members
46,742
Latest member
AshliMayer

Latest Threads

Top