Thursday, March 29, 2012

Seperate c# script in a DLL file

Hi,

Can I seperate the following script block in a sperate DLL file instead of
embedded in aspx/ascx?

I know codebehind/src attribute can do it, but I found that it can't trigger
"Page_Load" event if I seperate and compile the code into DLL file

<script runat="server">
Sub Page_Load( )
'NB1.CreateBlankFile( )
End Sub
</script
Sample Code:
<%@dotnet.itags.org. Page Language="vb" %>
<%@dotnet.itags.org. Register TagPrefix="aspnetian" Namespace="aspnetian"
Assembly="NavBar" %>
<html>
<head>
<script runat="server">
Sub Page_Load( )
'NB1.CreateBlankFile( )
End Sub
</script>
</head>
<body>
<table border="1" width="100%" cellpadding="20" cellspacing="0">
<tr>
<td align="center" width="150">
<img src="http://pics.10026.com/?src=aspnetian.jpg"/>
</td>
<td align="center">
<h1>NavBar Control Client Page<h1>
</td>
</tr>
<tr>
<td width="150">
<form runat="server">
<aspnetian:NavBar id="NB1"
showdividers="False" runat="server">
<strong>Navigation Bar</strong>
<br/>
</aspnetian:NavBar>
</form>
</td>
<td>
This is where page content might be placed
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
</td>
</tr>
</table>
</body>
</htmlFirst of all your script is a vb rather thean c# one.

Secondly, you need Inherits attribute.

Eliyahu

"RC" <rc@.gmail.com> wrote in message
news:u72Il9dWFHA.1040@.TK2MSFTNGP10.phx.gbl...
> Hi,
> Can I seperate the following script block in a sperate DLL file instead of
> embedded in aspx/ascx?
> I know codebehind/src attribute can do it, but I found that it can't
trigger
> "Page_Load" event if I seperate and compile the code into DLL file
> <script runat="server">
> Sub Page_Load( )
> 'NB1.CreateBlankFile( )
> End Sub
> </script>
> Sample Code:
> <%@. Page Language="vb" %>
> <%@. Register TagPrefix="aspnetian" Namespace="aspnetian"
> Assembly="NavBar" %>
> <html>
> <head>
> <script runat="server">
> Sub Page_Load( )
> 'NB1.CreateBlankFile( )
> End Sub
> </script>
> </head>
> <body>
> <table border="1" width="100%" cellpadding="20" cellspacing="0">
> <tr>
> <td align="center" width="150">
> <img src="http://pics.10026.com/?src=aspnetian.jpg"/>
> </td>
> <td align="center">
> <h1>NavBar Control Client Page<h1>
> </td>
> </tr>
> <tr>
> <td width="150">
> <form runat="server">
> <aspnetian:NavBar id="NB1"
> showdividers="False" runat="server">
> <strong>Navigation Bar</strong>
> <br/>
> </aspnetian:NavBar>
> </form>
> </td>
> <td>
> This is where page content might be placed
> <br/><br/><br/><br/><br/><br/><br/><br/><br/>
> </td>
> </tr>
> </table>
> </body>
> </html>

0 comments:

Post a Comment