关于DataBind和页面代码执行顺序

来源:互联网 发布:欧几里德算法c语言 编辑:程序博客网 时间:2024/04/30 16:48

    这是我在网上的第一篇技术文档。很可能这种内容已经被不少人研究过,显得过于简单了,不过当时却花了我整整一个下午,所以还是记录一下吧。


    先从两个极其简单的问题开始。

    问题一:如果页面上有一个server端控件,比如说Button btnNew,页面后台代码有响应这个Button事件的方法btnNew_Click

    那么,当用户点击这个Button时,页面后台代码的执行顺序是什么样的呢?

    答案是:首先执行Page_Load方法,然后执行btnNew_Click方法

    问题二:如果这个页面上还有其它server控件,比如说CheckBox或者DropDownList,btnNew_Click方法需要从这些控件中获取用户输入的数据进行处理,而此时Page_Load方法是空的,请问:btnNew_Click方法能够争取获取控件上的数据吗?

    答案是:可以。只要把控件的AutoPostBack属性值设为false就行了,否则在进入Page_Load方法时控件值会被刷新成默认值。

    两个很无聊的问题对吧?这是本文后面所要讲述的问题的基础。

    那么再看一个问题:

    如果CheckBox与DropDownList这样的server端控件被绑定在一个DataGrid的每一行,如下图,虚线框中是一个DataGrid,每一行都绑定了两个这样的控件。

    DataGrid的HTML代码如下:

 

<asp:datagrid id="dgrdEmpInbox" runat="server" CssClass="datagridStyle" Width="100%" Visible="False"  PagerStyle-CssClass="" OnPageIndexChanged="dgrdEmpInbox_Page" AllowPaging="True" AutoGenerateColumns="False">
             
<AlternatingItemStyle CssClass="listtableGREYSTRIP"></AlternatingItemStyle>
             
<ItemStyle CssClass="bodyText"></ItemStyle>
              
<HeaderStyle Height="30px" CssClass="listtableHEADLINE"></HeaderStyle>
              
<Columns>
                         
<asp:TemplateColumn HeaderText="Select">
                                       
<HeaderStyle Width="5%"></HeaderStyle>
                                        
<ItemTemplate>
                                                    
<asp:CheckBox id="chkSelect" Runat="server" AutoPostBack="false"></asp:CheckBox>
                                         
</ItemTemplate>
                         
</asp:TemplateColumn>
                         
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="IntAspirationId" DataNavigateUrlFormatString="../Employee/AppraiseeView.aspx?intAspSeqNo={0}" DataTextField="StrAspirationContent" HeaderText="Aspiration">
                                  
<HeaderStyle Width="40%"></HeaderStyle>
                                  
<ItemStyle CssClass="hyperlink"></ItemStyle>
                           
</asp:HyperLinkColumn>
                           
<asp:BoundColumn DataField="StrDateOfCreation" HeaderText="Date Raised">
                                            
<HeaderStyle Width="10%"></HeaderStyle>
                            
</asp:BoundColumn>
                            
<asp:BoundColumn DataField="IntStatusId" HeaderText="Status">
                                             
<HeaderStyle Width="15%"></HeaderStyle>
                            
</asp:BoundColumn>
                             
<asp:BoundColumn DataField="StrMgrId" HeaderText="Currently With">
                                              
<HeaderStyle Width="10%"></HeaderStyle>
                              
</asp:BoundColumn>
                              
<asp:TemplateColumn HeaderText="Action">
                                               
<HeaderStyle Width="5%"></HeaderStyle>
                                               
<ItemTemplate>
                                                            
<asp:DropDownList id="cmbAction" CssClass="DropDownListStyle" Runat="server" AutoPostBack="False"></asp:DropDownList>
                                               
</ItemTemplate>
                               
</asp:TemplateColumn>
                                
<asp:BoundColumn DataField="StrLastActed" HeaderText="Last Acted">
                                                
<HeaderStyle Width="10%"></HeaderStyle>
                                
</asp:BoundColumn>
                                
<asp:BoundColumn Visible="False" DataField="IntAspirationId"></asp:BoundColumn>
               
</Columns>
               
<PagerStyle Position="TopAndBottom" Mode="NumericPages"></PagerStyle>
</asp:datagrid>

    而Page_Load方法的代码如下:

 

