0
AccountBindingDGV_RowDataBount
다음은 내 코드입니다.
Button.CommandArgument의 값이 손실되는 이유는 무엇입니까?
<asp:GridView ID="AccountBindingDGV" runat="server" SkinID="gridviewSkin"
OnRowDataBound="AccountBindingDGV_RowDataBound" ShowFooter="True" AutoGenerateColumns="False"
OnDataBound="AccountBindingDGV_DataBound"
<Columns>
<asp:BoundField DataField="UserName" HeaderText="UserName" />
<asp:BoundField DataField="WebsiteAccount" HeaderText="WebsiteAccount" />
<asp:TemplateField HeaderText="Remove" ShowHeader="False">
<ItemTemplate>
<asp:Button ID="Remove" runat="server" Text="Remove" CssClass="ButtonCss1" CommandArgument='<%# Bind("ID") %>'
OnClick="RemoveButton_Click" OnClientClick="return confirm('Are you sure to REMOVE this account?')" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Add" ShowHeader="False">
<ItemTemplate>
<asp:Button ID="Add" runat="server" Text="Add" CssClass="ButtonCss1" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
AccountBindingDGV_RowDataBount
AccountBindingDGV_RowDataBount
를 실행할 때 몇 가지 작업을 수행합니다.
하나의 레코드를 제거하기 위해 Remove.CommandArgument에 의해 전달 된 ID가 필요하지만이 값은 비어 있습니다. 내가 AccountBindingDGV_RowDataBount
을 디버깅하고 이러한 제거 단추가 올바른 값을 찾았나요? 나는 왜 그런지 모르겠다. ?? 좋은 생각이야?
도움이 될 것입니다 (http://meta.stackexchange.com/q/8259) 여기에 대한 대답의 본질적인 부분을 포함하는 참조 용 링크를 제공하십시오. – jjnguy