views:

26

answers:

1
 <asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
     <ItemTemplate>
         <%#GetQuantityRemaining((int) Eval("Id")) %>
     </ItemTemplate>
     <HeaderStyle HorizontalAlign="Left"></HeaderStyle>
     <ItemStyle HorizontalAlign="Left"></ItemStyle>
 </asp:TemplateField>

Every time the user clicks on some buttons or modifies some fields, I need to update this field, calling the GetQuantityRemaining method again. Is there a way to do that?

A: 

Hey,

If you put a label control in there and bind the GetQuantityremaining statement to it, you could access the label control by its ID using e.Row (depending on the event) or gridview.Rows[index], and continuing with .Cells[].FindControl("");, and then assign the label the new value.

HTH.

Brian