Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1099261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T00:42:30+00:00 2026-05-17T00:42:30+00:00

I am new to jQuery. I have a Html.TextArea called CommentPost displayed for each

  • 0

I am new to jQuery. I have a Html.TextArea called “CommentPost” displayed for each item in a foreach loop. I am trying to return the data typed into my text area as a parameter in my ActionLink call. The first parameter item.CommentId get populated correctly but the second one item.CommentPosting evaluates as null.
I thought that maybe a jQuery call – when the ActionLink gets selected – could sort this out for me. I have been trying to solve this for hours now but am not getting any closer. I know that $('#CommentPost').attr("value") gives the correct text but how to put it all together is beyond me. Please help

<% foreach (var item in Model.Comments)
   { %>
    <%= (item.UserName ) %>
<%= Html.TextArea("CommentPost", item.CommentPosting)%>
<%= Html.ActionLink("Save", "CommentPosting", new { commentId = item.CommentId , commentPost =item.CommentPosting})%>
<% }%>

The shell of my controller code looks as follows:

[AcceptVerbs(HttpVerbs.Get)]
public ActionResult CommentPosting(int commentId, string commentPos)
{

}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T00:42:30+00:00Added an answer on May 17, 2026 at 12:42 am

    Ok I solved it …eventually(after praying for inspiration)!

    This is what I did :

    I modified my HTML.Actionlink by hardcoding the value “test” for my commentPost parameter and then hooked a new javaScript call GetData(link) to the onClick event. This javascript call changes the hardcoded value to the correct value:

    <%= Html.ActionLink(“Save”, “CommentPosting”, new { commentId = item.CommentId, commentPost = “test” }, new { onClick = “GetData(this);” })%>

    Then I created my JavaScript function:

    function GetData(link) {
        var temp = link.previousElementSibling;
        link.originalHref = link.originalHref || link.href;
        link.href = link.originalHref.replace("test", $(temp).attr("value"));
        return true;
    }
    

    Well Thank Goodness it all works now!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey people I'm new at jquery and i have been trying to figure this
I'm new to JQuery and was wondering how can I have Changes saved! displayed
i have this jQuery code: $(#text_a).html('<textarea name = text>.$text_user.</textarea>'); And if I put in
i'm new to jquery .I have problem in the following code .I saved it
I'm new to jQuery and have noticed someone go: var $this = $(this); Why
I am new to jQuery and have run into a problem. I have a
I am somewhat new to jQuery and I have a problem with something I
I have application that brings response via Ajax and creates 5-20 new jQuery click
I'm new to jQuery and I want to have a input box from a
I am new to jQuery. I have a dynamically generated row with unique ID's.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.