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

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

LoadViewState() not called

Posted By:      Posted Date: September 07, 2010    Points: 0   Category :ASP.Net
I can't understand why the method LoadViewState() is not called after the postback in my code below.After label1 cahnges its text the "__VIEWSTATE" hidden field is modified, but LoadViewState() is not called.   Partial Class Default2 Inherits System.Web.UI.Page Protected Overrides Sub LoadViewState(ByVal savedState As Object) MyBase.LoadViewState(savedState) End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Label1.Text = "xxxx" End If End Sub End Class <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>title</title> </head> <body> <form id="form1" runat="server"> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </form> </body> </html>

View Complete Post

More Related Resource Links

Web Q&A: Who Called the Script?, Concatenating Binary Files, and More


This month find out which part of an HTML document has called a script, how to concatenate binary files, find a node, reference one script from another, build a GUI database front end in Access, and compare XML files.

Edited by Nancy Michell

MSDN Magazine August 2003

InfoPath Workflow Task Form "Loading" event handler only being called after App Pool recycled.


I have a Workflow that is using an InfoPath task form.  In the "FormEvents_Loading" method event handler I have some code that needs to run each time the form is opened.   I recycle the App Pool and open the form the code runs perfectly, but if I close and try to re-open the form the code is not run at all.  I can then recycle the App Pool again and on the next load the code executes just fine.   The code that is supposed to be run is a very simple statement to set a field value, so I don't think it is interfering.

Does anyone know what this might be?


Trying to get SPSite when called through a web service


I have built a custom timer job that makes calls to a web service that I built.  The reason I built the web service is because I recognized that the sharepoint timer job does not have context for a site and I thought that by having the timer job call the web methods of the web service I could have the context that I desire.  This works great for accessing the web.config file, however, I have discovered that I am unable to get SPSite (SPSite oSite = new SPSite(AbsoluteURL)).  The constructor does not throw an error but I am unable to use the new object.  If I am able to get to the web.config and the site is a SharePoint site I figure I should be able to get an SPSite object.

I am trying to understand if I am running into a known scenario or if this should work and that I have a bug that I don't recognize.

WCF Service Function Getting Called Twice


I have a WCF Web Service.  I am trying to test the service from a web form.  The web form calls the service using WebOperationContext.  The call successfully sends, however the web service function gets called twice while stepping through the code.  Nothing happens in between the first and second function call.  Not even setup of the Service.  The function itself is building a Generic List<Of Type T> and adding objects to the list.  The odd thing that happens, if I do not make the call to the add function, the Service function doesn't get called twice.  I'm including the network log collected from the network layer.  I can provide more source code if need be.  

Custom Validation Attribute is not called by validation mechanism.

Hello everyone I have create custom validation attribute and assign it to class level validation. Unfortunately, it is not called. I try every way that it think it could be solve the problem. However, it take me for hours and I can't find the attribute is not called by validation mechanism.For illustrate you I put the following code.Attribute[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)] public sealed class BooleanDependencyAttribute : ValidationAttribute { private const string _defaultErrorMessage = "?????????{0}"; private readonly object _typeId = new object(); public string DependencyPropertyName { get; private set; } public string DependentPropertyName { get; private set; } public BooleanDependencyAttribute(string dependencyPropertyName, string dependentPropertyName) : base(_defaultErrorMessage) { DependencyPropertyName = dependencyPropertyName; DependentPropertyName = dependentPropertyName; } public override object TypeId { get { return _typeId; } } public override string FormatErrorMessage(string name) { return String.Format(CultureInfo.CurrentUICulture, ErrorMessageString,name); } public override bool

DataGrid ValidationRule or IDataErrorInfo validation code called multiple times for each data change

Following my enquiry regarding a problem in Datagrid validation, for which managing exceptions is apparently a problem, I tested the two other methods: using validation rules, or implementing the IDataErrorInfo interface. I ran into other problems there, more insidious this time. This has been done on Windows7 (32-bit), .NET 4.0.30319. 1) IDataErrorInfo When this interface is implemented, the this[string columnName] property is called four times for each modification: two times before the cell enters edit mode (with the old value in the corresponding property) two times when the new value has to be validated (with the new value) It strikes me as not really efficient, is there something wrong with my code? Here's the C# part: using System; using System.Windows; using System.Collections.ObjectModel; using System.ComponentModel; namespace DataGridTest2 { public partial class MainWindow : Window { ObservableCollection<User> users; public MainWindow() { InitializeComponent(); users = new ObservableCollection<User>() { new User { Name = "Teddy", Age = "2" }, new User { Name = "Avi", Age = "19" } }; datagrid.ItemsSource = users; datagrid.Focus(); } } public class User : INotifyPropertyChanged, IDataErrorInfo { string name; public string Name

ViewBase.ClearItem is never called

Hello, I'm currently playing with ListView.View property and the associated ViewBase class and during my tests I discover that my override of the ViewBase.ClearItem method is never called when I remove items from the source items of the ListView. Does someone has any clue about when the ClearItem method is called? How can I, in my ViewBase class, manage the suppression of some elements in the initial list? Thanks in advance for your answers! To illustrate this issue, I have created a sample application composed of a Window with two buttons and a list view: The list view is initialized with three values The first button ("remove") removes the last entry of the source The second button ("clear") removes all the elements of the list by calling the Clear() method The list view is associated to a ViewBase implementation that only trace method calls to the console Finally, I run the sample and have three calls of the PrepareItem method visible on the console. After that I click on the first and second button, the list is updated but the ClearItem method of the ViewBase was never been called. Here is a sample source code: First of all the XAML (MainWindow.xaml): <Window x:Class="Poc.ViewBaseIssue.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.c

OnPreRender method is Not called last because of objectDataSource

