-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: Sitaraman
Message 10 in Discussion

Hi Naveen Thought  i will explain the need to do all the steps i mentioned before.  
Basically the points i had suggested were   You need to make it as a web application : 
The Reason for this is simple, As u know, every aspx is converted into a temporary vb 
file, compiled and executed right( u will typically find it in 
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET 
Files\gactest\...\...\(assuming default implementation). Now when a type is loaded at 
runtime,   
            Where is it searched?  It is searched in the assemblies that are 
referenced .  
            How are the assemblies referenced? thru the machine.config and web.config. 
 
            Now If your app is a simple virual dir and not a web app, then the 
web.config settings will never be picked up.  So web.config is 
            not picked up, therefore, the assemblies are not referenced, and therefore 
the type cannot be loaded...
        Inherit the ASPX from the CodeBehind : To explain this, lemme take a snippet 
from the Temporary VB File(compiled from the ASPX File as mentioned above )
 Private Function __BuildControlbtngetname() As System.Web.UI.Control
            Dim __ctrl As System.Web.UI.WebControls.Button
            
            #ExternalSource("c:\inetpub\wwwroot\gactest\gactest.aspx",12)
            __ctrl = New System.Web.UI.WebControls.Button
            
            #End ExternalSource
            Me.btngetname = __ctrl
            
            #ExternalSource("c:\inetpub\wwwroot\gactest\gactest.aspx",12)
            __ctrl.ID = "btngetname"
            
            #End ExternalSource
            
            #ExternalSource("c:\inetpub\wwwroot\gactest\gactest.aspx",12)
            __ctrl.Text = "GETNAME"
            
            #End ExternalSource
            
            #ExternalSource("c:\inetpub\wwwroot\gactest\gactest.aspx",12)
            AddHandler __ctrl.Click, AddressOf Me.getname
            
            #End ExternalSource
            Return __ctrl
        End Function
Here notice that when you trap a event for the button(or any other item), a handler is 
added(Code maeked in Red above),  and also note that the function passed to the 
AddHandler is Me.FnName(in our case Me.getname).  Here the Term Me. is significant. 
This means that the event handler  function(getname) has to be 
        either written inside the aspx within the runat server tag or 
        has to be written in a codebehind, which inturn should be inherited by the 
aspx page.
 In senthil's case the function handler is written inside the CodeBehind, So we need 
to inherit the gactest.vb class.
        Create Event Handlers in the Code Behind with the Correct Signatures in the 
Code behind and declare the buttons with WithEvents:  The same reason as it is 
mentioned in point 2.  Once you have inherited from the codebehind, at run time it is 
is going to delegate the call to the getname function.  Now such functions have to 
follow the signature "Private Sub AnyFunctionName(ByVal sender As System.Object, ByVal 
e As System.EventArgs) Handles Object.Event".   In my view, the best way to understand 
all this is to open the C:\WINNT\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET 
Files\gactest\...\...\ and go thru the vb files(which are compiled from the aspx) and 
this was something that i used to do even in <yuck>JSP</yuck> also   btw Senthil- did 
the soln work on ur system?
regards, sr

-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to