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
15
Using a dropdownlist in WebDataGrid TemplateDataField
posted

I'm trying to use a dropdownlist in a TemplateDataField.  I want to set the selected listitem based on a key value in my data and I want to use autopostback to call the ItemCommand even to update the database with the new selected value.  I don't know how to bind the selected item and I can't get the ItemCommand event to fire.  Here's my markup:

<ig:WebDataGrid ID="wdgResults" runat="server" SkinID="GridSmallOnly" EnableAjax="false" AutoGenerateColumns="false">
   <Behaviors>
      <ig:ColumnResizing Enabled="true" />
      <ig:Sorting Enabled="true" />
      <ig:Paging PageSize="10" PagerCssClass="grid_pager" PageLinkCssClass="grid_pagelink" CurrentPageLinkCssClass="grid_pagecurrent"
      PagerAppearance="Bottom"
      PagerMode="Numeric"
      FirstPageText="First Page"
      LastPageText="Last Page" />
   </Behaviors>
   <Columns>
      <ig:TemplateDataField Key="ddACH" Header-Text="ACH Request<br />Status" Width="120px">
         <ItemTemplate>
            <center>
               <asp:DropDownList ID="ddStatus" runat="server" AutoPostBack="true" CommandName="UpdateStatus" Argument="Test">
                  <asp:ListItem Text="Payment Requested" Value="1" />
                  <asp:ListItem Text="Being Processed" Value="2" />
                  <asp:ListItem Text="Process Completed" Value="3" />
                  <asp:ListItem Text="Request Cancelled" Value="4" />
               </asp:DropDownList>
            </center>
         </ItemTemplate>
      </ig:TemplateDataField>
   </Columns>
</ig:WebDataGrid>

Here's my code-behind:
Protected Sub wdgResults_ItemCommand(ByVal sender As Object, ByVal e As Infragistics.Web.UI.GridControls.HandleCommandEventArgs) Handles wdgResults.ItemCommand
   Dim command As String = e.CommandName.ToString
   Dim argument As String = e.CommandArgument.ToString

   ProcessDropDown(command, argument)
End Sub

I'd like to have the argument set to either the selectedvalue from the dropdownlist or the dropdownlist itself so that I can get to the selectedvalue that way.  But right now I can't even get the ItemCommand event to fire.  I am executing wdgResults.EnsureTemplates() on page load.