Tough..Accessing Scripts with params from DGrid, for Dialogs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi

I can access a script from a button click event, to show a Dialog box but..

I need to (from the DGrids) Item Command, so I can trap the cell and correct
master data, then call a script to show a Dialog/Modal window, to display the
Detailed /"Child" data of that data selected from a Grids Cell.

From a Button Click, dynamically created from Page Load I provide a scipt a
which fires when the control button is clicked,.. but to take it further...???

eg
If (Not Page.IsClientScriptBlockRegistered("btnModal_click")) Then
Dim strClientScript As String
strClientScript = "<script language=""javascript"">" & vbCrLf & _
"function btnModal_click() {" & vbCrLf & _
"var x =
window.showModalDialog(""testModal.aspx"",""Args"",""dialogHeight: 250px;
dialogWidth: 500px; dialogTop: 300px; dialogLeft: 300px; edge: Raised;
center: Yes; resizable: Yes; help: No; status: Yes;"");" & vbCrLf & _
"}" & vbCrLf & _
"</script>"

Page.RegisterClientScriptBlock("btnModal", strClientScript)
End If
btnModal.Attributes("onclick") = "Javascript:btnModal_click()"

????

TIA
Neal
 
The down and dirty method is to set up some form of container for the popup
and add JavaScript to that container as a literal. For example:

StringBuilder sb = new StringBuilder();

sb.Append(@"<script language='JScript'>\r\n");
sb.Append(@"window.Open('popup.aspx?id=');
sb.Append(chosenRecord.ToString());
sb.Append("');");

LiteralControl lit = new LiteralControl(sb.ToString());
panelJS.Controls.Add(lit);

You can also use the JavaScript emit method from a control on the page.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 
Thanks, ...it's all double Greek to me, but I'll work thru it.
However,....How do I call/ access / invoke a Script, from the WebForms Code
behind page, without having to rely on the HTML buttons (Java created) click
event ..
(I've been doing .Net for some 6 months, with zero asp background, much less
Java.
....(Deep End!!!)

rgds
Neal
 
Back
Top