0
您好我的GridView有問題。我有一種方法,我需要2個datakeynames,然後另一種方法,我需要一個datakey名稱。我不知道該如何處理?任何人都可以告訴我該怎麼辦?我將在下面發佈我的GridView代碼。只要讓我知道是否需要其他代碼。謝謝。GrdiView需要1 DataKeyName爲1方法和2 DataKeyName爲另一種方法
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="ObjectDataSource1" DataKeyNames="intExaminerID,sintDOLDistrictOfficeID" OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtID" Visible="false" runat="server" Text='<%# Bind("intExaminerID") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:TextBox ID="txtDOID" Visible="false" runat="server" Text='<%# Bind("sintDOLDistrictOfficeID") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name">
<ItemTemplate>
<asp:TextBox ID="txtFName" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharFirstName") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Name">
<ItemTemplate>
<asp:TextBox ID="txtLName" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharLastName") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email">
<ItemTemplate>
<asp:TextBox ID="txtEmail" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharEmailAddress") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Extension">
<ItemTemplate>
<asp:TextBox ID="txtPhone" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharPhoneExtension") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SSN Block">
<ItemTemplate>
<asp:TextBox ID="txtSSNStart" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharSSNBlockStart") %>' Width="5em"></asp:TextBox>
<asp:TextBox ID="txtSSNEnd" Visible='<%# IsInEditMode %>' runat="server" Text='<%# Bind("vcharSSNBlockEnd") %>' Width="5em"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Action(s)">
<ItemTemplate>
<asp:Button ID="btnUpdate" runat="server" Text="Update" CommandName="Update" CommandArgument='<%# Container.DataItemIndex %>'
/>
<%--<asp:Button ID="btnUpdate" runat="server" Text="Update" OnClick="UpdateRow" />--%>
<asp:Button ID="btnDelete" runat="server" Text="Delete" CommandName="Delete" CommandArgument='<%# Container.DataItemIndex %>'
/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>