page-lifecycle

simple login page and dynamically hiding controls based on session variable

亡梦爱人 提交于 2019-12-11 04:34:18
问题 I think my question revolves around me not having a comfortable grasp of page life cycle in ASP.net still unfortunately. Ive read a lot but its a lot to take in, sorry! anyways im trying to make a super simple page as a proof of concept for what I will do across the entire site so first I will just post what I have: ASPX: <asp:Button ID="btnLogin" runat="server" Text="Login" onclick="btnLogin_Click" /> <hr /> <asp:Label ID="Label1" runat="server" Text="Regular User"></asp:Label> <asp:TextBox

Display Ajax Loader while page rendering

北战南征 提交于 2019-12-11 03:43:14
问题 This is probably a simple question but how can I best use an AJAX loader in ASP.NET to provide a loading dialog whilst the page is being built? I currently have an UpdatePanel with an associated UpdateProgressPanel which contains the loading message and gif in a ProgressTemplate. Currently I have a page that onLoad() goes and gets the business entities and then displays them. While it is doing this I would like to display an AJAX loader. Would it be better to have nothing in the page load and

JSF Lifecycle with immediate=true

拥有回忆 提交于 2019-12-11 01:05:48
问题 When I read article Listen and debug JSF lifecycle phases wrtten by @BalusC, I have some trouble understanding the article. While Add immediate="true" to UIInput and UICommand , It says: Note for all components with immediate: as the Update model values phase is skipped, the value bindings aren't been set and the value binding getters will return null. But the values are still available... Note for other components without immediate: any other UIInput components inside the same form which don

hidden field is null on !IsPostBack and not null on IsPostBack

天涯浪子 提交于 2019-12-11 00:51:38
问题 First I'll apologize for the unclear title of my question. I wasn't sure how to succinctly describe my problem in a title. I have a hidden field in my .aspx <input type="hidden" name="hid1" value="0" /> I want to set the value of this field during the page load event, and if it is not a postback. protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { // This doesn't work! Request.Form["hid1"] = "1"; } if (Page.IsPostBack) { // This DOES work! Request.Form["hid1"] = "1"

Httpcontext is null?

微笑、不失礼 提交于 2019-12-10 19:47:31
问题 Is it right to say that when Httpcontext object is null - so the iis is down ? i know that when the first request to iis ( asp.net) the application manager creates enviroment : Application Domain. inside it theres Application Runtime. And inside it there's blocks of (if theres more then 1 application on the server) HttpApplication with each has httpContext which handler Response and Request. So what does it mean when i get in asp.net HttpContext is null ? 回答1: I don't think that you can be

ASP.NET Hidden Field Persistence During Life Cycle

眉间皱痕 提交于 2019-12-10 18:17:11
问题 I feel like I may be overlooking a fundamental concept of the page life-cycle here and have been (either because I can't figure out the right keywords or it hasn't been asked) unable to locate an existing answer so forgive me if this has been asked. Basically, I need to persist a mutable object between the client side and the server side. Since the viewstate is encrypted/serialized and the session state is server-side only, my solution was to use a hidden field--easy enough, right? Well here

When are ASP.NET code blocks, e.g., <%= %> executed in the page lifecycle?

穿精又带淫゛_ 提交于 2019-12-10 15:20:02
问题 When I am databinding an entire page, I will do something like this: Blah blah... <%# SomeProperty == "GoodBye" ? "See you later" : "Hello" %> And that works beatifully. However, often I will not use databinding for an entire page and write things the "clasic" ASP.NET way. E.g., in the code behind I will have something like: lblSomeMessage.Text = SomeProperty == "GoodBye" ? "See you later" : "Hello"; And then .aspx would have <asp:label runat="server" id="lblSomeMessage"/> But what I want to

ASP.NET Page life cycle: methods vs Events

℡╲_俬逩灬. 提交于 2019-12-09 23:39:18
问题 Can someone please explain to me the difference between methods and events in the ASP.NET page life cycle? Thanks 回答1: When a page runs a series of methods are executed. These methods in turn raise events that can be handled by the user to perform various tasks like initializing controls, populating control properties, executing control behavioral code, etc. Here is an excellent flowchart from MSDN that shows the different methods that are executed, and the events that are raised from those

What do you do when you can't use ViewState?

情到浓时终转凉″ 提交于 2019-12-09 06:01:18
问题 I have a rather complex page that dynamically builds user controls inside of a repeater. This repeater must be bound during the Init page event before ViewState is initialized or the dynamically created user controls will not retain their state. This creates an interesting Catch-22 because the object I bind the repeater to needs to be created on initial page load, and then persisted in memory until the user opts to leave or save. Because I cannot use ViewState to store this object, yet have

ASP.NET BasePage back referencing to concrete implementation

懵懂的女人 提交于 2019-12-08 05:28:01
问题 I have a page that is setup like this public partial class _Default : ViewBasePage<EmployeePresenter, IEmployeeView>, IEmployeeView { ... } Inside my base page public abstract class ViewBasePage<TPresenter, TView> : Page where TPresenter : Presenter<TView> where TView : IView { protected TPresenter _presenter; public TPresenter Presenter { set { _presenter = value; _presenter.View = GetView(); // <- Works //_presenter.View = (TView)this; <- Doesn't work } } /// <summary> /// Gets the view.