void Page_Load(object sender, EventArgs e)
{
          
//调用逻辑结构层,返回集合
          AspirationFcd objAspFcd = new AspirationFcd();
          aspDataSource 
= objAspFcd.GetEmpAspirationListFcd();
                
          
//集合中有元素时将集合绑定至DataGrid
          if(aspDataSource.Count > 0)
       
{
                pnlDatagrid.Visible 
= true;
                pnlError.Visible 
= false;
                dgrdEmpInbox.Visible 
= true;
                dgrdEmpInbox.DataSource 
= aspDataSource;
                dgrdEmpInbox.DataBind();
          }

          
else
       
{
                pnlDatagrid.Visible 
= false;
                pnlError.Visible 
= true;
                btnEdit.Enabled 
= false;
           }


}

    问题:现在btnNew_Click方法还能够获取控件值吗?

    答案:不能。因为Button点击后,后台代码必然首先执行Page_Load方法,而由于Page_Load方法中有DataGrid绑定代码,控件也被重新绑定为默认值

    解决方法如下:只需用if(!IsPostBack)将代码括起即可

void Page_Load(object sender, EventArgs e)
{
         
if(!IsPostBack)
     
{
                //调用逻辑结构层,返回集合
                AspirationFcd objAspFcd = new AspirationFcd();
                aspDataSource 
= objAspFcd.GetEmpAspirationListFcd();
                
                 //集合中有元素时将集合绑定至DataGrid
                
if(aspDataSource.Count > 0)
            
{
                      pnlDatagrid.Visible 
= true;
                      pnlError.Visible 
= false;
                      dgrdEmpInbox.Visible 
= true;
                      dgrdEmpInbox.DataSource 
= aspDataSource;
                      dgrdEmpInbox.DataBind();
                }

               
else
            
{
                      pnlDatagrid.Visible 
= false;
                      pnlError.Visible 
= true;
                      btnEdit.Enabled 
= false;
                }


          }

}

    因为btnNew的点击事件属于PostBack,它总会跳过if(!IsPostBack)代码块,因此可以避免DataGrid的重新绑定造成的控件值丢失。

    这两个问题仍然显得很没技术含量,因为太常见了。但是,下面开始麻烦了:

    仔细看DataGrid的HTML代码和上面那幅页面外观图上的页码,可知DataGrid设置了分页(10条记录一页),而且DataGrid里面还绑定了一个OnPageIndexChanged="dgrdEmpInbox_Page",用来响应翻页事件。

    然而,翻页事件OnPageIndexChanged与Button点击事件一样,进入后台后会跳过if(!IsPostBack)这个代码块,但是翻页事件又必须依赖于DataGrid的绑定,即为了正确实现翻页,这一段代码

        dgrdEmpInbox.DataSource = aspDataSource;
        dgrdEmpInbox.DataBind();

必须放在if(!IsPostBack)之外,否则无论怎样翻页,DataGrid永远会停留在第一页,并且有时候还会出现DataGrid中的记录莫名其妙的丢失的现象,还有时候会产生其它异常的翻页现象,总之就是无法正确进入指定页。大家可以试试看。

    但是把DataGrid的绑定代码放在if(!IsPostBack)之外,又会产生btnNew_Click总是无法取得控件值的问题。

    那么,怎么解决呢?

    说到这里,我想应该说明一下这个项目的一些情况了。这是一个rework项目,虽然初次开发我也参与了,但是当时并不负责这个页面,而由于设计文档的审核没能通过,因此这个项目被退回并要求rework,此时这个页面因原开发者已经离开项目组,而分配给了我。

     原开发者的实现方式是在Button点击事件产生后,在Page_Load方法中捕捉到控件值并存入页面的ViewState对象中(其它一些页面也使用过存入HttpContext.Current.Session中的方法),执行代码进入btnNew_Click方法后,再从ViewState中取出控件值,并进行验证,最后调用逻辑层的方法进行业务处理。

     但项目被退回rework后一个重要的指标是设法提高性能,而新来的PM认为将验证放在后台代码对性能有影响,因此要求所有验证移至客户端(javascript)。如此一来,使用ViewState或context来存储控件值的方法就不可行了

 (太晚了,明天再写吧)

using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using InfyIS.CCM.Business.Entity;
using InfyIS.CCM.Business.Framework;
using ISCCMBizLogic.Framework;
using ISCCMBizLogic.Security;

namespace ISCCMWebApp.Employee
{
    
/// <summary>
    
/// Summary description for AppraiseeMain.
    
/// </summary>

