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

  • SEARCH
  • Home
  • 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 6060805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:52:01+00:00 2026-05-23T08:52:01+00:00

I’m uwsing MVC and jqgrid and I need to pass a value from dropdownlist

  • 0

I’m uwsing MVC and jqgrid and I need to pass a value from dropdownlist to add or edit window. this is my code:

View:

jQuery("#grid").jqGrid({
            url: '@Url.Content("~/")' + 'Something/GridData/',
            datatype: "json",
            mtype: 'POST',
            colNames: ['Type', 'Product', 'Value1', 'Value2', 'Value3'],
            colModel: [
                { name: 'parType', index: 'parType', width: 80, align: 'center', sortable: false, editable: true, search: false,
                    editrules: { required: true, number: true },
                    editoptions: {
                        dataEvents: [{
                            type: 'keyup',
                            fn: function (e) {
                                if (this.value.match(/\D/)) this.value = this.value.replace(/\D/g, '');
                            }
                        }]
                    }
                },
                { name: 'parProduct', index: 'parProduct', width: 80, align: 'left', editable: true, edittype: "select",
                    editrules: { required: true },
                    editoptions: {
                        multiple: false,
                        size: 1,
                        dataUrl: '@Url.Content("~/")' + 'Something/List/',
                        buildSelect: function (data) {
                            var response = jQuery.parseJSON(data);
                            var s = '<select>';
                            if (response && response.length) {
                                for (var i = 0, l = response.length; i < l; i++) {
                                    var ri = response[i];
                                    s += '<option value="' + ri.Value + '">' + ri.Text + '</option>';
                                }
                            }
                            return s + "</select>";
                        }
                    }
                },
                { name: 'parValue1', index: 'parValue1', width: 80, align: 'right', sortable: false, editable: true, search: false,
                    editrules: { required: true, number: true },
                    editoptions: {
                        dataEvents: [{
                            type: 'keyup',
                            fn: function (e) {
                                if (this.value.match(/\D/)) this.value = this.value.replace(/\D/g, '');
                            }
                        }]
                    }
                },
                { name: 'parValue2', index: 'parValue2', width: 80, align: 'right', sortable: false, editable: true, search: false,
                    editrules: { required: true, number: true },
                    editoptions: {
                        dataEvents: [{
                            type: 'keyup',
                            fn: function (e) {
                                if (this.value.match(/\D/)) this.value = this.value.replace(/\D/g, '');
                            }
                        }]
                    }
                },
                { name: 'parValue3', index: "parValue3", width: 80, align: 'right', editable: true,
                    editrules: { required: true },
                    editoptions: {
                        dataEvents: [{
                            type: 'blur',
                            fn: function (e) {
                                onBlurDecimal(this.id);
                            }
                        }]
                    }
                }],
            rowNum: 10,
            rowList: [10, 20, 30],
            pager: jQuery('#pager'),
            sortname: '',
            viewrecords: true,
            sortorder: "asc",
            caption: "Title",
            height: 250,
            width: 700
        });

        jQuery("#grid").jqGrid('navGrid', '#pager',
            { edit: false, add: true, del: true, search: false }, //options
            {url: '@Url.Content("~/")' + 'Something/Add', closeAfterAdd: true, width: 500 },     // add options
            {} // search options
        );


@Html.ValidationSummary(False)
  @Using Html.BeginForm()
   <table>
                    <tr>
                        <td>
                            @Html.Label("ID_CONTRATANTE", "Contratante:")
                            @Html.DropDownListFor(Function(Model) Model.ID_CONTRATANTE, Nothing, New With {.style = "width:300px; visibility:visible", .class = "letraingreso"})
                        </td>
                    </tr>
                </table>
End Using

Controller

Function Add(ByVal parType As Long, ByVal parProduct As Long, ByVal parValue1 As Long, ByVal parValue2 As Long, ByVal parValue3 As String) As ActionResult
        Try
            Dim varE As General1Entities = New General1Entities
            Dim parIDContratante = Request.Form("ID_CONTRATANTE")

            Dim var1 = New OBJECT With { _
                .ID_TYPE = parProduct,
                .ID_CONTRATANTE = parIDContratante,
                .CODE = parType,
                .VALUE1 = parValue1,
                .VALUE2 = parValue2,
                .VALUE3 = parValue3
            }

            varE.AddToOBJECTS(var1)
            varE.SaveChanges()

            Return Json(True)
        Catch ex As Exception
            Return Json(False)
        End Try
    End Function

As you can see, I need to get DDL value from main view (ID_CONTRATANTE) and put it into parIDContratante. Obviously the value return Nothing because the add window of jqgrid it’s open. How can I send from parent view to add view window this value?

Regards.

  • 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-05-23T08:52:02+00:00Added an answer on May 23, 2026 at 8:52 am

    Ok…. After looking for solutions I get it.

    View (replace the old navGrid)

    jQuery("#grid").jqGrid('navGrid', '#pager', {
                edit: false, add: true, del: true, search: false, refresh: false
            }, // general options
            {
            }, // options edit
            {
                url: '@Url.Content("~/")' + 'Something/WorkWith',
                closeOnEscape: true,
                closeAfterAdd: true,
                width: 500,
                modal: true,
                addCaption: 'Nueva Tarifa',
                reloadAfterSubmit: true,
                beforeShowForm: function (frm) { $('#ID_CONTRATANTE').val(); },
                //bottominfo: "Fields marked with (*) are required",
                drag: true,
                onclickSubmit: function (params) {
                    var ajaxData = {};
                    ajaxData = { parIDContratante: $("#ID_CONTRATANTE").val() };
                    return ajaxData;
                }
            }, // options add
            {
                url: "/Something/WorkWith"
            }, // opciones para el dialogo de borrado
            {
            } // options search
            );
    

    Controller (replace old controller)
    Function WorkWith(ByVal parFormCollection As FormCollection) As ActionResult
    Try
    Dim varE As General1Entities = New General1Entities

                Dim operation = parFormCollection("oper")
                If operation.Equals("add") Then
                 Dim var1 = New OBJECT With { _
                  .ID_TYPE = parFormCollection.Get("parProduct").ToString,
                  **.ID_CONTRATANTE = parFormCollection.Get("parIDContratante").ToString,**
                  .etc.....
                 }
               varE.AddToOBJECTS(var1)
               varE.SaveChanges()
    
                ElseIf operation.Equals("edit") Then
    
                ElseIf operation.Equals("del") Then
    
                End If
    
                Return Json(True)
            Catch ex As Exception
                ' Do some error logging stuff, handle exception, etc.
                Return Json(False)
            End Try
        End Function
    

    I hope this helps some else.
    Bye.

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
Does anyone know how can I replace this 2 symbol below from the string
link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
In my XML file chapters tag has more chapter tag.i need to display chapters

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.