home *** CD-ROM | disk | FTP | other *** search
/ 66.142.0.142 / 66.142.0.142.tar / 66.142.0.142 / tblMessagelist.aspx.vb < prev    next >
Text File  |  2010-08-24  |  19KB  |  722 lines

  1. Imports System.Data
  2. Imports System.Data.Common
  3. Imports System.Xml
  4. Imports System.IO
  5. Imports System.Data.OleDb
  6.  
  7. '
  8. ' ASP.NET code-behind class (Page)
  9. '
  10.  
  11. Partial Class tblMessagelist
  12.     Inherits AspNetMaker7_tfpssnet
  13.  
  14.     ' Page object
  15.     Public tblMessage_list As ctblMessage_list
  16.  
  17.     '
  18.     ' Page Class
  19.     '
  20.     Class ctblMessage_list
  21.         Inherits AspNetMakerPage
  22.         Implements IDisposable        
  23.  
  24.         ' Used by system generated functions
  25.         Private RsWrk As Object, sSqlWrk As String, sWhereWrk As String
  26.  
  27.         Private arwrk As Object
  28.  
  29.         Private armultiwrk() As String        
  30.  
  31.         ' Page URL
  32.         Public ReadOnly Property PageUrl() As String
  33.             Get
  34.                 Dim Url As String = ew_CurrentPage() & "?"
  35.                 If tblMessage.UseTokenInUrl Then Url = Url & "t=" & tblMessage.TableVar & "&" ' Add page token
  36.                 Return Url    
  37.             End Get
  38.         End Property
  39.  
  40.         ' Validate page request
  41.         Public Function IsPageRequest() As Boolean
  42.             Dim Result As Boolean
  43.             If tblMessage.UseTokenInUrl Then
  44.                 Result = False
  45.                 If ObjForm IsNot Nothing Then
  46.                     Result = (tblMessage.TableVar = ObjForm.GetValue("t"))
  47.                 End If
  48.                 If ew_Get("t") <> "" Then
  49.                     Result = (tblMessage.TableVar = ew_Get("t"))
  50.                 End If
  51.                 Return Result
  52.             End If
  53.             Return True            
  54.         End Function    
  55.  
  56.         ' tblMessage
  57.         Public Property tblMessage() As ctblMessage
  58.             Get                
  59.                 Return ParentPage.tblMessage
  60.             End Get
  61.             Set(ByVal v As ctblMessage)
  62.                 ParentPage.tblMessage = v    
  63.             End Set    
  64.         End Property
  65.  
  66.         ' tblMessage
  67.         Public Property tblEmployees() As ctblEmployees
  68.             Get                
  69.                 Return ParentPage.tblEmployees
  70.             End Get
  71.             Set(ByVal v As ctblEmployees)
  72.                 ParentPage.tblEmployees = v    
  73.             End Set    
  74.         End Property
  75.  
  76.         '
  77.         '  Constructor
  78.         '  - init objects
  79.         '  - open connection
  80.         '
  81.         Public Sub New(ByRef APage As AspNetMaker7_tfpssnet)                
  82.             m_ParentPage = APage
  83.             m_Page = Me    
  84.             m_PageID = "list"
  85.             m_PageObjName = "tblMessage_list"
  86.             m_PageObjTypeName = "ctblMessage_list"
  87.  
  88.             ' Table Name
  89.             m_TableName = "tblMessage"
  90.  
  91.             ' Initialize table object
  92.             tblMessage = New ctblMessage(Me)
  93.             tblEmployees = New ctblEmployees(Me)
  94.  
  95.             ' Connect to database
  96.             Conn = New cConnection()
  97.  
  98.             ' Initialize list options
  99.             ListOptions = New cListOptions
  100.         End Sub
  101.  
  102.         '
  103.         '  Subroutine Page_Init
  104.         '  - called before page main
  105.         '  - check Security
  106.         '  - set up response header
  107.         '  - call page load events
  108.         '
  109.         Public Sub Page_Init()
  110.             Security = New cAdvancedSecurity(Me)
  111.             If Not Security.IsLoggedIn() Then Security.AutoLogin()
  112.             If Not Security.IsLoggedIn() Then
  113.                 Security.SaveLastUrl()
  114.                 Page_Terminate("login.aspx")
  115.             End If
  116.  
  117.             ' Table Permission loading event
  118.             Security.TablePermission_Loading()
  119.             Security.LoadCurrentUserLevel(TableName)
  120.  
  121.             ' Table Permission loaded event
  122.             Security.TablePermission_Loaded()
  123.             If Not Security.CanList Then
  124.                 Security.SaveLastUrl()
  125.                 Page_Terminate("login.aspx")
  126.             End If
  127.  
  128.             ' User ID loading event
  129.             Security.UserID_Loading()
  130.             If Security.IsLoggedIn() Then Call Security.LoadUserID()
  131.  
  132.             ' User ID loaded event
  133.             Security.UserID_Loaded()
  134.             tblMessage.Export = ew_Get("export") ' Get export parameter
  135.             ParentPage.gsExport = tblMessage.Export ' Get export parameter, used in header
  136.             ParentPage.gsExportFile = tblMessage.TableVar ' Get export file, used in header
  137.  
  138.             ' Global page loading event (in ewglobal*.vb)
  139.             ParentPage.Page_Loading()
  140.  
  141.             ' Page load event, used in current page
  142.             Page_Load()
  143.         End Sub
  144.  
  145.         '
  146.         '  Class terminate
  147.         '  - clean up page object
  148.         '
  149.         Public Sub Dispose() Implements IDisposable.Dispose
  150.             Page_Terminate("")
  151.         End Sub
  152.  
  153.         '
  154.         '  Sub Page_Terminate
  155.         '  - called when exit page
  156.         '  - clean up connection and objects
  157.         '  - if URL specified, redirect to URL
  158.         '
  159.         Sub Page_Terminate(url As String)
  160.  
  161.             ' Page unload event, used in current page
  162.             Page_Unload()
  163.  
  164.             ' Global page unloaded event (in ewglobal*.vb)
  165.             ParentPage.Page_Unloaded()
  166.  
  167.             ' Close connection
  168.             Conn.Dispose()
  169.             Security = Nothing
  170.             tblMessage.Dispose()
  171.             tblEmployees.Dispose()
  172.             ListOptions = Nothing
  173.  
  174.             ' Go to URL if specified
  175.             If url <> "" Then
  176.                 HttpContext.Current.Response.Clear()
  177.                 HttpContext.Current.Response.Redirect(url)
  178.             End If
  179.         End Sub
  180.  
  181.     Public lDisplayRecs As Integer ' Number of display records
  182.  
  183.     Public lStartRec As Integer, lStopRec As Integer, lTotalRecs As Integer, lRecRange As Integer
  184.  
  185.     Public sSrchWhere As String
  186.  
  187.     Public lRecCnt As Integer
  188.  
  189.     Public lEditRowCnt As Integer
  190.  
  191.     Public lRowCnt As Integer, lRowIndex As Integer
  192.  
  193.     Public lOptionCnt As Integer
  194.  
  195.     Public lRecPerRow As Integer, lColCnt As Integer
  196.  
  197.     Public sDeleteConfirmMsg As String ' Delete confirm message
  198.  
  199.     Public sDbMasterFilter As String, sDbDetailFilter As String
  200.  
  201.     Public bMasterRecordExists As Boolean
  202.  
  203.     Public ListOptions As Object
  204.  
  205.     Public sMultiSelectKey As String
  206.  
  207.     Public x_ewPriv As Integer
  208.  
  209.     '
  210.     ' Page main processing
  211.     '
  212.     Public Sub Page_Main()
  213.         lDisplayRecs = 20
  214.         lRecRange = EW_PAGER_RANGE
  215.         lRecCnt = 0 ' Record count
  216.  
  217.         ' Search filters        
  218.         Dim sSrchAdvanced As String = "" ' Advanced search filter
  219.         Dim sSrchBasic As String = "" ' Basic search filter
  220.         Dim sFilter As String = ""
  221.         sSrchWhere = "" ' Search WHERE clause        
  222.  
  223.         ' Master/Detail
  224.         sDbMasterFilter = "" ' Master filter
  225.         sDbDetailFilter = "" ' Detail filter
  226.         If IsPageRequest Then ' Validate request
  227.  
  228.             ' Set up records per page dynamically
  229.             SetUpDisplayRecs()
  230.  
  231.             ' Handle reset command
  232.             ResetCmd()
  233.  
  234.             ' Get basic search criteria
  235.             If ParentPage.gsSearchError = "" Then
  236.                 sSrchBasic = BasicSearchWhere()
  237.             End If
  238.  
  239.             ' Set Up Sorting Order
  240.             SetUpSortOrder()
  241.         End If
  242.  
  243.         ' Restore display records
  244.         If (tblMessage.RecordsPerPage = -1 OrElse tblMessage.RecordsPerPage > 0) Then
  245.             lDisplayRecs = tblMessage.RecordsPerPage ' Restore from Session
  246.         Else
  247.             lDisplayRecs = 20 ' Load default
  248.         End If
  249.  
  250.         ' Load Sorting Order
  251.         LoadSortOrder()
  252.  
  253.         ' Build search criteria
  254.         If sSrchAdvanced <> "" Then
  255.             If sSrchWhere <> "" Then
  256.                 sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchAdvanced & ")"
  257.             Else
  258.                 sSrchWhere = sSrchAdvanced
  259.             End If
  260.         End If
  261.         If sSrchBasic <> "" Then
  262.             If sSrchWhere <> "" Then
  263.                 sSrchWhere = "(" & sSrchWhere & ") AND (" & sSrchBasic & ")"
  264.             Else
  265.                 sSrchWhere = sSrchBasic
  266.             End If
  267.         End If
  268.  
  269.         ' Recordset Searching event
  270.         tblMessage.Recordset_Searching(sSrchWhere)
  271.  
  272.         ' Save search criteria
  273.         If sSrchWhere <> "" Then
  274.             If sSrchBasic = "" Then ResetBasicSearchParms()
  275.             tblMessage.SearchWhere = sSrchWhere ' Save to Session
  276.             lStartRec = 1 ' Reset start record counter
  277.             tblMessage.StartRecordNumber = lStartRec
  278.         Else
  279.             RestoreSearchParms()
  280.         End If
  281.  
  282.         ' Build filter
  283.         sFilter = ""
  284.         If Not Security.CanList Then
  285.             sFilter = "(0=1)" ' Filter all records
  286.         End If
  287.         If sDbDetailFilter <> "" Then
  288.             If sFilter <> "" Then
  289.                 sFilter = "(" & sFilter & ") AND (" & sDbDetailFilter & ")"
  290.             Else
  291.                 sFilter = sDbDetailFilter
  292.             End If
  293.         End If
  294.         If sSrchWhere <> "" Then
  295.             If sFilter <> "" Then
  296.                 sFilter = "(" & sFilter & ") AND (" & sSrchWhere & ")"
  297.             Else
  298.                 sFilter = sSrchWhere
  299.             End If
  300.         End If
  301.  
  302.         ' Set up filter in Session
  303.         tblMessage.SessionWhere = sFilter
  304.         tblMessage.CurrentFilter = ""
  305.     End Sub
  306.  
  307.     '
  308.     ' Set up number of records displayed per page
  309.     '
  310.     Sub SetUpDisplayRecs()
  311.         Dim sWrk As String
  312.         sWrk = ew_Get(EW_TABLE_REC_PER_PAGE)
  313.         If sWrk <> "" Then
  314.             If IsNumeric(sWrk) Then
  315.                 lDisplayRecs = ew_ConvertToInt(sWrk)
  316.             Else
  317.                 If ew_SameText(sWrk, "all") Then ' Display all records
  318.                     lDisplayRecs = -1
  319.                 Else
  320.                     lDisplayRecs = 20 ' Non-numeric, load default
  321.                 End If
  322.             End If
  323.             tblMessage.RecordsPerPage = lDisplayRecs ' Save to Session
  324.  
  325.             ' Reset start position
  326.             lStartRec = 1
  327.             tblMessage.StartRecordNumber = lStartRec
  328.         End If
  329.     End Sub
  330.  
  331.     '
  332.     ' Return Basic Search SQL
  333.     '
  334.     Function BasicSearchSQL(Keyword As String) As String
  335.         Dim sKeyword As String, sSql As String = ""
  336.         sKeyword = ew_AdjustSql(Keyword)        
  337.         sSql = sSql & "[msgText] LIKE '%" & sKeyword & "%' OR "
  338.         If sSql.EndsWith(" OR ") Then sSql = sSql.SubString(0, sSql.Length-4)
  339.         Return sSql
  340.     End Function
  341.  
  342.     '
  343.     ' Return Basic Search WHERE based on search keyword and type
  344.     '
  345.     Function BasicSearchWhere() As String
  346.         Dim sSearchStr As String = "", sSearchKeyword As String, sSearchType As String
  347.         Dim sSearch As String, arKeyword() As String, sKeyword As String
  348.         If Not Security.CanSearch Then Return ""
  349.         sSearchKeyword = ew_Get(EW_TABLE_BASIC_SEARCH)
  350.         sSearchType = ew_Get(EW_TABLE_BASIC_SEARCH_TYPE)
  351.         If sSearchKeyword <> "" Then
  352.             sSearch = sSearchKeyword.Trim()
  353.             If sSearchType <> "" Then
  354.                 While InStr(sSearch, "  ") > 0
  355.                     sSearch = sSearch.Replace("  ", " ")
  356.                 End While
  357.                 arKeyword = sSearch.Trim().Split(New Char() {" "c})
  358.                 For Each sKeyword In arKeyword
  359.                     If sSearchStr <> "" Then sSearchStr = sSearchStr & " " & sSearchType & " "
  360.                     sSearchStr = sSearchStr & "(" & BasicSearchSQL(sKeyword) & ")"
  361.                 Next
  362.             Else
  363.                 sSearchStr = BasicSearchSQL(sSearch)
  364.             End If
  365.         End If
  366.         If sSearchKeyword <> "" then
  367.             tblMessage.BasicSearchKeyword = sSearchKeyword
  368.             tblMessage.BasicSearchType = sSearchType
  369.         End If
  370.         Return sSearchStr
  371.     End Function
  372.  
  373.     '
  374.     ' Clear all search parameters
  375.     '
  376.     Sub ResetSearchParms()
  377.  
  378.         ' Clear search where
  379.         sSrchWhere = ""
  380.         tblMessage.SearchWhere = sSrchWhere
  381.  
  382.         ' Clear basic search parameters
  383.         ResetBasicSearchParms()
  384.     End Sub
  385.  
  386.     '
  387.     ' Clear all basic search parameters
  388.     '
  389.     Sub ResetBasicSearchParms()
  390.  
  391.         ' Clear basic search parameters
  392.         tblMessage.BasicSearchKeyword = ""
  393.         tblMessage.BasicSearchType = ""
  394.     End Sub
  395.  
  396.     '
  397.     ' Restore all search parameters
  398.     '
  399.     Sub RestoreSearchParms()
  400.         sSrchWhere = tblMessage.SearchWhere
  401.     End Sub
  402.  
  403.     '
  404.     ' Set up Sort parameters based on Sort Links clicked
  405.     '
  406.     Sub SetUpSortOrder()
  407.         Dim sOrderBy As String
  408.         Dim sSortField As String, sLastSort As String, sThisSort As String
  409.         Dim bCtrl As Boolean
  410.  
  411.         ' Check for Ctrl pressed
  412.         bCtrl = (ew_Get("ctrl") <> "")
  413.  
  414.         ' Check for an Order parameter
  415.         If ew_Get("order") <> "" Then
  416.             tblMessage.CurrentOrder = ew_Get("order")
  417.             tblMessage.CurrentOrderType = ew_Get("ordertype")
  418.             tblMessage.UpdateSort(tblMessage.msgText, bCtrl) ' msgText
  419.             tblMessage.UpdateSort(tblMessage.msgStartDate, bCtrl) ' msgStartDate
  420.             tblMessage.UpdateSort(tblMessage.msgEndDate, bCtrl) ' msgEndDate
  421.             tblMessage.StartRecordNumber = 1 ' Reset start position
  422.         End If
  423.     End Sub
  424.  
  425.     '
  426.     ' Load Sort Order parameters
  427.     '
  428.     Sub LoadSortOrder()
  429.         Dim sOrderBy As String
  430.         sOrderBy = tblMessage.SessionOrderBy ' Get order by from Session
  431.         If sOrderBy = "" Then
  432.             If tblMessage.SqlOrderBy <> "" Then
  433.                 sOrderBy = tblMessage.SqlOrderBy
  434.                 tblMessage.SessionOrderBy = sOrderBy
  435.             End If
  436.         End If
  437.     End Sub
  438.  
  439.     '
  440.     ' Reset command based on querystring parameter "cmd"
  441.     ' - reset: reset search parameters
  442.     ' - resetall: reset search and master/detail parameters
  443.     ' - resetsort: reset sort parameters
  444.     '
  445.     Sub ResetCmd()
  446.         Dim sCmd As String
  447.  
  448.         ' Get reset cmd
  449.         If ew_Get("cmd") <> "" Then
  450.             sCmd = ew_Get("cmd")
  451.  
  452.             ' Reset search criteria
  453.             If ew_SameText(sCmd, "reset") OrElse ew_SameText(sCmd, "resetall") Then
  454.                 ResetSearchParms()
  455.             End If
  456.  
  457.             ' Reset sort criteria
  458.             If ew_SameText(sCmd, "resetsort") Then
  459.                 Dim sOrderBy As String = ""
  460.                 tblMessage.SessionOrderBy = sOrderBy
  461.                 tblMessage.msgText.Sort = ""
  462.                 tblMessage.msgStartDate.Sort = ""
  463.                 tblMessage.msgEndDate.Sort = ""
  464.             End If
  465.  
  466.             ' Reset start position
  467.             lStartRec = 1
  468.             tblMessage.StartRecordNumber = lStartRec
  469.         End If
  470.     End Sub
  471.  
  472.     Public Pager As Object
  473.  
  474.     '
  475.     ' Set up Starting Record parameters
  476.     '
  477.     Sub SetUpStartRec()
  478.         Dim nPageNo As Integer
  479.  
  480.         ' Exit if lDisplayRecs = 0
  481.         If lDisplayRecs = 0 Then Exit Sub
  482.         If IsPageRequest Then ' Validate request
  483.  
  484.             ' Check for a "start" parameter
  485.             If ew_Get(EW_TABLE_START_REC) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_START_REC)) Then
  486.                 lStartRec = ew_ConvertToInt(ew_Get(EW_TABLE_START_REC))
  487.                 tblMessage.StartRecordNumber = lStartRec
  488.             ElseIf ew_Get(EW_TABLE_PAGE_NO) <> "" AndAlso IsNumeric(ew_Get(EW_TABLE_PAGE_NO)) Then
  489.                 nPageNo = ew_ConvertToInt(ew_Get(EW_TABLE_PAGE_NO))
  490.                 lStartRec = (nPageNo-1)*lDisplayRecs+1
  491.                 If lStartRec <= 0 Then
  492.                     lStartRec = 1
  493.                 ElseIf lStartRec >= ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 Then
  494.                     lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1
  495.                 End If
  496.                 tblMessage.StartRecordNumber = lStartRec
  497.             End If
  498.         End If
  499.         lStartRec = tblMessage.StartRecordNumber
  500.  
  501.         ' Check if correct start record counter
  502.         If lStartRec <= 0 Then ' Avoid invalid start record counter
  503.             lStartRec = 1 ' Reset start record counter
  504.             tblMessage.StartRecordNumber = lStartRec
  505.         ElseIf lStartRec > lTotalRecs Then ' Avoid starting record > total records
  506.             lStartRec = ((lTotalRecs-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to last page first record
  507.             tblMessage.StartRecordNumber = lStartRec
  508.         ElseIf (lStartRec-1) Mod lDisplayRecs <> 0 Then
  509.             lStartRec = ((lStartRec-1)\lDisplayRecs)*lDisplayRecs+1 ' Point to page boundary
  510.             tblMessage.StartRecordNumber = lStartRec
  511.         End If
  512.     End Sub
  513.  
  514.     '
  515.     ' Load default values
  516.     '
  517.     Sub LoadDefaultValues()
  518.     End Sub
  519.  
  520.     '
  521.     ' Load recordset
  522.     '
  523.     Function LoadRecordset() As OleDbDataReader
  524.  
  525.         ' Recordset Selecting event
  526.         tblMessage.Recordset_Selecting(tblMessage.CurrentFilter)
  527.  
  528.         ' Load list page SQL
  529.         Dim sSql As String = tblMessage.ListSQL
  530.  
  531.         ' Write SQL for debug
  532.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  533.  
  534.         ' Count
  535.         lTotalRecs = -1        
  536.         Try            
  537.             If sSql.StartsWith("SELECT * FROM ", StringComparison.InvariantCultureIgnoreCase) AndAlso _                
  538.                 ew_Empty(tblMessage.SqlGroupBy) AndAlso _
  539.                 ew_Empty(tblMessage.SqlHaving) Then
  540.                 Dim sCntSql As String = tblMessage.SelectCountSQL
  541.  
  542.                 ' Write SQL for debug
  543.                 If EW_DEBUG_ENABLED Then ew_Write("<br>" & sCntSql)
  544.                 lTotalRecs = Conn.ExecuteScalar(sCntSql)
  545.             End If            
  546.         Catch
  547.         End Try
  548.  
  549.         ' Load recordset
  550.         Dim Rs As OleDbDataReader = Conn.GetDataReader(sSql)
  551.         If lTotalRecs < 0 AndAlso Rs.HasRows Then
  552.             lTotalRecs = 0
  553.             While Rs.Read()
  554.                 lTotalRecs = lTotalRecs + 1
  555.             End While
  556.             Rs.Close()        
  557.             Rs = Conn.GetDataReader(sSql)
  558.         End If
  559.  
  560.         ' Recordset Selected event
  561.         tblMessage.Recordset_Selected(Rs)
  562.         Return Rs
  563.     End Function
  564.  
  565.     '
  566.     ' Load row based on key values
  567.     '
  568.     Function LoadRow() As Boolean
  569.         Dim RsRow As OleDbDataReader
  570.         Dim sFilter As String = tblMessage.KeyFilter
  571.  
  572.         ' Row Selecting event
  573.         tblMessage.Row_Selecting(sFilter)
  574.  
  575.         ' Load SQL based on filter
  576.         tblMessage.CurrentFilter = sFilter
  577.         Dim sSql As String = tblMessage.SQL
  578.  
  579.         ' Write SQL for debug
  580.         If EW_DEBUG_ENABLED Then ew_Write(sSql)
  581.         Try
  582.             RsRow = Conn.GetTempDataReader(sSql)    
  583.             If Not RsRow.Read() Then
  584.                 Return False
  585.             Else                
  586.                 LoadRowValues(RsRow) ' Load row values
  587.  
  588.                 ' Row Selected event
  589.                 tblMessage.Row_Selected(RsRow)
  590.                 Return True    
  591.             End If
  592.         Catch
  593.             If EW_DEBUG_ENABLED Then Throw
  594.             Return False
  595.         Finally
  596.             Conn.CloseTempDataReader()
  597.         End Try
  598.     End Function
  599.  
  600.     '
  601.     ' Load row values from recordset
  602.     '
  603.     Sub LoadRowValues(ByRef RsRow As OleDbDataReader)
  604.         tblMessage.msgID.DbValue = RsRow("msgID")
  605.         tblMessage.msgText.DbValue = RsRow("msgText")
  606.         tblMessage.msgStartDate.DbValue = RsRow("msgStartDate")
  607.         tblMessage.msgEndDate.DbValue = RsRow("msgEndDate")
  608.     End Sub
  609.  
  610.     '
  611.     ' Render row values based on field settings
  612.     '
  613.     Sub RenderRow()
  614.  
  615.         ' Row Rendering event
  616.         tblMessage.Row_Rendering()
  617.  
  618.         '
  619.         '  Common render codes for all row types
  620.         '
  621.         ' msgText
  622.  
  623.         tblMessage.msgText.CellCssStyle = ""
  624.         tblMessage.msgText.CellCssClass = ""
  625.  
  626.         ' msgStartDate
  627.         tblMessage.msgStartDate.CellCssStyle = ""
  628.         tblMessage.msgStartDate.CellCssClass = ""
  629.  
  630.         ' msgEndDate
  631.         tblMessage.msgEndDate.CellCssStyle = ""
  632.         tblMessage.msgEndDate.CellCssClass = ""
  633.  
  634.         '
  635.         '  View  Row
  636.         '
  637.  
  638.         If tblMessage.RowType = EW_ROWTYPE_VIEW Then ' View row
  639.  
  640.             ' msgText
  641.             tblMessage.msgText.ViewValue = tblMessage.msgText.CurrentValue
  642.             tblMessage.msgText.CssStyle = ""
  643.             tblMessage.msgText.CssClass = ""
  644.             tblMessage.msgText.ViewCustomAttributes = ""
  645.  
  646.             ' msgStartDate
  647.             tblMessage.msgStartDate.ViewValue = tblMessage.msgStartDate.CurrentValue
  648.             tblMessage.msgStartDate.ViewValue = ew_FormatDateTime(tblMessage.msgStartDate.ViewValue, 6)
  649.             tblMessage.msgStartDate.CssStyle = ""
  650.             tblMessage.msgStartDate.CssClass = ""
  651.             tblMessage.msgStartDate.ViewCustomAttributes = ""
  652.  
  653.             ' msgEndDate
  654.             tblMessage.msgEndDate.ViewValue = tblMessage.msgEndDate.CurrentValue
  655.             tblMessage.msgEndDate.ViewValue = ew_FormatDateTime(tblMessage.msgEndDate.ViewValue, 6)
  656.             tblMessage.msgEndDate.CssStyle = ""
  657.             tblMessage.msgEndDate.CssClass = ""
  658.             tblMessage.msgEndDate.ViewCustomAttributes = ""
  659.  
  660.             ' View refer script
  661.             ' msgText
  662.  
  663.             tblMessage.msgText.HrefValue = ""
  664.  
  665.             ' msgStartDate
  666.             tblMessage.msgStartDate.HrefValue = ""
  667.  
  668.             ' msgEndDate
  669.             tblMessage.msgEndDate.HrefValue = ""
  670.         End If
  671.  
  672.         ' Row Rendered event
  673.         tblMessage.Row_Rendered()
  674.     End Sub
  675.  
  676.         ' Page Load event
  677.         Public Sub Page_Load()
  678.  
  679.             'HttpContext.Current.Response.Write("Page Load")
  680.         End Sub
  681.  
  682.         ' Page Unload event
  683.         Public Sub Page_Unload()
  684.  
  685.             'HttpContext.Current.Response.Write("Page Unload")
  686.         End Sub
  687.  
  688.     ' Form Custom Validate event
  689.     Public Function Form_CustomValidate(ByRef CustomError As String) As Boolean
  690.  
  691.         'Return error message in CustomError
  692.         Return True
  693.     End Function
  694.     End Class
  695.  
  696.     '
  697.     ' ASP.NET Page_Load event
  698.     '
  699.  
  700.     Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  701.         Response.Buffer = EW_RESPONSE_BUFFER
  702.         Response.Cache.SetCacheability(HttpCacheability.NoCache)
  703.  
  704.         ' Page init
  705.         tblMessage_list = New ctblMessage_list(Me)        
  706.         tblMessage_list.Page_Init()
  707.  
  708.         ' Page main processing
  709.         tblMessage_list.Page_Main()
  710.     End Sub
  711.  
  712.     '
  713.     ' ASP.NET Page_Unload event
  714.     '
  715.  
  716.     Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
  717.  
  718.         ' Dispose page object
  719.         If tblMessage_list IsNot Nothing Then tblMessage_list.Dispose()
  720.     End Sub
  721. End Class
  722.