<div>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting"
OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnPageIndexChanging="GridView1_PageIndexChanging" BackColor="White"
BorderColor="#CCCCCC" BorderWidth="5px" CellPadding="4"
ForeColor="Black" GridLines="Horizontal" Height="100%" Width="100%"
>
<Columns>
<asp:BoundField DataField="drugID" HeaderText="drugID" ReadOnly="true" Visible="False" />
<asp:BoundField DataField="药品名称" HeaderText="药品名称">
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="来源地区" HeaderText="来源地区" />
<asp:BoundField DataField="公司名称" HeaderText="公司名称">
<FooterStyle Wrap="True" />
<HeaderStyle Wrap="True" />
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="价格" HeaderText="价格" />
<asp:BoundField DataField="数量" HeaderText="数量" />
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
<asp:TemplateField HeaderText="删除" ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
Text="删除" OnClientClick="javascript:return confirm('确定要删除吗?');"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
</div>**************************************
后台//Gridview编辑事件
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
bind();//加载数据
}GridView编辑断点事件
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" OnRowDeleting="GridView1_RowDeleting"
OnRowEditing="GridView1_RowEditing" OnRowUpdating="GridView1_RowUpdating" OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnPageIndexChanging="GridView1_PageIndexChanging" BackColor="White"
BorderColor="#CCCCCC" BorderWidth="5px" CellPadding="4"
ForeColor="Black" GridLines="Horizontal" Height="100%" Width="100%"
>
<Columns>
<asp:BoundField DataField="drugID" HeaderText="drugID" ReadOnly="true" Visible="False" />
<asp:BoundField DataField="药品名称" HeaderText="药品名称">
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="来源地区" HeaderText="来源地区" />
<asp:BoundField DataField="公司名称" HeaderText="公司名称">
<FooterStyle Wrap="True" />
<HeaderStyle Wrap="True" />
<ItemStyle Wrap="True" />
</asp:BoundField>
<asp:BoundField DataField="价格" HeaderText="价格" />
<asp:BoundField DataField="数量" HeaderText="数量" />
<asp:CommandField HeaderText="编辑" ShowEditButton="True" />
<asp:TemplateField HeaderText="删除" ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete"
Text="删除" OnClientClick="javascript:return confirm('确定要删除吗?');"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#CCCC99" ForeColor="Black" />
<HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="Black" HorizontalAlign="Right" />
<SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F7F7F7" />
<SortedAscendingHeaderStyle BackColor="#4B4B4B" />
<SortedDescendingCellStyle BackColor="#E5E5E5" />
<SortedDescendingHeaderStyle BackColor="#242121" />
</asp:GridView>
</div>**************************************
后台//Gridview编辑事件
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
bind();//加载数据
}GridView编辑断点事件
建议楼主用ListView 替代 GridView
----------------------------------------
找到了:
<input id="submit" type="button" value="注册" />
这句代码有问题,是因为“submit”是保留字吗?还是因为其他原因?