I'm getting a "Sys.WebForms.PageRequestManagerServerErrorException: Object reference not set to an instance of an object" error and I know why but I just don't know how to resolve it.
I've got a page with a RadGrid on it and in the ItemDataBound event I add a confirmation dialog to a column that contains a button as shown below and the reason for the above error is the use of the newline character in the javascript. I've tried using three and four backslashes just for giggles and it produces the same error. I've also tried wrapping the entire RadGrid in a RadScriptBlock and a RadCodeBlock but neither have any affect on the error.
How do I use the new line character in my confirmation dialog and prevent the above error?
Button executeButton = dataItem["clmExecute"].Controls[0] as Button;
if (executeButton != null)
executeButton.Attributes["onclick"] = string.Format("if(!confirm('Confirm that you want to execute the selected step(s) to:\\n\\nDeployment Date: {0}\\nDescription: {1}\\nRegion: {2}\\nEnvironment: {3}\\n')){{return false;}}", _master.DeploymentDate.ToShortDateString(), _master.DeploymentDateDescription, _master.Region, _master.Environment);
I've got a page with a RadGrid on it and in the ItemDataBound event I add a confirmation dialog to a column that contains a button as shown below and the reason for the above error is the use of the newline character in the javascript. I've tried using three and four backslashes just for giggles and it produces the same error. I've also tried wrapping the entire RadGrid in a RadScriptBlock and a RadCodeBlock but neither have any affect on the error.
How do I use the new line character in my confirmation dialog and prevent the above error?
Button executeButton = dataItem["clmExecute"].Controls[0] as Button;
if (executeButton != null)
executeButton.Attributes["onclick"] = string.Format("if(!confirm('Confirm that you want to execute the selected step(s) to:\\n\\nDeployment Date: {0}\\nDescription: {1}\\nRegion: {2}\\nEnvironment: {3}\\n')){{return false;}}", _master.DeploymentDate.ToShortDateString(), _master.DeploymentDateDescription, _master.Region, _master.Environment);