    public class AppraiseeMain : Page
    
{
        
protected Button btnAddNew;
        
protected Button btnEdit;
        
protected Button btnDelete;
        
protected Button btnSave;
        
protected Label lblDelete;
        
protected Label lblError;
        
protected Panel pnlError;
        
protected Panel pnlDatagrid;
        
protected LinkButton lnkbtnHomeLink;
        
protected LinkButton hyplHomeLink;
        
protected DataGrid dgEmpInbox;
        
protected DataGrid dgrdEmpInbox;
        
protected string strMaxNo;
        
protected AspirationCollection aspDataSource;
        
/********************************************************************************
         * Purpose: Load/reload Aspirations of an employee.
         * Parameters: 1)object sender,EventArgs e 
         * Returned Value: void
         * Calls: 
         * Programmer's Notes: 
         * 
         * *****************************************************************************
*/

        
private void Page_Load(object sender, EventArgs e)
        
{
            InfyIS.CCM.Business.Entity.Employee empMy
= (InfyIS.CCM.Business.Entity.Employee)HttpContext.Current.Session["MyAccount"];

            Security objSecur 
= new Security();
            
if(false == objSecur.IsAuthorized("EmpAspInbox",empMy.StrMailId))
            
{
                Session.Add(
"ErrorMsg",ExceptionHandler.SoleInstance.GetMessage(2));
                Response.Redirect(
"../CCMHome.aspx");
            }


            
this.btnDelete.Attributes.Add("OnClick","javascript:return ClickbtnDelete();");
            
this.btnSave.Attributes.Add("OnClick","javascript:return ClickbtnSave();");
            
this.btnEdit.Attributes.Add("OnClick","javascript:return ClickbtnEdit();");
            
this.btnAddNew.Attributes.Add("OnClick","javascript:return ClickbtnAdd();");
            
            AspirationFcd objAspFcd 
= new AspirationFcd();
            objAspFcd.SetCurrentUserDetails(empMy);

            empMy.QueryQuota();
    
            strMaxNo 
= empMy.Max_open_number.ToString();

            
if(!IsPostBack)
            
{
                aspDataSource 
= objAspFcd.GetEmpAspirationListFcd();
                
                PageReload();
            }

        
        }


        
Web Form Designer generated code

        
events

        
        
ClientMethods

        
/********************************************************************************
         * Purpose: Redirect to User's home page when CCM home link is clicked.
         * Parameters: 1)object sender,EventArgs e 
         * Returned Value: void
         * Calls:
         * Programmer's Notes: 
         * 
         * *****************************************************************************
*/

        
private void hyplHomeLink_Click(object sender, EventArgs e)
        
{
            InfyIS.CCM.Business.Entity.Employee employee 
= (InfyIS.CCM.Business.Entity.Employee)HttpContext.Current.Session["MyAccount"];
                
if(employee != null)
                    Response.Redirect(employee.AccessTable.StrDefaultPage);
                
else
                
{
                    Session.Add(
"ErrorMsg",ExceptionHandler.SoleInstance.GetMessage(5));
                    Response.Redirect(
"../CCMHome.aspx");
                }

        }


        
protected void dgrdEmpInbox_Page(object source, DataGridPageChangedEventArgs e)
        
{
            InfyIS.CCM.Business.Entity.Employee empMy 
= (InfyIS.CCM.Business.Entity.Employee)HttpContext.Current.Session["MyAccount"];
            AspirationFcd objAspFcd 
= new AspirationFcd();
            objAspFcd.SetCurrentUserDetails(empMy);
            aspDataSource 
= objAspFcd.GetEmpAspirationListFcd();
            PageReload();
            dgrdEmpInbox.CurrentPageIndex 
= e.NewPageIndex;
            
if(this.aspDataSource != null)
            
{
//                AspirationCollection dataSource = (AspirationCollection)Session["AspirationCollectionForPaging"];
                
                
if(aspDataSource.Count > 0)
                
{
                    pnlDatagrid.Visible 
= true;
                    pnlError.Visible 
= false;
                    dgrdEmpInbox.Visible 
= true;
                    dgrdEmpInbox.DataSource 
= aspDataSource;
                    dgrdEmpInbox.DataBind();
                    
                }

                
else
                
{
                    pnlDatagrid.Visible 
= false;
                    pnlError.Visible 
= true;
                    btnEdit.Enabled 
= false;
                        
                }

            }

        }


        
private void PageReload()
        
{
            
if(aspDataSource.Count > 0)
            
{
                pnlDatagrid.Visible 
= true;
                pnlError.Visible 
= false;
                dgrdEmpInbox.Visible 
= true;
                dgrdEmpInbox.DataSource 
= aspDataSource;
                dgrdEmpInbox.DataBind();
                
            }

            
else
            
{
                pnlDatagrid.Visible 
= false;
                pnlError.Visible 
= true;
                btnEdit.Enabled 
= false;
                
            }

        }

    }

}

 

 

