Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
210
Please Help! Important. DropDownList in WebGrid Questions (Binding and selecting values) .
posted

Hi, I am having small problems with the dropdowlist in the grid.

The thing is that I am able to Bind the value list in the grid.

The binding works but when I run the program, the column which contains the dropdown list doesnt show the valuelist or anything unless I click on the cell.

When I click on the cell the dropdownappears and it will stay there. I need for the grid to show the values and dropdownlist when the grid does the binding. It looks as an empty cell unless I click on it and the rest of the cells in that column would be still be empty unless I clicked on them too.

 

Also another question is. How can I set the index of a dropdown for that specific row.

And last one...How do i get the VALUE of the dropdownlist. I want to shot the datamemember as the display but when saving I want to save the valuememember of the selected item.

Please help...this is important.

Thanks in advance.

 

 

  • 21382
    Verified Answer
    posted

    The blank display is probably a dataType mismatch.  Ensure that the Value field of the DropDown is the same datatype as the Column's datatype.

     

    You don't set the index of the dropdown, you set the value of the cell, the WebGrid will then show the correct text.

     

    The Value of the Cell should be the value of the dropdown, so when you are persisting your changes you should just look at the value of the cell.