nayeem babu

nayeem babu

  • NA
  • 5
  • 0

how to pass html code to codebehind webmethod

Sep 21 2011 9:32 AM
Hi,
I am trying to pass some html code (total html page content like <!DOCTYPE html>......</html>) to webmethod in asp.net using c#. but if there is no controls like input controls then the ajax webmethod calls the codebehind webmethod and runs successfully. But if i put some controls code then the ajax webmethod throws error "internal server error"

please help to pass complete html code to the code behind web method.

I tried with JSON2 also like

var valJson = JSON.stringify(s);
            var dataJson = { frmedit: valJson };
            var dataJsonString = JSON.stringify(dataJson);
$.ajax({
                type: "POST",
                url: "About.aspx/saveEditor",
                data: dataJsonString,
                contentType: "application/json; charset=utf-8",
                datatype: "json",
                cache: false,
                success: function (response) {
                        some code
}


 It takes the value and executes the webmethod successfully but it adds some \\n characters and also it removes the format of the html. how can i resolve this.

 I want to pass the full html code to the code behind web method without effecting the formatting.

 Please help me...