<%@ Register TagPrefix="CCM" TagName="Header" Src="../UserControls/EmpHeader.ascx" %>
<%@ Register TagPrefix="CCM" TagName="Footer" Src="../UserControls/Footer.ascx" %>
<%@ Page language="c#" Codebehind="AppraiseeMain_New.aspx.cs" AutoEventWireup="false" Inherits="ISCCMWebApp.Employee.AppraiseeMain" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    
<HEAD>
        
<title>Employee Inbox</title>
        
<script language="JavaScript">       
window.history.forward(
1);
        
</script>
        
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
        
<meta content="C#" name="CODE_LANGUAGE">
        
<meta content="JavaScript" name="vs_defaultClientScript">
        
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
        
<LINK href="../stylesheet/Style.css" type="text/css" rel="stylesheet">
        
<LINK href="../stylesheet/ISstyle.css" type="text/css" rel="stylesheet">
        
<script language="javascript">
                        
            
function ClickchkSelect(strChk,strCmb)
            
{
                
if(document.getElementById(strCmb).disabled==true&&document.getElementById(strChk).checked==true)
                
{
                    
var del = parseInt(document.getElementById('DelFlag').value)+1;
                    document.getElementById(
'DelFlag').value = del.toString();
                }

                
if(document.getElementById(strCmb).disabled!=true&&document.getElementById(strChk).checked==true)
                
{
                    
var ndel = parseInt(document.getElementById('NotDelFlag').value)+1;
                    document.getElementById(
'NotDelFlag').value = ndel.toString();
                }

                
if(document.getElementById(strCmb).disabled==true&&document.getElementById(strChk).checked==false)
                
{
                    
var del = parseInt(document.getElementById('DelFlag').value)-1;
                    document.getElementById(
'DelFlag').value = del.toString();
                }

                
if(document.getElementById(strCmb).disabled!=true&&document.getElementById(strChk).checked==false)
                
{
                    
var ndel = parseInt(document.getElementById('NotDelFlag').value)-1;
                    document.getElementById(
'NotDelFlag').value = ndel.toString();
                }

            }

            
            
function ClickbtnDelete()
            
{
                
var countNotDel = parseInt(document.getElementById('NotDelFlag').value);
                
var countDel = parseInt(document.getElementById('DelFlag').value);
                
if(countNotDel>0)
                
{
                    window.alert(
"One or more of the aspirations you select can not be deleted.  You can only delete the ones with 'New' status!");
                    
return false;
                }

                
else if(countDel <= 0)
                
{
                    
                    window.alert(
"Please select at least one aspiration to delete!");
                    
return false;
                }

                
else
                
{
                    
if(window.confirm('Do you want to delete the aspirations you selected?'))
                        
return true;
                    
else
                        
return false;
                }

                
            }

                        
            
function ClickbtnEdit()
            
{
                
var countNotDel = parseInt(document.getElementById('NotDelFlag').value);
                
var countDel = parseInt(document.getElementById('DelFlag').value);
                
if(countNotDel>0)
                
{
                    window.alert(
"One or more of the aspirations you select can not be edited.  You can only edit the ones with 'New' status!");
                    
return false;
                }

                
else if(countDel <= 0)
                
{
                    window.alert(
"Please select at least one aspiration to edit!");
                    
return false;
                }

                
else
                    
return true;
            }

            
            
function ClickbtnSave()
            
{
                
                
var countNotDel = parseInt(document.getElementById('NotDelFlag').value);
                
var countDel = parseInt(document.getElementById('DelFlag').value);
                
if(countDel>0)
                
{
                    window.alert(
"One or more of the aspirations you select can not be saved.");
                    
return false;
                }

                
else if(countNotDel <= 0)
                
{
                    window.alert(
"Please select at least one aspiration to save!");
                    
return false;
                }

                
else
                    
return true;
            }

            
            
function ClickbtnAdd()
            
