开发者

Gridview item template refresh

开发者 https://www.devze.com 2022-12-29 23:35 出处:网络
<asp:TemplateField HeaderText=\"Quantity\" ItemStyle-HorizontalAlign=\"Left\" HeaderStyle-HorizontalAlign=\"Left\">
 <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.

0

精彩评论

暂无评论...
验证码 换一张
取 消