Data Grid Inline editting

Results 1 to 2 of 2

Thread: Data Grid Inline editting

  1. #1
    Join Date
    Dec 1969

    Default Data Grid Inline editting

    I have a data grid with two template columns that both use a dropdownlist when in edit mode. The frist dropdownlist selection governs (on the server side) the contents of the second dropdownlist. I can't get the selected value from the first dropdown to use in the SQL of the second dropdown databinding. The event for the change_event of the first dropdown seems to be too late, and won't allow me access to the second dropdown. Also the grids itemcreated_event seems to be too soon, the first dropdown is showing -1 for selected index. Anyone have experience with this type, and have any advice?

  2. #2
    Join Date
    Dec 1969

    Default RE: Data Grid Inline editting

    A couple of things might be happening - a code snippet would help. The first and easiest solution may be to make sure you have autopostback="true" on your first dropdownlist. That will make a postback whenever the value of the dropdownlist is changed, thus triggering the onchanged event.<BR><BR>Second, and more likely, is that you&#039;re having a problem finding the exact dropdownlist that you want. Since you&#039;re using a datagrid, there are really many different possible dropdownlists (one for each column for each row). To reference one of the dropdownlist you are looking for, you have to get the datagriditem at the edititemindex. Then you can use findcontrol to get your dropdownlist to databind it, get a value or whatnot.<BR><BR>The tricky thing is that you are managing a lot of different nested databound controls. You might run into problems where the datagrid databinding clears the dropdownlists and such. One alternative may be to build the editing logic separate from the datagrid and just use the datagrid to select the primary key of what you want to edit.<BR><BR>If this doesn&#039;t solve your problem, post some code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts