Gridview item template refresh
<asp:TemplateField HeaderText="Quantity" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
<ItemTemplate>
<%#GetQuantityRemaining((int) Eval("Id")) %>
</ItemTemplate>
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</a开发者_运维技巧sp: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?
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.
精彩评论