Click here to Skip to main content
15,887,746 members
Home / Discussions / C#
   

C#

 
GeneralRe: C# Integrating With Skype Pin
Gavin Coates11-Apr-18 3:13
Gavin Coates11-Apr-18 3:13 
AnswerRe: C# Integrating With Skype Pin
Gerry Schmitz10-Apr-18 11:21
mveGerry Schmitz10-Apr-18 11:21 
Questionexcel udf returns only the first column name in order to display a two dimentional array Pin
Gtari Abir10-Apr-18 6:16
Gtari Abir10-Apr-18 6:16 
AnswerRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Richard Andrew x6410-Apr-18 6:57
professionalRichard Andrew x6410-Apr-18 6:57 
AnswerRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Luc Pattyn10-Apr-18 13:03
sitebuilderLuc Pattyn10-Apr-18 13:03 
GeneralRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Gtari Abir12-Apr-18 0:13
Gtari Abir12-Apr-18 0:13 
GeneralRe: excel udf returns only the first column name in order to display a two dimentional array Pin
Luc Pattyn12-Apr-18 3:09
sitebuilderLuc Pattyn12-Apr-18 3:09 
QuestionIssues in ajax call in MVC Pin
Dhyanga9-Apr-18 5:41
Dhyanga9-Apr-18 5:41 
Hello,

I am new in MVC. I have one product table which has ProductID, ProductName and ProductRate. I have one dropdown list which has all the ProductName. Now I am trying to select the productname and upon this select, it should fill my textbox with ProductRate. Code is as below but it is not doing anything and no errors. Please help.
<script type="text/javascript">
    function GetPrice(_this) {

        var x = document.getElementById("productID"), selectedValue = x.value;
        alert("_this" + _this.SelectedValue);
        var pid = selectedValue;
        alert(pid);
        var url = '@Url.Action("GetPrice","Sales")';
        alert(url);
              $.ajax({
                type:"POST",
                url: 'Sales/GetPrice',
                contentType: "application/json; charset=utf-8",
                data:  {ProductId: pid },
                cache:false,
                dataType: json,
                async: true,
                processData:false,
                success: function (data)
                {
                    alert("yay1");
                },
                failure: function (response) {
                    alert("Fail");
                }

        });

    };
</script>

@using (Html.BeginForm())
{
    @Html.ValidationSummary(true)
   <fieldset>
  <div class="editor-field">
<div class="editor-label">
            @Html.LabelFor(model => model.ProductId)
        </div>
  @Html.DropDownListFor(model => model.ProductId, new SelectList(ViewBag.ProductList, "ProductId", "ProductName" ), "Select Product", new { id = "productID", onchange="GetPrice(this);"})                       
            @Html.ValidationMessageFor(model => model.ProductId, "", new { @class = "text-danger" })
            <span class="glyphicon glyphicon-asterisk"></span>
        </div>


   <div class="editor-label">
            @Html.LabelFor(model => model.Rate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Rate, new { id = "idRate"})
            @Html.ValidationMessageFor(model => model.Rate)
        </div>\
   </fieldset>
}

Here is my Controller "SalesController.cs" code:
[HttpPost]
      public JsonResult GetPrice(int ProductId)
      {
          return Json("");
      }

Dhyanga


modified 9-Apr-18 11:49am.

AnswerRe: Issues in ajax call in MVC Pin
Dhyanga9-Apr-18 6:50
Dhyanga9-Apr-18 6:50 
QuestionSyntax of creating the following matrix in C# Pin
Shibe19959-Apr-18 1:00
Shibe19959-Apr-18 1:00 
AnswerRe: Syntax of creating the following matrix in C# Pin
Gerry Schmitz9-Apr-18 2:27
mveGerry Schmitz9-Apr-18 2:27 
AnswerRe: Syntax of creating the following matrix in C# Pin
Dave Kreskowiak9-Apr-18 4:28
mveDave Kreskowiak9-Apr-18 4:28 
AnswerRe: Syntax of creating the following matrix in C# Pin
BillWoodruff11-Apr-18 8:26
professionalBillWoodruff11-Apr-18 8:26 
Questiongeneric type with value parameter rather than type parameter Pin
Alexander Kindel7-Apr-18 11:19
Alexander Kindel7-Apr-18 11:19 
AnswerRe: generic type with value parameter rather than type parameter Pin
OriginalGriff7-Apr-18 23:27
mveOriginalGriff7-Apr-18 23:27 
GeneralRe: generic type with value parameter rather than type parameter Pin
Alexander Kindel8-Apr-18 0:46
Alexander Kindel8-Apr-18 0:46 
GeneralRe: generic type with value parameter rather than type parameter Pin
OriginalGriff8-Apr-18 1:15
mveOriginalGriff8-Apr-18 1:15 
AnswerRe: generic type with value parameter rather than type parameter Pin
BillWoodruff8-Apr-18 3:39
professionalBillWoodruff8-Apr-18 3:39 
AnswerRe: generic type with value parameter rather than type parameter Pin
#realJSOP8-Apr-18 5:36
mve#realJSOP8-Apr-18 5:36 
GeneralRe: generic type with value parameter rather than type parameter Pin
Alexander Kindel8-Apr-18 11:30
Alexander Kindel8-Apr-18 11:30 
AnswerRe: generic type with value parameter rather than type parameter Pin
Gerry Schmitz8-Apr-18 6:54
mveGerry Schmitz8-Apr-18 6:54 
GeneralRe: generic type with value parameter rather than type parameter Pin
Alexander Kindel8-Apr-18 11:18
Alexander Kindel8-Apr-18 11:18 
GeneralRe: generic type with value parameter rather than type parameter Pin
Gerry Schmitz8-Apr-18 12:00
mveGerry Schmitz8-Apr-18 12:00 
GeneralRe: generic type with value parameter rather than type parameter Pin
BillWoodruff9-Apr-18 11:47
professionalBillWoodruff9-Apr-18 11:47 
QuestionIssue Deserializing Json in C# SSIS Script Pin
rhutchins12346-Apr-18 14:27
rhutchins12346-Apr-18 14:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.