| |

VerySource

 Forgot password?
 Register
Search
View: 612|Reply: 3

Can a page made with a master page use the page_load event?

[Copy link]

4

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

Post time: 2020-2-18 10:30:01
| Show all posts |Read mode
Can a page made with a master page use the page_load event?
My code:

<asp: Content ID = "Content1" ContentPlaceHolderID = "ContentPlaceHolder1" Runat = "Server">


  <script Runat = "Server">
      Dim theTitle As String
      Dim theContent As String
      Dim theAuthor As String
      Dim theCopyFrom As String
      Dim theAddTime As String
      Sub page_load (ByVal Sender As Object, ByVal E As EventArgs)
          

          Dim Cnn As SqlConnection
          Dim Cmd As SqlCommand
          Dim DataR As SqlDataReader
          Dim StrCnn As String
         
          Dim codestr As String = Request.QueryString ("id")
          Dim sql As String
          If Trim (codestr) <> "" Then
              StrCnn = "server = localhost; uid = as; pwd =; database = myweb"
              Cnn = New SqlConnection (StrCnn)
              Cnn.Open ()
              sql = "select * from book_info where id ="&Trim (codestr)
              Cmd = New SqlCommand (sql, Cnn)
              DataR = Cmd.ExecuteReader
              If DataR.Read () Then
                  theTitle = DataR ("title")
                  theContent = DataR ("content")
                  theAuthor = DataR ("author")
                  theCopyFrom = DataR ("copyfrom")
                  theAddTime = DataR ("addtime")
              Else
                  Cnn.Close ()
                  Response.Write ("<font color = 'gray'> Please select an article! </ Font>")
                  Response.End ()
              End If
              Cnn.Close ()
          End If
      End Sub
</ script>
  <table width = "780" border = "0" cellspacing = "0" cellpadding = "0">
  <tr>
    <td style = "width: 205px; background: url (images / 0_14.gif)" valign = "top">
    <asp: TreeView ID = "treeview1" runat = "server" Font-Size = "10pt" BorderStyle = "None" ForeColor = "White" NodeWrap = "True" ImageSet = "XPFileExplorer" NodeIndent = "15">
        <ParentNodeStyle Font-Bold = "False" />
        <HoverNodeStyle Font-Underline = "True" ForeColor = "# 6666AA" />
        <SelectedNodeStyle BackColor = "# B5B5B5" Font-Underline = "False" HorizontalPadding = "0px"
            VerticalPadding = "0px" />
        <NodeStyle Font-Names = "Tahoma" Font-Size = "8pt" ForeColor = "Black" HorizontalPadding = "2px"
            NodeSpacing = "0px" VerticalPadding = "2px" />
    </ asp: TreeView>
    </ td>
    <td style = "width: 575px; background: url (images / 0_15.gif)">
    <table border = "0" cellspacing = "0" cellpadding = "0" style = "height: 462px" align = "center" valign = "top">
    <tr>
    <td style = "height: 10px; width: 43px">
    </ td>
    </ tr>
    <tr>
    <td style = "padding-top: 5px; padding-left: 5px; padding-right: 5px; width: 43px;">
                     <p align = "center"> <font style = "font-family: black body; font-size: 18px"> <strong> <% = thetitle%> </ strong> </ font> <br />
                     <font style = "font-size: 12px"> <% = theaddtime%>&nbsp;&nbsp;&nbsp;&nbsp; <% = thecopyfrom%> </ font>
                     </ p>
                     <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <% = HTMLcode (theContent)%>
                     
                     </ p>
                     
</ td>
    </ tr>
    </ table>
    </ td>
    </ tr>
    </ table>


</ asp: Content>

I cannot set a breakpoint in the pageload. Why? How to solve it?
Reply

Use magic Report

4

Threads

11

Posts

11.00

Credits

Newbie

Rank: 1

Credits
11.00

 China

 Author| Post time: 2020-5-7 00:30:01
| Show all posts
Under yourself
Reply

Use magic Report

0

Threads

58

Posts

32.00

Credits

Newbie

Rank: 1

Credits
32.00

 China

Post time: 2020-5-7 13:45:01
| Show all posts
You have not registered the page_load event
Reply

Use magic Report

1

Threads

9

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-5-17 15:30:01
| Show all posts
Of course! ~! ~! ~!
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list