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
209
Grid is not displaying results of cell change from InitializeRow
posted

Why does the following not work?

In the InitializeRow for the grid, depending on status I need to set a template value.

For example I have the following line:

e.Row.Items(wdgPriceless.Columns.FromKey("STRIKE").Index).Text = "Strike"

The grid always shows an empty cell.

Here is the markup for the grid:

<ig:WebDataGrid ID="wdgPriceless" runat="server" AutoGenerateColumns="False" EnableAjax="False" EnableDataViewState="True" Visible="False">
     <Columns>
    
         ...
        
         <ig:TemplateDataField Key="STRIKE"  Width="25%">
             <ItemTemplate>
                 <asp:Label ID="wdg_lbl_Strike" runat="server" />
             </ItemTemplate>
             <Header Text="Strike" />
         </ig:TemplateDataField>
        
         ...
        
     </Columns>
     <Behaviors>
         <ig:Activation />
         <ig:RowSelectors Enabled="true" />
         <ig:Selection CellClickAction="Row" RowSelectType="Single">
             <AutoPostBackFlags RowSelectionChanged="true" CellSelectionChanged="false" ColumnSelectionChanged="false" />
         </ig:Selection>
     </Behaviors>
 </ig:WebDataGrid>

  • 209
    Verified Answer
    posted

    What I needed to do was the following:

    Get the control from the templated field.

    Dim lbl As Label = CType(e.Row.Items(wdgPriceless.Columns.FromKey("STRIKE").Index).FindControl("wdg_lbl_Strike"), Label)

    lbl.text = "Strike"