摘要:
frmmain.aspx.cs
using system;
using system.collections;
using system.componentmodel;
using system.data;
using system.data.sqlclient;
using system.drawing;
using system.web;
using system.web.s......
摘要:
在asp.net中使用静态变量要比application更好的选择
在传统的asp页面中,我们需要利用application变量传递一些特殊变量,在asp.net中任何页面都可以是类,global.asax也不例外。
我们只需要在global.asax加入类名。
<%@ application classname="myglobals" %>
然后......
mark新官上任,转贴一个DataGrid(增加删除确认和新增记录功能),道贺:)
using system;
using system.web.ui.webcontrols;
using system.data;
/*
* the control assumes the following:
*
* 1) it is bound to a dataview object.
* 2) the app will use direct sql commands to update the source (no batch update).
* 3) no custom paging is enabled.
*
* if you plan to support sorting, then some aspects of this code should be reviewed
* and adapted.
*
*/
namespace bwslib
{
namespace controls
{
public class editablegrid : datagrid
{
// constructor that sets some styles and graphical properties
public editablegrid()
{
allowfullediting = true;
addnewrow = false;
rejectchanges = false;
mustinsertrow = false;
allowpaging = true;
// handlers
init += new eventhandler(oninit);
pageindexchanged += new datagridpagechangedeventhandler(onpageindexchanged);
itemcreated += new datagriditemeventhandler(onitemcreated);
cancelcommand += new datagridcommandeventhandler(oncancelcommand);
editcommand += new datagridcommandeventhandler(oneditcommand);
updatecommand += new datagridcommandeventhandler(onupdatecommand);
deletecommand += new datagridcommandeventhandler(ondeletecommand);
}
// property: allowfullediting
// enable full editing
public bool allowfullediting;
// property: addnewrow
// if true must add an empty row at the bottom of the data source
public bool addnewrow;
// internal property: rejectchanges
// if true must reject changes on the last row of the data source
protected bool rejectchanges;
// internal property: mustinsertrow
// if true must insert instead of update and theres a pending change
protected bool mustinsertrow
&...
下一页 摘要:
using system;
using system.data;
using system.data.sqlclient;
using system.web;
using system.web.ui.webcontrols;
namespace osleagueforumxp.admin
{
/// <summary>
/// 编辑公告页面
/// </s......