dgCategory是用于显示类别表的DataGrid
自动分页AllowPaging= TRUE!!!!
private void dgCategory_PageIndexChanged(object source SystemWebUIWebControlsDataGridPageChangedEventArgs e)
{
dgCategoryCurrentPageIndex=eNewPageIndex
dgCategoryDataBind()
}
排序默认按PKId排序
private void dgCategory_SortCommand(object source SystemWebUIWebControlsDataGridSortCommandEventArgs e)
{
string SortOrder=eSortExpressionToString()
BindData(SortOrder)
}
private void BindData(string SortOrder)
{
ProductSystem productSys=new ProductSystem()//底层数据接口
CategoryDatacategorySet=productSysGetCategories() //底层数据接口返回ID为的Category
DataViewcategoryView=categorySetTables[CategoryDataCATEGORIES_TABLE]DefaultView
categoryViewSort=SortOrder
lblTitleText=按+SortOrder+排序
dgCategoryDataSource=categoryView
dgCategoryDataBind()
}
private void Page_Load(object sender SystemEventArgs e)
{
BindData(PKId)
}
编辑更新取消
private void dgCategory_EditCommand(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
{
dgCategoryEditItemIndex=eItemItemIndex
BindData(PKId)
}
private void dgCategory_CancelCommand(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
{
dgCategoryEditItemIndex=
BindData(PKId)
}
private void dgCategory_UpdateCommand(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
{
string strUpdate=
strUpdate+=PKId=+((TextBox)eItemCells[]Controls[])Text+
strUpdate+=ParentId=+((TextBox)eItemCells[]Controls[])Text+
strUpdate+=Description=+((TextBox)eItemCells[]Controls[])Text+
strUpdate+=IsLeaf=+((TextBox)eItemCells[]Controls[])Text+
try
{
CagegorySetExecuteUpdate(strUpdate)//需要后台提供更新的接口
dgCategoryEditItemIndex=
}
catch
{
ResponseWrite(<script language=javascript>alert(未能完成更新请…………)</script>)
}
BindData(PKId)
}
private void dgCategory_DeleteCommand(object source SystemWebUIWebControlsDataGridCommandEventArgs e)
{
//获得关键字使用DataKeys集合访问数据列表控件中每个记录的键值(显示为一行)
//使得用户可以存储键字段而无需在控件中显示它
string PKId=dgCategoryDataKeys[eItemItemIndex]
CategorySetExecuteDelete(PKId)
}*/