DataGrid with Dropdown list

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default DataGrid with Dropdown list

    Any Help is appreciated!
    I have a datagrid with Drop down list and a remove hyperlink as two
    columns.
    When I remove the row of the datagrid by clicking on the remove
    column,Dropdown list is mentaining its previous state.
    i.e Removed dropdownlist's selected value is applied to the next
    datagrid item's dropdown list.

    DATAGRID
    ---------------------------------------------------------
    "Remove" | "<DropDownList1>"
    ---------------------------------------------------------
    "Remove" | "<DropDownList2>""


    When the first row is removed, "DropDownList2" becomes
    "DropDownList1"!!!

    How to solve this problem?

    Thanks
    Vijay

    vijay_kerji@yahoo.com Guest

  2. Similar Questions and Discussions

    1. Dropdown list
      I would like to display 15 items (lines) in the dropdown list, but by default the list displays only 11 lines. How can I have all the 15 items...
    2. How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event.
      How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the...
    3. Refresh dropdown list
      On a cfform I have a cfselect dropdown . The situtation is that when an option isn't listed I have a "Add button" next to the drop down that...
    4. Tool Tip for DropDown list
      Hi, I have a dropwnlist of fixed width. The item names in the dropdown list are quite big. The Tooltip property for a dropdownlist control...
    5. bounding for dropdown list in datagrid
      Hello, I put a dropdown list in ItemTemplate Column. I can select its value from the dropdown list and store in a dataset, but when I retrieve...
  3. #2

    Default Re: DataGrid with Dropdown list

    Can you pls post some of the code you are using?

    Samuel Kim Guest

  4. #3

    Default Re: DataGrid with Dropdown list

    Can you pls post some of the code you are using?

    Samuel Kim Guest

  5. #4

    Default Re: DataGrid with Dropdown list

    "Samuel Kim" <look341@gmail.com> wrote in message news:<1108806189.308298.233670@g14g2000cwa.googleg roups.com>...
    > Can you pls post some of the code you are using?
    Hi,
    The following code is used in the 'remove' hyperlink click handler.

    foreach(DataGridItem DemoGridItem in dataGrid_AddUsers.Items)
    {
    DropDownList myDDList =
    (DropDownList)DemoGridItem.Cells[3].Controls[1];
    string selectedValue =
    ((DataGridUser)this.userList[index]).userRole;
    //Check if the program is in edit or create
    //If it is in edit, disable the datagrid item row and do not add
    PM as dropdownlist item.
    if ("ProgramEdit" == programModeValue)
    {
    if(selectedValue == "PM")
    {
    myDDList.Items.Add("PM");
    DemoGridItem.Enabled = myDDList.Enabled = false;
    myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
    = true;
    //myDDList.SelectedValue
    =((DataGridUser)this.userList[index]).userRole;
    } //if the role is null which is a bug in DB
    else if (selectedValue == "")
    {
    myDDList.Items.Add("Sub PM");
    myDDList.Items.Add("CBA");
    myDDList.Items.Add("Stake Holder");
    }
    else //since we are in edit mode, add all except PM
    {
    myDDList.Items.Add("Sub PM");
    myDDList.Items.Add("CBA");
    myDDList.Items.Add("Stake Holder");
    myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
    = true;
    //myDDList.SelectedValue
    =((DataGridUser)userList[index]).userRole;
    }
    }
    else //we are in create mode, add all the values to the list.
    {
    myDDList.Items.Add("PM");
    myDDList.Items.Add("Sub PM");
    myDDList.Items.Add("CBA");
    myDDList.Items.Add("Stake Holder");
    //set the selected value
    myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
    = true;
    //myDDList.SelectedValue
    =((DataGridUser)userList[index]).userRole;
    }
    index++;
    }

    Hope it is readable.

    Thanks

    Vijay
    Vijay Kerji Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139