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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:17:30+00:00 2026-06-04T07:17:30+00:00

In my web page, I need to populate button according to parameter value called

  • 0

In my web page, I need to populate button according to parameter value called ButtonType.
let’s say that If ButtonType == "Edit" then I need to hide every buttons but butUpdate.

I want to know how to show/hide html buttons via MVC Action method.

[AcceptVerbs(HttpVerbs.Post)]
    public ActionResult SupplierDetail(int SupplierID, string ButtonType)
    {   
        var Supplier = supplierListRepository.Supplier_SelectByID(SupplierID);
        return View(Supplier);
    }

I am using Asp.net Mvc Razor form.

@using (Html.BeginForm("SupplierDetail_SubmitClick", "Supplier", FormMethod.Post, new { id = "frmSupplierDetail" }))
{   
@Html.ValidationSummary(true)
<table cellpadding="0" cellspacing="0" border="0" style="width:450px; height:auto">
.....
<tr>
    <td>@Html.LabelFor(model => model.Phone)</td>
    <td>@Html.EditorFor(model => model.Phone)
        @Html.ValidationMessageFor(model => model.Phone)</td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>&nbsp;</td>
    <td>
        <input type="submit" id="butSave" name="butSave" value="Save" style="width:100px; height:auto" />
        <input type="submit" id="butUpdate" name="butUpdate" value="Update" style="width:100px; height:auto" />
        <input type="submit" id="butDelete" name="butDelete" value="Delete" style="width:100px; height:auto" />
        <input type="submit" id="butReset" name="butReset" value="Reset" style="width:100px; height:auto" />
    </td>
</tr>
</table>
</div>

<div id="content">
@Html.ActionLink("Back to List", "Index")
</div>

}

Every Suggestions will be 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-04T07:17:31+00:00Added an answer on June 4, 2026 at 7:17 am

    in your controller add the buttontype to viewdata:

    ViewData["ButtonType"] = ButtonType
    

    Then, in the view itself, you can add if/else statements, or any other logic that suits all of ur cases, to decide what to render:

    @if (ViewData["ButtonType"].ToString() == "Edit")
    {
        <input type="submit" id="butUpdate" name="butUpdate" value="Update"    
         style="width:100px; height:auto" />      
    }
    

    Of course, this is but a demo of what can be done, Yuo should adapt the code to ur buisness logics

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

Sidebar

Related Questions

In a web page button click event we need to export 2,00,000 to 5,00,000
I need to setup a web page that listens for XML document via an
I have a long URL on a web page in Windows that I need
I need to design a page for a web application that makes sense for
I have a text file that I need to retrieve to populate a web
I am new to Web page design and creation - but I need to
I have a web page written in ASP.NET and I need to retrieve the
We need to place text over objects in a web page, similar to this:
I need to start a Unix process by calling a PHP-page through the web.
I'm using a audio in my web page i need to play it first

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.