{
                maxNo 
= parseInt(document.getElementById("AddFlag").value);
                
if(maxNo<=0)
                
{
                    alert(
"You have reached the maximum number of active aspiration.");
                    
return false;
                }

                
else
                
{
                    document.getElementById(
"AddFlag").value = maxNo.toString();
                    window.open(
'../Employee/AppraiseeAspiration.aspx?Query=emp_asp_new','','height=400,width=780,left=80,top=200,channelmode=0,dependent=0,directories=0,fullscreen=0,location=0,menubar=0,resizable=0,scrollbars=1,status=0,toolbar=0');
                    
return false;
                }

            }

        
</script>
    
</HEAD>
    
<body class="bodyTEXT" MS_POSITIONING="GridLayout">
        
<form id="FormCCM" runat="server">
            
<CCM:HEADER id="EmpHeader" runat="server"></CCM:HEADER>
            
<table style="WIDTH: 976px; HEIGHT: 384px" height="384" cellSpacing="0" cellPadding="0"
                width
="976" border="0">
                
<tr height="5%">
                    
<td>
                        
<!--Header Space -->
                        
<table id="header" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
                            
<tr>
                                
<td>
                                    
<table cellSpacing="0" cellPadding="0">
                                        
<tr>
                                            
<td class="secondnavGREEN"></td>
                                            
<td class="secondnavSEPERATE" align="center"><class="secondnavLINKON" href="../Employee/AppraiseeMain_New.aspx">Aspirations</A>
                                            
</td>
                                            
<td><IMG class="secondnavSEPERATE" src="../images/seperator.gif" border="0">
                                            
</td>
                                            
<td class="secondnavSEPERATE" align="center"><class="secondnavLINKOFF" href="../Employee/AppraiseeCareerPlan.aspx">Career 
                                                    Planning 
</A>
                                            
</td>
                                            
<td><IMG class="secondnavSEPERATE" src="../images/seperator.gif" border="0">
                                            
</td>
                                            
<td class="secondnavSEPERATE" align="center"><class="secondnavLINKOFF" href="../DashBoard/PerformanceData.aspx">My 
                                                    Dashboard 
</A>
                                            
</td>
                                        
</tr>
                                    
</table>
                                
</td>
                            
</tr>
                        
</table>
                    
</td>
                
</tr>
                
<tr>
                    
<td>
                        
<!--Information Space -->
                        
<table id="information" height="100%" cellSpacing="0" cellPadding="0" width="100%" border="0">
                            
<tr vAlign="top">
                                
<!--Internal Right Space -->
                                
<td style="BORDER-TOP: silver 1px dotted" align="center" width="85%">
                                    
<table id="rightside" width="100%">
                                        
<tr>
                                            
<td>
                                                
<table id="internalRightHeader" cellSpacing="0" cellPadding="0" width="100%" border="0">
                                                    
<tr>
                                                        
<td style="HEIGHT: 18px"><asp:linkbutton id="lnkbtnHomeLink" runat="server" CssClass="breadcrumbLINK"><FONT size="1">CCM</FONT></asp:linkbutton><FONT size="1">&gt;</FONT>
                                                            
<class="breadcrumbLINK" href="../Employee/emp_inbox.aspx?Category=counselling&amp;Command=emp_inbox">
                                                                
<FONT size="1">Employee</FONT></A><FONT size="1">&gt;</FONT>&nbsp;<FONT size="1">Aspirations</FONT>
                                                        
</td>
                                                        
<td style="HEIGHT: 18px" align="right"><IMG src="../images/help_FineGround_0nmwhres3t3vo4dboir2qje21_FGN_V01.gif" border="0">
                                                            
<IMG class="secondnavSEPERATE" src="../images/seperator.gif" border="0"> <IMG onmouseover="this.style.cursor='hand'" onclick="window.print()" src="/ISCCMWebApp/images/print.gif"
                                                                border
="0">
                                                        
</td>
                                                    
</tr>
                                                
</table>
                                            
</td>
                                        
</tr>
                                        
<tr>
                                            
<td>
                                                
<table id="internalRightBody" height="80%" width="100%" border="0">
                                                    
<!--Body Space -->
                                                    
<tr height="100%" width="100%">
                                                        
<td><asp:panel id="pnlError" Width="100%" Runat="server">
                                                                
<TABLE class="errorTable" style="WIDTH: 960px; HEIGHT: 34px" borderColor="#cc0000" width="960">
                                                                    
<TR>
                                                                        
<TD><IMG src="../images/error.gif" border="0">
                                                                            
<asp:Label id="lblError" CssClass="tableTEXT" Runat="server" Width="920px" Visible="True">No aspirations to display</asp:Label></TD>
                                                                    
</TR>
                                                                
</TABLE>
                                                            
