關於DataBind和頁面代碼執行順序

    這是我在網上的第一篇技術文檔。很可能這種內容已經被不少人研究過,顯得過於簡單了,不過當時卻花了我整整一個下午,所以還是記錄一下吧。


    先從兩個極其簡單的問題開始。

    問題一:如果頁面上有一個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>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章