0

i have a huge page with lot of divs..

VIEW:

<div id="contractOverview">
        <div id="econtract">
             <p>a lot of content here</p>
        </div>
</div>

I want to get just one id which is "econtract" from the whole view, after that call a method in the controller, which sends an e-mail by smtp; this is not the problem. The problem is to get the html string from "econtract".

CONTROLLER ActionResult:

MailMessage m = new MailMessage();
m.From = new MailAddress("[email protected]", "Raja Item");
m.To.Add(new MailAddress("[email protected]", "Sekaran Uma"));
m.Subject = "html email coming!";

//Specify an HTML message body
m.Body = "<div id="econtract">a lot of content here</div>"
m.IsBodyHtml = True

Please help, sitting many hours already..

1 Answer 1

2

Using JavaScript:

var txt = document.getElementById('econtract').innerHTML

You can then post this back to the server using AJAX or a form to the server.

Sign up to request clarification or add additional context in comments.

2 Comments

how can i do it without ajax? just with asp.net mvc 2
You need to assign the value to a form field, then submit the form to the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.