.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

page_ init

Posted By:      Posted Date: September 21, 2010    Points: 0   Category :ASP.Net

 protected override void OnInit(EventArgs e)
        // lstNummer= new ListBox 
        string lstNummer= Request.Params.Get("lstNummer");
       if (lstNummer.Length ==  0)

View Complete Post

More Related Resource Links

Does SQL Server have to load and init statics every time a SQL/CLR managed proc is invoked?

We are working with SQL/CLR stored procedures, triggers etc and it seems that all assemblies we use are unloaded/loaded every time a proc or trigger or TVF is called. Is this true? Is there any way to retain data between invocations of procs? for example can I create some static struct or object that I can setup once and then just refer to after that, so that unless we terminate SQL server, the static data is always in memory? Thanks PS: This was originally posted here, but that forum seems to be rarely frequented.  

page init event

In the book pro asp.net it mentions:"In addition, if the page is not being requested for the firsttime (in other words, if it's a postback), ASP.NET deserializes the view state information and appliesit to all the controls.At this stage, the Page.Init event fires. However, this event is rarely handled by the web page,because it's still too early to perform page initialization. That's because the control objects may notbe created yet and because the view state information isn't loaded.""ASP.NET deserializes the view state information and applies it to all the controls."and "That's because the control objects may not be created yet and because the view state information isn't loaded."seems contradictory as if the view state is not loaded how come it is applied to the control?

Can not init SPSite for claims based authenticated site

