(由于长度限制,删除了部分代码)
'-----------------------------------------------------------------------------------------------------------------
'页面初始代码
'-----------------------------------------------------------------------------------------------------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
SqlConnection1.Open()
receivedeptid = Convert.ToString("dsgd1111ads")
userid = Convert.ToDouble("af00000sra")
username = Convert.ToString("1111").Trim
'--------------------------------------------------------------------------------
ddl_year.Items.Add(Convert.ToString(Today().Year - 2))
ddl_year.Items.Add(Convert.ToString(Today().Year - 1))
ddl_year.Items.Add(Convert.ToString(Today().Year))
ddl_year.Items.Add(Convert.ToString(Today().Year + 1))
ddl_year.SelectedIndex = -1
ddl_year.Items.FindByValue(Convert.ToString(Today().Year)).Selected = True
BINDGRID()
Btn_reg.Enabled = False
BindTree()
Else
Response.Write("<script language=javascript>function init(){document.Form1.page_pos.value = " + Request("page_pos") + "; window.scrollBy(0,document.Form1.page_pos.value); }window.onload=init;</script>")
End If
End Sub
'---------------------------------------------------------------------
'绑定公文表
'---------------------------------------------------------------------
Private Function BINDGRID()
receivedeptid = Convert.ToString("00550000")
Dim tpCnt As Integer
With New DocumentSystem()
tmpDPR = .getDocuArchiveInfo(receivedeptid, Convert.ToString(ddl_year.SelectedItem.Value), "WAIT")
End With
If tmpDPR.Tables(0).Rows.Count > 0 Then
'Btn_reg.Enabled = True
L_tips.Text = ""
tpCnt = tmpDPR.Tables(0).Rows.Count \ DG_DPR.PageSize
If tmpDPR.Tables(0).Rows.Count Mod DG_DPR.PageSize > 0 Then
tpCnt = tpCnt + 1
End If
If tpCnt < DG_DPR.PageCount Then
If DG_DPR.CurrentPageIndex > tpCnt - 1 Then
DG_DPR.CurrentPageIndex = tpCnt - 1
End If
End If
Else
Btn_reg.Enabled = False
L_tips.Visible = True
L_tips.Text = "现在没有要归档得公文!"
End If
DG_DPR.DataSource = tmpDPR
DG_DPR.DataBind()
If tmpDPR.Tables(DocuPublishRegData.DocuPublishReg_TABLE).Rows.Count = 0 Then
L_pagecount.Text = "共0页!"
IB_first.Visible = False
IB_PRE.Visible = False
IB_NEXT.Visible = False
IB_last.Visible = False
Label5.Visible = False
TB_pageno.Visible = False
Label7.Visible = False
IB_first.Enabled = False
IB_PRE.Enabled = False
IB_NEXT.Enabled = False
IB_last.Enabled = False
Else
IB_first.Visible = True
IB_PRE.Visible = True
IB_NEXT.Visible = True
IB_last.Visible = True