Displaying data in a Modal popup window in JavaScript

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Mar 2009
Posts: 28
Reputation: SID.SIL is an unknown quantity at this point 
Solved Threads: 0
SID.SIL SID.SIL is offline Offline
Light Poster

Displaying data in a Modal popup window in JavaScript

 
0
  #1
Sep 18th, 2009
Good Morning Friends

I'm using a modal popup using Javascript that this opening normally through the following syntax:

  1. jscript + = "<script language='javascript'>" jscript + = "window.showModalDialog ( 'DOCUMENTOS2.aspx','',' resizable = yes, menubar = no, scrollbars = no, width = 1850, height = 1650 ') "jscript + =" </ script> "ClientScript.RegisterClientScriptBlock (Me.GetType ()," client ", jscript)


Then I want this window registry data are shown.I'm saving the ID in a Session, instead of passing it a parameter, although it should not be the reason for this.

In this modal popup, I put a break early on, however the system is running is not going through that page it commands present, commands are normal and another machine qualquer.My goal and get the ID and display the necessary data from it.

Would be the behavior in a modal popup window.

Thanks and a hug
Last edited by peter_budo; Sep 27th, 2009 at 8:37 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 178
Reputation: Kusno is an unknown quantity at this point 
Solved Threads: 14
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster

Re: Displaying data in a Modal popup window in JavaScript

 
0
  #2
Sep 24th, 2009
If you have save the ID in session, you can directly use it
  1. Dim SQL As String = "SELECT * FROM Trx WHERE ID = '" & Session("ID") & "'
  2.  

but, just my suggestion, try to avoid using sessions. For this case, try to use query string

like this :
  1. Dim jscript As String
  2. Dim ID As String = TextBox1.Text.Trim
  3. jscript = "<script language='javascript'>"
  4. jscript += "window.showModalDialog ('DOCUMENTOS2.aspx?ID=" & ID & "','',' resizable = yes, menubar = no, scrollbars = no, width = 1850, height = 1650 ') "
  5. jscript += " </ script> "
  6. ClientScript.RegisterClientScriptBlock(Me.GetType(), " client ", jscript)

in modal form :
  1. Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  2. Dim ID As String=""
  3. ID = Request.QueryString("ID")
  4. If Not IsPostBack Then
  5.  
  6. End If
  7. End Sub

Thank
NEVER NEVER NEVER GIVE UP
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 28
Reputation: SID.SIL is an unknown quantity at this point 
Solved Threads: 0
SID.SIL SID.SIL is offline Offline
Light Poster

Take the ID Line GridView popular handbook

 
0
  #3
Sep 25th, 2009
Hello Friends

I still muddled with some things (that is with a lot of them). I have a Gridview, where the first column ia a TemplateField with a LinkButton to delete the record, the selected row.

I did the same routine using the primary key with DataKeyNames, however in this case the GridView, was populated manually and now I'm using curl.

I did the following:

  1. Protected Sub GrdDocumentos_RowDataBound (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GrdDocumentos.RowDataBound
  2.  
  3. If e.Row.RowType = DataControlRowType.DataRow Then
  4. Dim l As LinkButton = DirectCast (e.Row.FindControl ( "LinkButton1"), LinkButton)
  5. l.Attributes.Add ( "onclick", ( "javascript: return" & "confirm ( 'Really delete the Document") & DataBinder.Eval (e.Row.DataItem, "REL_DOCUMENTO") & "?')")
  6. End If
  7. End Sub

  1. Private Sub GrdDocumentos_RowCommand (ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GrdDocumentos.RowCommand
  2. 'Can I exclude here in RowCommand
  3.  
  4. If e.CommandName = "Delete" Then
  5. RelID GrdDocumentos.SelectedRow.Cells = (4). Text (does not work that way)
  6.  
  7. 'GrdDocumentos.SelectedIndex = SelectedGridRow.RowIndex
  8. 'Delete the record
  9. 'Implement this on your own:)
  10. DeleteRecordByID (relID)
  11. End If
  12. End Sub

  1. Private Sub DeleteRecordByID (ByVal RegID As Integer)
  2.  
  3. Dim Sql As String
  4. Dim cmd As SqlCommand
  5.  
  6. Dim connection As SqlConnection
  7.  
  8. connection = New SqlConnection (ConfigurationManager.ConnectionStrings ( "Timesheet"). ConnectionString)
  9.  
  10. Sql = "DELETE FROM REL_PROJETOS"
  11. Sql + = "WHERE REL_ID =" & RegID
  12.  
  13. cmd = New SqlCommand (Sql, connection)
  14.  
  15. Try
  16. conexao.Open ()
  17.  
  18. cmd.Connection = connection
  19.  
  20. cmd.CommandType = CommandType.Text
  21.  
  22. cmd.CommandText = Sql
  23.  
  24. cmd.ExecuteNonQuery ()
  25. Catch ex As Exception
  26. lblMensagem.Text = "Error Occurred While Deleting:" & vbCrLf & ex.Message & vbCrLf '& ex.InnerException.ToString
  27. Finally
  28. conexao.Close ()
  29. GrdDocumentos.DataBind ()
  30. End Try
  31. End Sub Protected Sub GrdDocumentos_SelectedIndexChanging (ByVal sender As Object, ByVal e As System.EventArgs) Handles GrdDocumentos.SelectedIndexChanged
  32. RelID = GrdDocumentos.SelectedRow.Cells (12). Text
  33. End Sub
  34.  

Then I need to get the ID to be able to delete the desired record.

Thanks and a hug
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 28
Reputation: SID.SIL is an unknown quantity at this point 
Solved Threads: 0
SID.SIL SID.SIL is offline Offline
Light Poster

Re: Displaying data in a Modal popup window in JavaScript

 
0
  #4
Sep 25th, 2009
Thanks a lot my Friend your suggestion works perfectly but I have a problem not reviewed yet.


When the modal window and see the background screen with the data disappear and the screen is all gray (Gray and background color of the modal window).

With the window does not shift that does not happen and of course the modal window open, I need to view data in the background window, even though I can not access them due to the fact that the modal window is opened.

Thanks Again
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 178
Reputation: Kusno is an unknown quantity at this point 
Solved Threads: 14
Kusno's Avatar
Kusno Kusno is offline Offline
Junior Poster

Re: Displaying data in a Modal popup window in JavaScript

 
0
  #5
Sep 28th, 2009
You need to use AJAX.Net for that I think.
NEVER NEVER NEVER GIVE UP
Reply With Quote Quick reply to this message  
Reply

Message:



Similar Threads
Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC