Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 4th, 2012  |  syntax: None  |  size: 1.73 KB  |  hits: 7  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How do i convert this code snippet to c#
  2. Public Sub ConfirmOnChange()
  3.             'Register the script block
  4.             If Not IsStartupScriptRegistered("CSP-ddl-onchange") Then
  5.                 RegisterStartupScript("CSP-ddl-onchange", _
  6.                     "<script language=""JavaScript"">" & _
  7.                     "var CSP_savedDDLID = " & _
  8.                      "document.getElementById('" & _
  9.                      ddl.ClientID & "').value;" & vbCrLf & _
  10.                     "function resetDDLIndex() {" & vbCrLf & _
  11.                     " document.getElementById('" & _
  12.                      ddl_Status.ClientID & "').value = CSP_savedDDLID;" & _
  13.                     vbCrLf & _
  14.                     "}" & vbCrLf & _
  15.                     "</script>")
  16.             End If
  17.             Dim msg As String = "'Do you want to change selection?';"
  18.             ddl_Status.Attributes("onchange") = _
  19.             "if (!confirm('" & msg.Replace("'", "'") & _
  20.             "')) resetDDLIndex(); "
  21.         End Sub
  22.        
  23. public void ConfirmOnChange()
  24. {
  25.     //Register the script block
  26.     if(!IsStartupScriptRegistered("CSP-ddl-onchange"))
  27.     {
  28.         RegisterStartupScript("CSP-ddl-onchange",
  29.             "<script language="JavaScript">" +
  30.             "var CSP_savedDDLID = " +
  31.                 "document.getElementById('" +
  32.                 ddl.ClientID + "').value;" + "rn" +
  33.             "function resetDDLIndex() {" + "rn" +
  34.             " document.getElementById('" +
  35.                 ddl_Status.ClientID + "').value = CSP_savedDDLID;" +
  36.             "rn" +
  37.             "}" + "rn" +
  38.             "</script>");
  39.     }
  40.     string msg = "'Do you want to change selection?';";
  41.     ddl_Status.Attributes("onchange") = "if (!confirm('" & msg.Replace("'", "'") +
  42.     "')) resetDDLIndex(); ";
  43. }