0

Greetings, I have an asp.net mvc application. I have some links that corresponds to clients names. When user clicks on this link I would like to show an information of clicked client and additionally a textarea where user shall be able to write some text (comment) about selected client. How can I achieve it?

EDIT I've made something like:

<%=Html.ActionLink(operatorWhoAnswered.Operator.FirstName, "ShowSingleConverstationWithAnswerForm", "MyMessages", new { id = operatorWhoAnswered.Operator.ROWGUID }, new AjaxOptions() { UpdateTargetId = "ss" }) %> 

and my controller action looks as follows:

public PartialViewResult ShowSingleConverstationWithAnswerForm(string id)
        {
            SingleConversationWithAnswerFormViewModel vm = new SingleConversationWithAnswerFormViewModel();
            PartialViewResult viewResult = new PartialViewResult();
            viewResult.ViewName = "SingleConverstationWithAnswerForm";
            viewResult.ViewData = new ViewDataDictionary(vm);
            return viewResult;
        }

but view opens in a new page, instead of div with id="ss"

EDIT2 Solution found! I don't know why I have used Html.ActionLink. Ajax.ActionLink works fine!

1 Answer 1

1

Try something like this:

Create a div that should be rendered when the user clicks. Name is something lika blabla. Then where your link is you have something like

 <%=Ajax.ActionLink("Click here", "Action", "Controller", new { id = "some test data passed in"}, new AjaxOptions() { UpdateTargetId = "blabla" })%>

And let that action return your view

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

Comments

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.