|
用母版页做的网页能用page_load事件嘛?
我的代码:
<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'>请选择文章!</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:黑体;font-size:18px"><strong><%=thetitle %></strong></font><br />
<font style="font-size:12px"><%=theaddtime%> <%=thecopyfrom%></font>
</p>
<p> <%=HTMLcode(theContent)%>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:Content>
我在pageload中设断点都执行不到,为什么?怎么解决呢? |
|