Reputation: 7163
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..
Upvotes: 0
Views: 492
Reputation: 114417
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.
Upvotes: 2