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 3442426
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T08:40:02+00:00 2026-05-18T08:40:02+00:00

Having trouble here and not quite sure how to do it. I’ve attempted jQuery

  • 0

Having trouble here and not quite sure how to do it. I’ve attempted jQuery but with no luck. I have an object and on my create view, I have a parentId that I want to set (it’s in the url as well). So, I’m trying to use Html.HiddenFor so it will populate my new object when returned on the post. BUT, this doesn’t work. I’ve tried the following but it never returns the value on the post.

Html:

<%: Html.Hidden("HiddenParentId", ViewData("ParentId"))%>
<%: Html.HiddenFor(Function(model) model.ParentGroupId)%>

Javascript:

<script type="text/Javascript">
    $(document).ready(function () {
        alert($('#HiddenParentId').val());
        $('#ParentId').val($('#HiddenParentId').val());
    });
</script>

As you can see, on doc ready, I set the hidden parent id input with the value from the viewdata because the HiddenFor doesn’t have a value attribute. The HiddenParentId field DOES in fact have the value that I’m setting because I’m alerting it and it’s got the GUID that it should have. Now, first, I’m using VB so any help in VB would be greatly appreciated and second, if there’s another method to solve this issue, please advise. All I’m trying to accomplish is to get the ID that was passed in the URL (which in the controller I’m grabbing that id and putting it in the ViewData) and set the ParentId property of my object for the post so that it will save it when the object is returned to me.

  • 1 1 Answer
  • 3 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-18T08:40:03+00:00Added an answer on May 18, 2026 at 8:40 am

    Please check the ID in HTML source for hidden field, I guess its rendering different name.

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

Sidebar

Related Questions

I'm not quite sure exactly how Graphics work in Java so I having trouble
Super weird problem here. I'm having trouble getting jQuery to bind any selectors except
I am having trouble remembering how (but not why) to use IEnumerator s in
Im having trouble with cygwin not running my script file as expected here is
I am having trouble translating this into Ruby. Here is a piece of JavaScript
I'm having trouble getting the Apache Camel plugin to run in grails-1.1.1. Here's the
I'm having trouble adding Facebook Connect to my iPhone Project. Here's the directory structure:
I was having trouble sending up a url containing accent characters using IE. Here's
I'm having trouble doing an aggregation query on a many-to-many related field. Here are
I am having trouble getting well formatted results from my mysql query. Here is

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.