简化用户操作界面,添加功能一般没法简化,但是如果是在GridView做显示,编辑,更新与删除,会让用户在编辑,需要点击编辑铵钮,再进行编辑,或是取消编辑。
为了解决这个问题,Insus.NET想到一些改进的方法。可以参考下面演示:
以下内容于2011-11-07 9:20添加:
上面实现,只是使用Table加上GridView来组合。
其中,Gridveiw直接使用ItemTemplate模版,省略了EditItemTemplate模版。事件也省略了OnRowEditing与OnRowCancelingEdit事件。
如下所示:
然后把EditItemTemplate的内容搬至ItemTemplate模版中,并替换。
完整代码参考如下:
复制代码 代码如下:
Chinese Name
English Name
Edit
CellPadding="2" CellSpacing="0" Width="100%" BorderWidth="0" BorderColor="#c0c0c0"
onRowDeleting="GvCutterType_OnDeleteCommand" onRowUpdating="GvCutterType_OnUpdateCommand"
RowStyle-Height="20" ShowHeader="false">
'>
'>
xxx.aspx.cs:
复制代码 代码如下:
protected void ButtonInsert_Click(object sender, EventArgs e)
{
//do Insert something
}
protected void GvCutterType_onUpdateCommand(object sender, GridViewUpdateEventArgs e)
{
//do update something
}
protected void GvCutterType_onDeleteCommand(object sender, GridViewDeleteEventArgs e)
{
//do delete something
}



