Thursday, March 29, 2012
Seperate c# script in a DLL file
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>
</html>First 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>
>
Seperate c# script in a DLL file
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>
Saturday, March 24, 2012
serialize to SQL Server Blob instead of XML serialize
some computers the files do not get created on the web server's hard drive
and it's been driving me nuts trying to figure it out.
I store navigation history and application state in object collections and
save this upon application exit by doing an XML.Serialize.
I'd like to serialize directly to SQL Server instead. Can I create a stream
object to be used by SQL Server with serialization?
ThanksYeah, this is the basics (DT is just an object I'm taking from session and
serializing):
Dim ms As New MemoryStream
ms = SerializeDT(CType(Session("DT"), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters("@.DesktopData").Value = da
SqlConnection1.Open()
cmd.ExecuteNonQuery()
SqlConnection1.Close()
Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(ms, DTSource)
ms.Position = 0
Return ms
End Function
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c96ar3sr73f4@.corp.supernews.com...
> I've been experiencing problems on some computers with XML Serialization.
On
> some computers the files do not get created on the web server's hard drive
> and it's been driving me nuts trying to figure it out.
> I store navigation history and application state in object collections and
> save this upon application exit by doing an XML.Serialize.
> I'd like to serialize directly to SQL Server instead. Can I create a
stream
> object to be used by SQL Server with serialization?
> Thanks
>
thanks John.
I've never used binary objects in SQL before.
Where exactly is your data "@.DesktopData" stored in the database? Do you
have a field already defined?
Cheers,
Gord
"John Oakes" <john@.nospam.networkproductions.net> wrote in message
news:OwaYP%23KTEHA.1416@.TK2MSFTNGP12.phx.gbl...
Yeah, this is the basics (DT is just an object I'm taking from session and
serializing):
Dim ms As New MemoryStream
ms = SerializeDT(CType(Session("DT"), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters("@.DesktopData").Value = da
SqlConnection1.Open()
cmd.ExecuteNonQuery()
SqlConnection1.Close()
Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(ms, DTSource)
ms.Position = 0
Return ms
End Function
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c96ar3sr73f4@.corp.supernews.com...
> I've been experiencing problems on some computers with XML Serialization.
On
> some computers the files do not get created on the web server's hard drive
> and it's been driving me nuts trying to figure it out.
> I store navigation history and application state in object collections and
> save this upon application exit by doing an XML.Serialize.
> I'd like to serialize directly to SQL Server instead. Can I create a
stream
> object to be used by SQL Server with serialization?
> Thanks
>
Yes, I have a field defined. The datatype is image, which is
variable-length binary data from 0 through 231-1 (2,147,483,647) bytes.
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c9fasr23jm702@.corp.supernews.com...
> thanks John.
> I've never used binary objects in SQL before.
> Where exactly is your data "@.DesktopData" stored in the database? Do you
> have a field already defined?
> Cheers,
> Gord
> "John Oakes" <john@.nospam.networkproductions.net> wrote in message
> news:OwaYP%23KTEHA.1416@.TK2MSFTNGP12.phx.gbl...
> Yeah, this is the basics (DT is just an object I'm taking from session and
> serializing):
> Dim ms As New MemoryStream
> ms = SerializeDT(CType(Session("DT"), DTProcess))
> Dim da() As Byte
> da = ms.ToArray
> cmd.Parameters("@.DesktopData").Value = da
> SqlConnection1.Open()
> cmd.ExecuteNonQuery()
> SqlConnection1.Close()
> Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
> MemoryStream
> Dim ms As New MemoryStream
> Dim formatter As New BinaryFormatter
> formatter.Serialize(ms, DTSource)
> ms.Position = 0
> Return ms
> End Function
> -John Oakes
>
> "Gordz" <joeblow@.aol.com> wrote in message
> news:10c96ar3sr73f4@.corp.supernews.com...
Serialization.
> On
drive
and
> stream
>
>
serialize to SQL Server Blob instead of XML serialize
some computers the files do not get created on the web server's hard drive
and it's been driving me nuts trying to figure it out.
I store navigation history and application state in object collections and
save this upon application exit by doing an XML.Serialize.
I'd like to serialize directly to SQL Server instead. Can I create a stream
object to be used by SQL Server with serialization?
ThanksYeah, this is the basics (DT is just an object I'm taking from session and
serializing):
Dim ms As New MemoryStream
ms = SerializeDT(CType(Session("DT"), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters("@.DesktopData").Value = da
SqlConnection1.Open()
cmd.ExecuteNonQuery()
SqlConnection1.Close()
Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(ms, DTSource)
ms.Position = 0
Return ms
End Function
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c96ar3sr73f4@.corp.supernews.com...
> I've been experiencing problems on some computers with XML Serialization.
On
> some computers the files do not get created on the web server's hard drive
> and it's been driving me nuts trying to figure it out.
> I store navigation history and application state in object collections and
> save this upon application exit by doing an XML.Serialize.
> I'd like to serialize directly to SQL Server instead. Can I create a
stream
> object to be used by SQL Server with serialization?
> Thanks
thanks John.
I've never used binary objects in SQL before.
Where exactly is your data "@.DesktopData" stored in the database? Do you
have a field already defined?
Cheers,
Gord
"John Oakes" <john@.nospam.networkproductions.net> wrote in message
news:OwaYP%23KTEHA.1416@.TK2MSFTNGP12.phx.gbl...
Yeah, this is the basics (DT is just an object I'm taking from session and
serializing):
Dim ms As New MemoryStream
ms = SerializeDT(CType(Session("DT"), DTProcess))
Dim da() As Byte
da = ms.ToArray
cmd.Parameters("@.DesktopData").Value = da
SqlConnection1.Open()
cmd.ExecuteNonQuery()
SqlConnection1.Close()
Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
MemoryStream
Dim ms As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(ms, DTSource)
ms.Position = 0
Return ms
End Function
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c96ar3sr73f4@.corp.supernews.com...
> I've been experiencing problems on some computers with XML Serialization.
On
> some computers the files do not get created on the web server's hard drive
> and it's been driving me nuts trying to figure it out.
> I store navigation history and application state in object collections and
> save this upon application exit by doing an XML.Serialize.
> I'd like to serialize directly to SQL Server instead. Can I create a
stream
> object to be used by SQL Server with serialization?
> Thanks
Yes, I have a field defined. The datatype is image, which is
variable-length binary data from 0 through 231-1 (2,147,483,647) bytes.
-John Oakes
"Gordz" <joeblow@.aol.com> wrote in message
news:10c9fasr23jm702@.corp.supernews.com...
> thanks John.
> I've never used binary objects in SQL before.
> Where exactly is your data "@.DesktopData" stored in the database? Do you
> have a field already defined?
> Cheers,
> Gord
> "John Oakes" <john@.nospam.networkproductions.net> wrote in message
> news:OwaYP%23KTEHA.1416@.TK2MSFTNGP12.phx.gbl...
> Yeah, this is the basics (DT is just an object I'm taking from session and
> serializing):
> Dim ms As New MemoryStream
> ms = SerializeDT(CType(Session("DT"), DTProcess))
> Dim da() As Byte
> da = ms.ToArray
> cmd.Parameters("@.DesktopData").Value = da
> SqlConnection1.Open()
> cmd.ExecuteNonQuery()
> SqlConnection1.Close()
> Public Shared Function SerializeDT(ByVal DTSource As DTProcess) As
> MemoryStream
> Dim ms As New MemoryStream
> Dim formatter As New BinaryFormatter
> formatter.Serialize(ms, DTSource)
> ms.Position = 0
> Return ms
> End Function
> -John Oakes
>
> "Gordz" <joeblow@.aol.com> wrote in message
> news:10c96ar3sr73f4@.corp.supernews.com...
> > I've been experiencing problems on some computers with XML
Serialization.
> On
> > some computers the files do not get created on the web server's hard
drive
> > and it's been driving me nuts trying to figure it out.
> > I store navigation history and application state in object collections
and
> > save this upon application exit by doing an XML.Serialize.
> > I'd like to serialize directly to SQL Server instead. Can I create a
> stream
> > object to be used by SQL Server with serialization?
> > Thanks