none
Stored Procedure in a web form view RRS feed

  • Question

  • Hey guys,

    I have a web form view on Visual Studio 2013 built out with the following code:

    @model TWC2.Models.WAPIaaSVMName
    @{
        ViewBag.Title = "New";
        Layout = "~/Views/Shared/_Layout.cshtml";
    }
    
    <h2>New</h2>
    
    @using (Html.BeginForm("Add", "WAPIaaSVMName", FormMethod.Post, new { @class = "form" }))
    {
        <div class="form-group">
            <b>IaaS Virtual Machine Name</b>
            @Html.TextBoxFor(m => m.IaasVMName, new { @class = "form-control", required = "required" })
        </div>
    
        <div class="form-group">
            <b>Security Configuration</b>
            @Html.TextAreaFor(m => m.SecurityClassification, new { @class = "form-control", required = "required", maxlength = "4" })
        </div>
    
        <div class="form-group">
            @{
        List<SelectListItem> listItems = new List<SelectListItem>();
        listItems.Add(new SelectListItem
             {
                 Text = "True",
                 Value = "True"
             });
        listItems.Add(new SelectListItem
             {
                 Text = "False",
                 Value = "False",
             });
            }
            <b>Assigned</b>
            @Html.DropDownListFor(m => m.assigned, listItems, "-- Select Status --", new { @class = "form-control", required = "required" })
        </div>
    
    
        <input type="submit" class="btn btn-primary" value="Save" />
       
    
    
    
    }
    

    The web form works great and does exactly what I want. Except now my client wants me to have the page run a SQL stored procedure called "ReserveWAPIaasVMNames" when the submit button is clicked. Is there anyway to do that with this code?

    Thanks,

    Gary Winhoven

    Tuesday, June 28, 2016 6:51 PM

All replies