I have an Asp.net web form with several drop down list boxes on it. The way the code is currently set up is that the drop down listboxes are populated through use of an ObjectDataSource via a class named SpottedWeb, as referred to by the TypeName attribute. The problem is that sometimes I need to pre-select drop down list box items, but the ObjectDataSource seems to have the last say in loading the drop down listboxes. So any attempt to pre-select drop down listbox items is undone when my .Aspx code is executed. My attempt to fix this involved creating an OnPreRender method, because I thought it would have the last say with populating my listboxes. But this is not the case.So is there a way that I can have the OnPreRender method or some other C# method be called after the .Aspx page loads my drop downs with the objectDataSource? // Here is my OnPreRender method.         protected override void OnPreRender(EventArgs e)        {            base.OnPreRender(e);             if (Session["Indicator"] != null)            {                PrePopulateWebForm(); // Pre-Sele

How can I know that LoadingRowDetails will not be called?

Hello, I wan't to set this.Cursor = Cursor.Wait in the SelectionChanged event of a DataGrid, then when a (sometimes lengthy) process of loading the RowDetails is finished, set this.Cursor = Cursor.Arrow. Problem is that the LoadingRowDetails event is only called the first time the row is loaded. So I have 2 questions: 1. How can I know if LoadingRowDetails will be called or not? 2. Why does is take so long to load the row details if I put the a DataGrid inside of an Expander (see XAML below)?   Thanks, Bill MSDN Subscriber

Fail to create window in C++ DLL called from C#

Can anyone help here, please? http://social.msdn.microsoft.com/Forums/en-US/vclanguage/thread/5b47544c-8151-4c8a-a8c3-14fbeabbbb41 Thanks in advance.

When is Application_BeginRequest called?

I have two versions of a website. One runs on IIS server on a local PC, the other runs on the ASP.NET development environment included on Visual Studio (localhost). Apart from that, the file stucture of both is the same, although only the one running on IIS works properly, and this seems to be related to the fact that the IIS version calls Application_BeginRequest() where the other doesn't.I've looked at the differences between IIS server and the ASP development environment in: http://www.asp.net/hosting/tutorials/core-differences-between-iis-and-the-asp-net-development-server-cs, and it says that IIS and the ASP development server deal with static content in that for IIS in that on IIS static content does not go through the ASP.NET runtime like it does on the dev environment (but I'm not sure exactly what this means).I've done a number of tests involving images, etc, and have noticed that when the image is of the form:<img src="Image/MyImage.jpg...>the IIS server version calls Application_BeginRequest(), but the visual studio development environment version doesn't. However, if I change the above code to use:<img src="<%=ResolveUrl("~/Image/MyImage.jpg")%>" ...>it will call Application_BeginRequest().In my case, it is necessary to call Application_BeginRequest because this creates a new path and calls RewritePa

Javascript not getting called

Hi All, I am passing values from javascript to another url. In my javascript function, i just added one more parameter called docID. Earlier, without it, all the remaining values being passed were showing their values properly. But DocID when added, in the quickwatch it shows as docID&rwndrnd=0.3228507973801712 instead of my actual docid value. Can anybody please help me and tell me why is it that the docID value is not coming correctly? Also, when I debug the javascript function is not getting called so I cannot see what value is getting assigned to the docID. How do I enter the javascript function while debugging? emailWindow.SetUrl(   "emailDocs.aspx?tab=account&docClass=UWPolicyFile&policyNumber=" + policyNumber + "&symbol=" + symbol + "&mod=" + mod + "&docID=" + docID); Thanks, Mavericky    

SSRS Called from API

Hi, I have recently started working on SSRS. I have developed some reports on SSRS, which i had to deploy it some server. What i need to do is to generate reports using SSRS directly form the API and not deploying that separately. What i mean to say is, suppose i have some report names on the aspx page of application, and when user clicks on the report name the application would generate report using the SSRS. Can anyone please suggest me an advice? It would great if you can give the link where i can find a simple example on this. Thanks in advance.

Google Checkout Notification Page Not called

Hi All, I am implementing Google checkout in asp.net website. I done with all the checkout stuff. But I stuck in Notification page handler. My Notification aspx page is not get called. In sanbox integration console its showing 401 unauthorized access error. I tried many things but not succeeded yet. Can anyone help me to sort out this issue. Please don't refer google checkout page because I already spend lots of time on it to sort out this issue. Thanks in Advance Micky

Extremely long delay in MapUrlToZoneWrapper called by LateBoundBitmapDecoder.DownloadCallback

After a random interval, our application will appear to lock up when switching to a different view. The profiler indicates that the time is being spent in MS.Internal.SecurityHelper.MapUrlToZoneWrapper (and presumably therefore in the native MapUrlToZone function).  The method takes 1.3s to return; multiply by ~150 images and the total wait time for the user is three minutes (for what is usually an instant operation). My question is - why does this start happening at a random point during the application's lifetime?  For the first half-hour or so, the experience is perfectly normal - you can flip between the two views as much as you like with no ill effect.  Then at a certain point it starts taking minutes to switch - one CPU core is at 100% during the period. Internally, we're using bitmaps with a UriSource pointing to an in-process http server (long story about why this is the case).

CacheMetadata is not called when a custom activity is placed inside a flowchart

I wrote a simple Native activity which implements CacheMetadata(NativeActivityMetadata metadata) to declare arguments and variables. The activity works great but when I tried to use it inside a flowchart activity I found out that CacheMetadata is not called by visual studioo when the activity is dragged from the toolbox into the flow chart . This of course prevents my activity from working correctly. How can a custom activity be used inside a flowchart activity if CacheMetadata not called? Is there a way to make CacheMetadata run when the custom activity is placed inside a flowchart activity? Thanks Manu    
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