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

  • Home
  • SEARCH
  • 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 7853267
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:37:56+00:00 2026-06-02T19:37:56+00:00

In a partial page (a menu) I have this: @foreach (var category in db.Query(SELECT

  • 0

In a partial page (a menu) I have this:

@foreach (var category in db.Query("SELECT categoryName FROM Category")) {
    <li><a href="#">@category.categoryName</a>
        <ul class="submenu">
            <form action="/Products/?@Request.QueryString" method="post">
                <input type="hidden">
                    @Html.Hidden("cat", category.categoryName)
                </input>
            </form>
        </ul>
    </li>
}

In the page I redirect to, I have this:

if (IsPost) {
    if (Request["cat"] != null) {
        <p>The category is @Request["cat"]!</p>
    }
}

It redirects fine, but I can’t get it to pass the ‘cat’ variable to the page which I redirect to. Normally when I use redirect successfully I use input type=”submit”. The difference here is that these are hyperlinks, which is undoubtedly the reason. I would prefer to keep the hyperlinks.

Any help is appreciated.

  • 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-06-02T19:37:57+00:00Added an answer on June 2, 2026 at 7:37 pm

    In order to submit values in your form tag you have to submit the form. You don’t have any code to submit the form.

    Submitting the form is usually achieved by input type="submit" as you mentioned but other techniques are also possible (for example submitting the form with JavaScript).

    In your case I wonder if you really have to perform a POST.

    What about this approach instead?

    @foreach (var category in db.Query("SELECT categoryName FROM Category")) {
        <li>
            <a href="/Products/?@Request.QueryString&cat=@category.categoryName">
                @category.categoryName
            </a>
        </li>
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a page that is setup like this public partial class _Default :
Given this class public partial class Default : Page { private IRepository repo; ...
I currently have a page which is declared as follows: public partial class MyPage
I have an interesting problem when using partial page update in asp.net with scriptmanager
I have a page which contains a html.RenderPartial, that renders an ASP.NET MVC partial
I have a p:fileUpload which works fine. But I need a partial page rendering
We have an ASP.NET page which uses an update panel for partial page postbacks.
I'm attempting to render JavaScript from a Razor Partial Page into the bottom of
I have a left side navigation menu on my page.. using url.action like below..
I hover over my menu and a submenu expands, then this bad boy comes

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.