Hi, trying to write a simple console application i was not able to init a claims based authenticated site with API nor with the Managed Client OM. Opening a site with only windows authentication is working. Running on a Windows Server 2008 R2 and SP 2010 server and logged in as the buildin Administrator account. Administrator is Site Collection Admin. static void Main(string[] args) {     ClientContext context = new ClientContext("http://mypc:300");     Web web = context.Web;     context.Load(web);     context.ExecuteQuery();     ... } throws "The remote server returned an error: (403) Forbidden.". Setting credentials for the context is also not working. or same problem with     static void Main(string[] args) {     using (SPSite spSite = new SPSite("http://mypc:300"))     {         ... throwing FileNotFound-Error. Any idea? Greetings Peter  

Setting a Property that causes update on a UpadatePanel on Init stage.

Hi, I have a custom control with a UpdatePanel inside. Depending of user action or page programing I call Update method of my UpdatePanel to refresh html portion to user.For example, I created a property called Title. If the Title change i call Update of my UpdatePanel.public string Title { get { return labelTitle.Text; } set { if (labelTitle.Text != value) { labelTitle.Text = value; panelUpdate.Update(); // Refresh the entire control } } }   But if the Title property is configured on aspx file, my UpdatePanel is always refreshed because my Title property is setted on Init stage of page life cycle.I need to know if this property is setted on init stage or if ViewState is restored to avoid call Update, or any tips to avoid refresh my control everytime. Thanks,Tales Aguiar.

Creating dynamic web controls outside Init method



I am creating a dynamic <asp:Table> based on a user's selection from a DropDownList. The number of columns and rows in the table depends on the user's choice from the DropDown.

The final two columns in each row needs to contain an Edit and Delete button. I am able to create these buttons programmatically. However, I am unable to get the click event to fire.

After researching this, it appears to be the case that my dynamic Web controls need to be created in the page Init method.

However, I am unable to do this as I do not know how many table rows, columns and buttons to create, until after the user has made a selection from a DropdownList.

I would be be very grateful for some tips on the correct way to create and enable the events for my dynamic buttons, in this scenario.

Here is a brief outline of how the program currently works (this is just a brief outline I quickly sketched, small details may be wrong!):


<asp:DropDownList ID="ddlMyDropDown" runat="server" 
                onselectedindexchanged="ddlMyDropDown_SelectedIndexChanged" AutoPostBack="true"></asp:DropDownList>

<asp:Table ID="tblMyTable" runat="server" /> 

Pre-init problem on web server




I wrote a code file that overrides the pre-init event of all Web pages (to switch materpages). This works great in my development environment. But when I publish my pages to a web server (2008 R2) the code is not called anymore.

Please see my general code below (I did delete the actual code, since its irellevant because the procedure is not called at all)


Imports System.Web
Imports System.Web.SessionState.HttpSessionState
Imports System.Data

Public Class MasterPageModule
    Implements IHttpModule

    Public Sub Dispose() Implements IHttpModule.Dispose
    End Sub

    Public Sub Init(ByVal context As System.Web.HttpApplication) Implements IHttpModule.Init
        AddHandler context.PreRequestHandlerExecute, AddressOf Application_PreRequestHandlerExecute
    End Sub

    Public Sub Application_PreRequestHandlerExecute(ByVal sender As Object, ByVal e As EventArgs)
        Dim application As HttpApplication
        application = DirectCast(sender, HttpApplication)

        Dim page As Page
        page = TryCast(application.Context.CurrentHandler, Page)
        If Not page Is Nothing Then
            AddHandler page.PreInit, AddressOf Page_PreInit
        End If
    End Sub

    Public Sub Page_PreInit(ByVal sender As Object, ByVal e As EventArgs)
     'My Code
    End Sub

End Class

replication peer-to-peer w/o init, source changed before replication


We setup a replciation peer-to-peer source / destination has sperated publisher and distributor each. 

The subscription set without initialize.  But the source db got changed before replication indeed.  Then we find there was something sent by destination distributor which hold all the process for a long time.

The question is: why is it not sent from source to destination? Does the destination try to question the change but very slow, and get the change back very quickly?

WMI: how to get modem init and hangup strings?



Is there a way in WMI to get a modem's init and hangup strings?  The Win32_POTSModem class exposes lots of useful properties, but I was disappointed to discover that it doesn't offer properties for these strings.  I know that I can read the registry (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E96D-E325-11CE-BFC1-08002BE10318}\0002\Init and ...\Hangup) to get these settings, but I would rather use WMI to do this.  Any suggestions?


SP Workflow --ActivityExecutionContext-- Init Fails!


I have designed a Custom activity, which is available for use in SPD. Using this action, I then create a WF, which works great on one site. However when attached to another list on a different Site, following error occurs:

SharePoint Logs
w3wp.exe (0x0900)                                0x0EA8    Windows SharePoint Services                General                                   0                Monitorable            ...quest()     at Microsoft.SharePoint.SPWeb.SetMondoProcHint(Int32 hint)     at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId, Int32 mondoHint)     at Microsoft.SharePoint.SPSite.OpenWeb(Guid gWebId)     at Microsoft.SharePoint.WorkflowActions.WorkflowContext.get_Web()     at CustomMailActivity.SendM

CREATE AGGREGATE failed because type .. does not conform to UDAGG specification due to method 'Init


I am trying to get the CLR user-defined aggregate functions sample working (VB version).

I've saved the sample (from Invoking CLR User-Defined Aggregate Functions ) to a .vb file and compiled it like this:


.0.50727\vbc  /t:library /out: SQLutils.dll Class1.vb
Microsoft (R) Visual Basic Compiler versie 8.0.50727.42
voor Microsoft (R) .NET Framework versie 2.0.50727.42
Copyright (c) Microsoft Corporation. Alle rechten voorbehouden.


The SQLutils.dll file is created without warnings or errors.


I've created the assembly


create assembly sqlutildll from 'D:\SQLdata\dll\SQLutils.dll'


and then the function:



How to pass default values from assoc form to init form?



On a workflow project that use infopath forms services, I was surprised that if the assoc form and the init form have same elements and group in the datasource, the values typed in the assoc form are "automatically" used as default values in the init form.

How can it be possible ? Even if the datasource looks like identical, the schemas namespace are not the same.

I did not see any "copy" values code (I'm not the originator of the workflow).


What's the magic ? Is there any documentation about this behavior ?



Paying back the community for its help by writing articles :
Have a Nice Day.Net Blog
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend