Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Call a popup window after sql insert

Posted on 2011-02-13
11
Medium Priority
?
592 Views
Last Modified: 2012-08-13
As part of my Procedure I first insert data to a sql Db and then i want to popUp a small 100 by 100 window which just has a print window that opens , it prints goes away an they go onto the next task.  THis worked good in 1.1 code but having trouble getting to work in 4.0 code.  what am I doing wrong here.


sql = "Insert tblSRpEventData (intPersonnelId, intUnitSRPId, intQuestionId, bitAnswer, strData, strRemarks, dtDoc, dtLogged, strlogged) VALUES (" & PersId & ", " & UnitID & ", " & AQuesId & ", " _
                    & "" & Aanswer.SelectedValue & ", '" & Adata.Text & "', '" & ARemarks.Text & "', '" & ADtdate.Text & "', '" & Date.Today & "', '" & userlogon & "')"

            insertUpdateDelete(sql)
        Next

        ClearAdminGrid()

My first method is to put a lable on the aspx page and call the label but nothing is happening.
 lbljavascript.Text = "<script language=javascript>window.open('../Reports/SRPIssues.aspx?id=" & SSN & " '', 'width=1 height=1 top=1 left=1');</script>"

The second methis is to try to do with page controls but can't seem to get he systax correct.
 Page.ClientScript.RegisterStartupScript("window.open('" + Request.ApplicationPath + "../Reports/SRpIsses.aspx?ID=" & SSN & " '" + 'Width=100,height=100');", True)

Open in new window

0
Comment
Question by:kdeutsch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 3
11 Comments
 
LVL 16

Accepted Solution

by:
BurnieP earned 1600 total points
ID: 34883859
Hi,

Try using ClientScript.RegisterClientScriptBlock like this :


ClientScript.RegisterClientScriptBlock(Me.[GetType](), "open", "<script type='text/javascript'>window.open('" + Request.ApplicationPath & "../Reports/SRpIsses.aspx?ID=" & SSN & "','Width=100,height=100');</script>")

Open in new window

0
 

Author Comment

by:kdeutsch
ID: 34883907
Hi,
It gives me an error of invalid argument then says liine 53 character 32.
ClientScript.RegisterClientScriptBlock(Me.[GetType](), "open", "<script type='text/javascript'>window.open('" + Request.ApplicationPath & "../Reports/SRpIsses.aspx?ID=" & SSN & "','Width=100,height=100');</script>")
0
 
LVL 16

Expert Comment

by:BurnieP
ID: 34883929
Hmmm..  Maybe it is the + in window.open('" +... Change it for &

ClientScript.RegisterClientScriptBlock(Me.[GetType](), "open", "<script type='text/javascript'>window.open('" & Request.ApplicationPath & "../Reports/SRpIsses.aspx?ID=" & SSN & "','Width=100,height=100');</script>")
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 

Author Comment

by:kdeutsch
ID: 34883976
Hi,
Still get the same thing Invlid argument.  The highlight starts at the
>window.open
and calls character 32
0
 
LVL 16

Expert Comment

by:BurnieP
ID: 34884083
Hi,

I am really confused because it is working fine on my side.  Hmmm...  it might not like the <script tags..  I removed them, maybe..

ClientScript.RegisterClientScriptBlock(Me.[GetType](), "open", "window.open('" & Request.ApplicationPath & "../Reports/SRpIsses.aspx?ID=" & SSN & "','Width=100,height=100');")
0
 
LVL 11

Expert Comment

by:SAMIR BHOGAYTA
ID: 34886708
Hi, You have to use this code after insert query is executed.

using System.Windows.Form;

MessageBox.Show("Record successfully added");
0
 

Author Comment

by:kdeutsch
ID: 34896413
BurnieP,

Do you have working in an update panel on your side.  I have in an update panel, these things are a pain.
0
 

Author Comment

by:kdeutsch
ID: 34896429
samirbhogayta:

If I use form controls is messes up all my web page controls when I do this my code behind goes crazy with all kins os blue underlines.
0
 

Author Comment

by:kdeutsch
ID: 34896574
hi,
Ok this works and calls the a javascript alert window after the insert .
 ClientScript.RegisterStartupScript(Me.GetType(), "ClientScript", "alert ('hello')", True)
0
 

Author Comment

by:kdeutsch
ID: 34896728
hi,
Ok this is what I get for the link when it trys to open I get an javascript error on the bottom of the page in corner.  if I put the link into my page it works fine, but what I see is missing and I guess I don't know if its a problem is the server name and http before this part.
'/ReadinessTracker/Reports/SRPIssues.aspx?

maybe that information fills in automatically.??

<script type='text/javascript' window.open('/ReadinessTracker/Reports/SRPIssues.aspx?ID=10','Width=100,height=100');</script><script type='text/javascript'>new Sys.WebForms.Menu({ element: 'mnuMaster', disappearAfter: 500, orientation: 'horizontal', tabIndex: 0, disabled: false });</script>
0
 

Author Closing Comment

by:kdeutsch
ID: 34897217
Ok, the script works, to a point in that its not the script giving me the error, it has to do with my master page menu system and that I had misspelled link address.
0

Featured Post

Fill in the form and get your FREE NFR key NOW!

Veeam® is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question