Combo Box in DataGrid

Results 1 to 2 of 2

Thread: Combo Box in DataGrid

  1. #1
    Join Date
    Dec 1969

    Default Combo Box in DataGrid

    I have a DataGrid. I am using EditItemTemplate and ItemTemplate.<BR><BR>On page load, I am showing records in the grid. When I press &#039;Edit&#039;, in one of the columns, I get a combo box. <BR><BR>When I click edit, the conbo box by default, is showing the 0th element (1st index). <BR><BR>But, when I click &#039;Edit&#039; for that particular row, in the combo box I need it to show, the value that existed before I clicked &#039;Edit&#039;.<BR><BR>I know how this could be done in VB. I do not know how this could be done in ASP.NET.<BR><BR>Could anyone please show me how to do this??<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969

    Default RE: Combo Box in DataGrid

    In the OnItemDataBound event handler find the control that you are looking for and select the item there.<BR><BR>To ensure that you get the correct row you need to use this sort of logic:<BR><BR>If e.Item.ItemType = ListItemType.EditItem Then<BR> &#039; Find the ddList<BR> &#039; Find the value you want to pre-select<BR> &#039; select it!<BR>End If

Posting Permissions

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