</asp:panel></td>
                                                    
</tr>
                                                    
<tr height="100%" width="100%">
                                                        
<td align="center"><asp:panel id="pnlDatagrid" Runat="server" Visible="False">
                                                                
<asp:datagrid id="dgrdEmpInbox" runat="server" CssClass="datagridStyle" Width="100%" Visible="False"
                                                                    PagerStyle-CssClass
="" OnPageIndexChanged="dgrdEmpInbox_Page" AllowPaging="True" AutoGenerateColumns="False">
                                                                    
<AlternatingItemStyle CssClass="listtableGREYSTRIP"></AlternatingItemStyle>
                                                                    
<ItemStyle CssClass="bodyText"></ItemStyle>
                                                                    
<HeaderStyle Height="30px" CssClass="listtableHEADLINE"></HeaderStyle>
                                                                    
<Columns>
                                                                        
<asp:TemplateColumn HeaderText="Select">
                                                                            
<HeaderStyle Width="5%"></HeaderStyle>
                                                                            
<ItemTemplate>
                                                                                
<asp:CheckBox id="chkSelect" Runat="server" AutoPostBack="false"></asp:CheckBox>
                                                                            
</ItemTemplate>
                                                                        
</asp:TemplateColumn>
                                                                        
<asp:HyperLinkColumn Target="_blank" DataNavigateUrlField="IntAspirationId" DataNavigateUrlFormatString="../Employee/AppraiseeView.aspx?intAspSeqNo={0}"
                                                                            DataTextField
="StrAspirationContent" HeaderText="Aspiration">
                                                                            
<HeaderStyle Width="40%"></HeaderStyle>
                                                                            
<ItemStyle CssClass="hyperlink"></ItemStyle>
                                                                        
</asp:HyperLinkColumn>
                                                                        
<asp:BoundColumn DataField="StrDateOfCreation" HeaderText="Date Raised">
                                                                            
<HeaderStyle Width="10%"></HeaderStyle>
                                                                        
</asp:BoundColumn>
                                                                        
<asp:BoundColumn DataField="IntStatusId" HeaderText="Status">
                                                                            
<HeaderStyle Width="15%"></HeaderStyle>
                                                                        
</asp:BoundColumn>
                                                                        
<asp:BoundColumn DataField="StrMgrId" HeaderText="Currently With">
                                                                            
<HeaderStyle Width="10%"></HeaderStyle>
                                                                        
</asp:BoundColumn>
                                                                        
<asp:TemplateColumn HeaderText="Action">
                                                                            
<HeaderStyle Width="5%"></HeaderStyle>
                                                                            
<ItemTemplate>
                                                                                
<asp:DropDownList id="cmbAction" CssClass="DropDownListStyle" Runat="server" AutoPostBack="False"></asp:DropDownList>
                                                                            
</ItemTemplate>
                                                                        
</asp:TemplateColumn>
                                                                        
<asp:BoundColumn DataField="StrLastActed" HeaderText="Last Acted">
                                                                            
<HeaderStyle Width="10%"></HeaderStyle>
                                                                        
</asp:BoundColumn>
                                                                        
<asp:BoundColumn Visible="False" DataField="IntAspirationId"></asp:BoundColumn>
                                                                    
</Columns>
                                                                    
<PagerStyle Position="TopAndBottom" Mode="NumericPages"></PagerStyle>
                                                                
</asp:datagrid>
                                                            
</asp:panel></td>
                                                    
</tr>
                                                
</table>
                                                
<br>
                                                
<align="center"><asp:button id="btnAddNew" runat="server" CssClass="tableBUTTON" Text="Add New Aspiration..."></asp:button><asp:button id="btnSave" runat="server" CssClass="tableBUTTON" Text="Save"></asp:button><asp:button id="btnEdit" runat="server" CssClass="tableBUTTON" Text="Edit"></asp:button><asp:button id="btnDelete" runat="server" CssClass="tableBUTTON" Text="Delete"></asp:button></p>
                                                
<input 
                  
id=AddFlag type=hidden value="<%=strMaxNo%>" 
                  
> <input id="NotDelFlag" type="hidden" value="0"> <input id="DelFlag" type="hidden" value="0">
                                            
</td>
                                        
</tr>
                                    
</table>
                                
</td>
                            
</tr>
                        
</table>
                    
</td>
                
</tr>
            
</table>
            
<CCM:FOOTER id="footer" runat="server"></CCM:FOOTER></form>
    
</body>
</HTML>
原创粉丝点击