0

I'm want to validate value of name from Create.cshtml and AddUser.cshtml page. working in mvc application

in create.cshtml

<div id="tab3" class="tab_content">

@Html.TextBoxFor(x => x.FirstTripStartTime, new { id = "minStartTime", @class = "smallTxtEntry3" })&nbsp;(HH:MM:SS)

</div>

in adduser.cshtml

<div>
  <td valign="top" class="nd_nor_ftd">Start Time<span class="mand">*</span></td>
                    <td>
                        @Html.TextBoxFor(x => x.StartTime, new { @class = "smallTxtEntry3" })&nbsp;(HH:MM:SS)
                    </td>
</div>

How do I compare and show alert if these two values are same

2nd page is in tabular for actually after 1st gets filled.

  <div id="tab4" class="tab_content">
   <div class="buttonDiv">
      <input type="button" class="button addButton" name="AddUser" id="AddUser" value="Add Useronclick="OpenAddDialogWindow(GoodReceiptParameterCss, '/User/GetPartialView?name=User&mode=add', 'gridVariableFrequencies');" /><br />
       <span>Add Frequency</span>
AthibaN
  • 2,087
  • 1
  • 15
  • 22
Neo
  • 15,491
  • 59
  • 215
  • 405

2 Answers2

1

As you are talking about different pages, you can share state and values between them in*at least* 2 ways:

  1. Save data in DB from one page and read from another (not so good, as need a request)
  2. Save in local storage a value from one page and read it from another page (definitely better)

For easy data save/read on client side can have look on: amplify.js.

Tigran
  • 61,654
  • 8
  • 86
  • 123
1

You can use the MVC Session object to persist server side data (without the need for a database, or relying on client side storage) and check the values client or server side.

Community
  • 1
  • 1
BenM
  • 4,218
  • 2
  • 31
  • 58