|
| |
| troy23 | Asp.Net User |
| Re: Viewstate Expert Needed | 1/3/2004 3:14:17 PM |
0/0 | |
|
Thanks for replying. Below is the declaration of the user control within the html and code behind. I am unsure how it can be loaded during the page load event.
<%@ Register TagPrefix="uc1" TagName="AdminComboUpdates" Src="AdminComboUpdates.ascx" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="admin.aspx.vb" Inherits="pims.admin"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>admin</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="flowLayout">
<form id="Form1" method="post" runat="server">
<uc1:AdminComboUpdates id="AdminComboUpdates1" runat="server"></uc1:AdminComboUpdates>
<table cellSpacing="0" cellPadding="0" width="100" border="2" style="WIDTH: 600px; HEIGHT: 14px">
<tr>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="WIDTH: 101px; HEIGHT: 38px"></td>
<td style="WIDTH: 103px; HEIGHT: 38px"><asp:Label id="lblDept" runat="server" Width="86px" Height="21px">Department</asp:Label></td>
<td style="WIDTH: 2px; HEIGHT: 38px"><asp:Button id="btnDept" runat="server" Width="30px" Height="25px"></asp:Button></td>
<td style="WIDTH: 45px; HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
</tr>
<tr>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="WIDTH: 101px; HEIGHT: 38px"></td>
<td style="WIDTH: 103px; HEIGHT: 38px"><asp:Label id="lblEthnic" runat="server" Width="125px" Height="21px">Ethnic Group</asp:Label></td>
<td style="WIDTH: 2px; HEIGHT: 38px"><asp:Button id="btnEthnic" runat="server" Width="30px" Height="25px"></asp:Button></td>
<td style="WIDTH: 45px; HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
<td style="HEIGHT: 38px"></td>
</tr>
</table>
</form>
</body>
</HTML>
Public Class admin
Inherits System.Web.UI.Page
Protected WithEvents ucAdminComboUpdate As New pims.AdminComboUpdate
Edit by moderator - NetProfit: Added < code></ code> tags. |
| master4eva | Asp.Net User |
| Re: Viewstate Expert Needed | 1/3/2004 6:02:39 PM |
0/0 | |
|
My suggestion and the other poster's suggestion is void in your case because the controls do have a static ID. I do see the problem in your code. With this code-behind line:
Protected WithEvents ucAdminComboUpdate As New pims.AdminComboUpdate
Change it to this:
Protected WithEvents ucAdminComboUpdate
-- Justin Lovell |
| master4eva | Asp.Net User |
| Re: Viewstate Expert Needed | 1/4/2004 5:52:19 PM |
0/0 | |
|
/me Hit self on head.
Sorry for that, my head was not thinking when I wrote that post (and partially, I am a C# guy) :) . The line is supposed to look like:
Protected WithEvents ucAdminComboUpdate As pims.AdminComboUpdate
-- Justin Lovell |
| NetProfit | Asp.Net User |
| Re: Viewstate Expert Needed | 1/4/2004 5:57:26 PM |
0/0 | |
|
Try:
Protected WithEvents ucAdminComboUpdate As pims.AdminComboUpdate
or:
Protected ucAdminComboUpdate As pims.AdminComboUpdate
Jamie Kindred, CGA, MCSD Senior Solutions Architect TSi Auto Solutions |
| master4eva | Asp.Net User |
| Re: Viewstate Expert Needed | 1/6/2004 1:01:19 PM |
0/0 | |
|
This VB?
Protected WithEvents ucAdminComboUpdate As pims.AdminComboUpdate
If it is, it is in C#:
protected pims.AdminComboUpdate ucAdminComboUpdate;
-- Justin Lovell |
| NetProfit | Asp.Net User |
| Re: Viewstate Expert Needed | 1/15/2004 3:16:50 AM |
0/0 | |
|
Remember that a control event, such as a button click event, fires after the page load event. We cannot change the order of these events, they are determined by the page framework. I am guessing that you are seeing this problem with ViewState("Function"). Since page_load is executing before your button click, you are indeed seeing the old value during page load. After your button click event executes, you will notice that ViewState("Function") has the new value. Try putting this line in your button click event handler after the line that updates the VeiwState:
lblClick.text="Click :" & ViewState("Function")
If you need more control over the ViewState of this particular control, so that it is available during the page_load event, you will need to set the VeiwState variable earlier on during the page life cycle, or build your own server control that implements the IStateManager interface. The first option is limited but simple, the second option is flexible but somewhat complex.
BTW: Please enclose your code inside of < code></ code> tags to keep the formatting nice! ;)
Hope this is of some help.
Jamie Kindred, CGA, MCSD Senior Solutions Architect TSi Auto Solutions |
|
| |
Free Download:
Books: Expert ASP.NET 2.0 Advanced Application Design: Advanced Application Design Authors: Dominic Selly, Andrew Troelsen, Tom Barnaby, Pages: 459, Published: 2005 Pro ASP.NET 2.0 in VB 2005: From Professional to Expert Authors: Laurence Moroney, Matthew MacDonald, Pages: 1253, Published: 2006 Beginning ASP.NET 3.5 in VB 9.0: From Novice to Professional Authors: Matthew MacDonald, Pages: 1149, Published: 2007 Expert F# Authors: Don Syme, Adam Granicz, Antonio Cisternino, Pages: 609, Published: 2007 Expert Spring MVC and Web Flow Authors: Seth Ladd, Darren Davison, Steven Devijver, Keith Donald, Colin Yates, Pages: 403, Published: 2006 Web:RT - 24/7 English-language news channel : News : RT Expert View ... Sep 19, 2008 ... RT Expert View: state borders vs. self-determination. This week we ask experts to comment on one of the basic contradictions of ... Bay View State Park Travel Guide | Away.com Away.com's Bay View State Park travel guides provide information on hotels, ... Expert Rated & Recommended. 4.0. All Bay View State Park Hotels » ... ViewState: All You Wanted to Know: ASP Alliance This article looks at what ViewState is NOT and what it is, ... This article provided the evidence that I needed to begin investigating an alternative ... How to pass ViewState value from web form page to web user control ... Hello Expert, I face the problem where i cant get d value of my ViewState in my user control page as the viewstate is assign the value in my web form page. How to save an array to viewstate in asp.net? Hi Expert, I have several arrays need to be saved to viewstate. for example, client_id(i) lname(i) fname(i) I got the total i as totalcount from... Validation of viewstate MAC failed error in asp.net? (asp.net ... HttpException: Validation of viewstate MAC failed Do you know what that means and how to correct ... and points have been rewarded to the following experts: ... Changing page position of Viewstate for SEO well-optimised page a large viewstate can be detrimental to it's ... Upon talking with our HTML expert, he was able to shed light on some of ... Inside Microsoft: ASP.NET ViewState Inside Microsoft: ASP.NET ViewState .... They can choose from beginner, intermediate, and expert and we will modify some parts of the site that they use ... ViewState is Corrupt or Invalid for this page - ExtremeExperts NET runs a message authentication check (MAC) on the view state of the page when the page is posted back from the client. This check determines if the view ... Re: viewstate gets too big sure you can, viewstate is only needed as a way to preserve the state of the ... Upon talking with our HTML expert, he was able to shed light on some of my ... |
|
Search This Site:
|
|