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
1840
Change a templated field in Code behind
posted

Hello,

i use VS 2010 SP1 and NetAdvantage 11.1.20111.2064. I use a Webdatagrid with a SqlDatasource and a templated field.

<ig:TemplateDataField Key="tf_Warenkorb" VisibleIndex="1" Width="30px">
    <ItemTemplate>
        <asp:Image ID="i_WK" runat="server" ImageUrl="~/Pictures/Warenkorb4.png"  ImageAlign="Middle" ToolTip="In den Warenkorb legen." CssClass="grid" />
    </ItemTemplate>
 <Header Text="Warenkorb"></Header>

</ig:TemplateDataField>

i catch the client-side Cell-Click-Event

<Behaviors>
  <ig:Selection RowSelectType="Single">
    <SelectionClientEvents CellSelectionChanged="wdg_Liste_Selection_CellSelectionChanged" />
    </SelectionClientEvents>

  </ig:Selection>
  <ig:RowSelectors RowNumbering="True">
  </ig:RowSelectors>
  <ig:Sorting>
     <ColumnSettings>
        <ig:SortingColumnSetting ColumnKey="tf_Warenkorb" Sortable="False" />
     </ColumnSettings>
  </ig:Sorting>
  <ig:Paging PageSize="30">
  </ig:Paging>
</Behaviors>

In the function, i check the Cell with the Click-Event and do some stuff. If cell 1 is clicked, the item goes in the basket (in my javascript). Now i need to change this, depending on the value of an other cell in the row (no problem). But i also need to change the image of the tempated field. So i try to use the 'InitializeRow' Event in code behind.

protected void wdg_Liste_Init_Row(object sender, RowEventArgs e)
  {
    if (e.Row.Items[12].Value.Equals("1")) 
      {
         e.Row.Items[1].Value = ?????;
      }
  }

But how can i change the image of the Templated field ( my Row.Item[1] ) ??

 

 

Parents Reply Children
No Data