Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
how to populate edit form dropdown from db
18/09/2009
09:29
Avatar
Mike27516
Guest
Guests

Hello - I am trying (desparately) to fill my edit form dropdown from a db call (LINQ specifically). I can't seem to get the format it likes because my dropdown always comes up empty. I know I'm hitting my controller code because I'm setting a break point in it and hitting it. As a test I am bypassing the db call and just passing back a string I think should work but is not . Please any suggestions much appreciated.  I could not find in the doc the format it is looking for. Here's my code:

Controller:       

public string GetTypes()
        {
          
            string strRet = "";

           
            return "1:Sideboom;2:Truck;3:Car";
           
        }

aspx:

    jQuery(document).ready(function() {
        jQuery("#sandgrid").jqGrid({
        url: '/EquipTrack/GridData/',
            editurl: '/EquipTrack/Edit/',
            datatype: 'json',
            mtype: 'GET',
            height: 255,
            width: 755,
            rowNum: 5000,
            colNames: ['ID', 'Type', 'Make', 'Model', 'Year', 'Location', 'Insp Due', 'Serv Due', 'Miles/Hrs', 'Milage Dt', 'Reg By', 'Mngd By', 'Tag Exp',''],
            colModel: [
                   { name: 'equip_id', index: 'equip_id', width: 65, editable: true },
                  {name: 'type_desc', index: 'type_desc', width: 130, editable: true, edittype: "select", formatter: 'select', editoptions: { dataUrl: '/EquipTrack/GetTypes'} },
                   { name: 'make_descr', index: 'make_descr', width: 80, editable: true },

.

.

.

       }).navGrid('#sandgridp',
     {}, //options
     {reloadAfterSubmit:false}, // edit options
     {reloadAfterSubmit:false}, // add options
     {reloadAfterSubmit:false}, // del options
     {} // search options
     );
         
        $('#sandgridp_center').remove();
        $('#sandgridp_right').remove();
    });

18/09/2009
10:03
Avatar
Mike27516
Guest
Guests

OK - I've got it populating the dropdown with the following format (found it on another topic):

           return "<select><option value='1'>Sideboom</option><option value='2'>Truck</option><option value='3'>Car</option></select>";

I also removed the formatter: 'select' from my column definition because I was getting 'undefined' in my grid for every row in the equip_type column.

Now my issue is getting the dropdown to have the correct selection in it on edit. It comes up with the dropdown unselected. Any suggestions much appreciated.

Thanks.

18/09/2009
11:12
Avatar
Mike27516
Guest
Guests

OK - my problem again. My sample data wasn't actually matching up witht e grid data. Corrected the sample dropdown values and voila - works like a charm. I am really digging jqgrid. I will use this a lot.

Mike

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
42 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information