Grid1没有连接数据库,增加行后,怎样删除增加的行?
<x:Grid ID="Grid1" ShowBorder="true" ShowHeader="true" Title="表格" Width="850px" Height="400px"
runat="server" DataKeyNames="Id,Name" AllowCellEditing="true" ClicksToEdit="2">
<Toolbars>
<x:Toolbar ID="Toolbar1" runat="server">
<Items>
<x:Button ID="btnNew" Text="新增数据" Icon="Add" EnablePostBack="false" runat="server">
</x:Button>
<x:ToolbarFill ID="ToolbarFill1" runat="server">
</x:ToolbarFill>
<x:Button ID="btnDelete" Text="删除选中行" Icon="Delete" runat="server">
</x:Button>
</Items>
</x:Toolbar>
</Toolbars>
<Columns>
<x:RenderField Width="100px" ColumnID="Name" FieldType="String" HeaderText="姓名">
<Editor>
<x:TextBox ID="tbxEditorName" Required="true" runat="server">
</x:TextBox>
</Editor>
</x:RenderField>
<x:RenderField Width="100px" ColumnID="Gender" FieldType="Int" HeaderText="性别">
<Editor>
<xropDownList ID="DropDownList1" Required="true" runat="server">
<xistItem Text="男" Value="1" />
<xistItem Text="女" Value="0" />
</xropDownList>
</Editor>
</x:RenderField>
</Columns>
</x:Grid>
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
JObject defaultObj = new JObject();
defaultObj.Add("Name", "用户名");
defaultObj.Add("Gender", 1);
// 第一行新增一条数据
btnNew.OnClientClick = Grid1.GetAddNewRecordReference(defaultObj, false);
}
}
protected void btnDelete_Click(object sender, EventArgs e)
{
//怎样删除行和清空???????
}
|