質問

I want to add TextArea value in database after that I want to clear the TextArea. How can I achieve this?

View

@using (Ajax.BeginForm("ResearcherMessage", "Researcher", new AjaxOptions { UpdateTargetId = "ResearcherMessageDiv" }))
{
        @Html.TextArea("MessageTextArea", new { @class = "messageTextArea" })
        <br />
        <input id="AddMessageSubmit" type="submit" value="Add Message" />
}
役に立ちましたか?

解決

Amend your AjaxOptions object to include the following property:

OnSuccess="Done"

Then define a JavaScript function with that name that does what you need, for example:

function Done() { 
    document.getElementById("MessageTextArea").innerHTML = '';
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top