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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:29:12+00:00 2026-06-13T10:29:12+00:00

I am having an issue with the following code: SECTION FROM CSHTML FILE: @if(errorMessage

  • 0

I am having an issue with the following code:

SECTION FROM CSHTML FILE:

                        @if(errorMessage != "")
                        {
                            err="err";
                        }
                        else
                        {
                            err="";
                        }
                        @if(errorMessage == "")
                        {
                            foreach(var row in db.Query(stringCompiler, EntryID, POIName, DateLastModified, Gender, Race, Height, Weight, HairColor, EyeColor, DOB, Age, SS, DL, DOC, VehicleTag, FBI, Officer, HomePhone, CellPhone, CellPhone2, CellPhone3, POICautions, WorkPhone, WeightedAggregate, Address, AdditionalDescriptors, Aliases, SourceOfInformation, AddressInformation, KnownAssociates, VehicleDescription, Comments, SummarizedIncidents, AllCellPhones, AllPhones, betDOB1, betDOB2, betDLM1, betDLM2, betAge1, betAge2, POILastName, SearchAll))
                            {
                                <div class="searchResult">
                                    <table style="background-color: #beebeb;">
                                        <tr>
                                            <td class="entryLabel">ENTRY ID</td>
                                            <td class="entryLabel">FIRST NAME</td>
                                            <td class="entryLabel">LAST NAME</td>
                                            <td class="entryLabel">DATE LAST MODIFIED</td>
                                            <td class="entryLabel">DOB</td>
                                            <td class="entryLabel">AGE</td>
                                            <td class="entryLabel">ADDRESS</td>
                                            <td class="entryLabel">VEHICLE TAG#</td>
                                            <td class="entryLabel">OFFICER</td>
                                            <td class="entryLabel">HOME PHONE</td>
                                            <td class="entryLabel">CELL PHONE</td>
                                            <td class="entryLabel">WEIGHTED AGGREGATE</td>
                                        </tr>
                                        <tr>
                                            <td class="entry">@row.EntryID</td>
                                            <td class="entry">@row.POIName</td>
                                            <td class="entry">@row.POILastName</td>
                                            <td class="entry">@row.DateLastModified</td>
                                            <td class="entry">@row.DOB</td>
                                            <td class="entry">@row.Age</td>
                                            <td class="entry">@row.Address</td>
                                            <td class="entry">@row.VehicleTag</td>
                                            <td class="entry">@row.Officer</td>
                                            <td class="entry">@row.HomePhone</td>
                                            <td class="entry">@row.CellPhone</td>
                                            <td class="entry">@row.WeightedAggregate</td>
                                        </tr>
                                        <tr>
                                            <td colspan="13" style="text-align: center;"><form method="post" action="/ComputeLookupToVAndE.cshtml"><input type="hidden"  name="veEntryID" hidden="hidden" readonly="true" value="@row.EntryID" /><br/><input type="submit" value="View & Edit" class="btn3" style="height: 40px; width: 100px;" /><br/><br/></form></td>
                                        </tr>
                                    </table>
                                </div><br/>
                                ResultCount += 1;
                            }
                            <input type="hidden" id="ResultCount" value="@ResultCount" />
                            <input id="err" type="hidden" value='@err' />
                        }

SECTION FROM JAVASCRIPT FILE:

$(document).ready(function () {
if ($("#err").val() == "err")
{
    $("#searchForm").attr('action', "/LookUpEntry.cshtml#top");
}
else
{
    $("#searchForm").attr('action', "/LookUpEntry.cshtml#searchList");
}
});

Obviously I am trying to change the value of the hidden input element to “err” before the page is rendered by C# if any error messages have been stored in the variable errorMessage.

Once done JavaScript is supposed to read this value and then if it is “err” change the action attribute of the form to append “#top” (for named anchor, so the loaded position on the page changes based off of whether there is an error message or results to view), otherwise the form’s action attribute should be changed (still by JavaScript) to append #searchList).

Any idea why JavaScript and C# won’t play well together? The errors I am getting are haphazard (like it won’t work the first time, then doesn’t work at all), anyway based on the code below, it still never goes to (#top), although when trying a few things before this exact coding (I don’t remember exactly what they were) it would sometimes (although never the first time) go to the top if it had errored.

Why is jQuery not doing its job? It seems like this should just work to me…

Any ideas?

Thanks for any help

  • 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-13T10:29:13+00:00Added an answer on June 13, 2026 at 10:29 am

    Well, I guess I have it figured out and I suppose it does make sense:

    It does change the value as it should, but the action (how the form [or rather where, the way I look at it] handles the data posted) is already set to what it where it will go regardless of the results of the current search. In short: It is a step behind. When I click to search and an error Message is produced, it will rewrite the action as intended, but it will, of course, only come into effect on the next search not the current one as that was already determined on the previous submit.

    What’s wrong with my code? Nothing syntactically, the methodology (logic) is in err.

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

Sidebar

Related Questions

I'm having an issue with rails involving javascript. Basically, I have the following code:
I believe I am having a memory issue using numpy arrays. The following code
I'm having some issues getting file uploads to work correctly and the following code
I am having following issue with reading binary file in C. I have read
Im having an issue using GLUT with monodevelop. Im using the following code: #include
I am having an issue with the following code and it is wrecking my
I'm having an issue with some asynchronous JavaScript code that fetches values from a
I'm having an issue with the following code. byte[] array = data as byte[];
I am having an issue with the following code. The execute function executes not
Ok. I'm having an issue with the following bit of code: StreamReader arrComputer =

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.