ahmed naguib
ahmed naguib

Reputation: 145

Store innerhtml by jQuery in asp.net?

I have

<div id="ulAndil" runat="server">

</div>

and button

<asp:Button ID="btnAssignJudToCourse" runat="server" Text="تاكيد " 
      CssClass="button" CausesValidation="false" 
      OnClientClick="javascript:getShape();" 
      OnClick="btnAssignJudToCourse_Click" Visible="false" />

At runtime I create a lot of sortable html controls and then click confirm I want to save inner html of this div before postback of button in session or anything

Using jQuery so when user click the button jQuery take inner html of div and stores it in cookie session any thing to store it after postback I can retrieve it

Please I want the exact code for this jQuery or javascript method and how to call on button

Upvotes: 0

Views: 829

Answers (1)

Ravi Vanapalli
Ravi Vanapalli

Reputation: 9942

Why don't you put the generated HTML in a hidden field and postback.

Say getShape() is your javascript function

function getShape()
{

//your validations applied

document.getElementById('hdnHTML').value = document.getElementById('ulAndil').value;

return true;

}

where hdnHTML is the hidden element of HTML.

Upvotes: 1

Related Questions