473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Repost : Viewstate being maintained second time around

Hi all,

I have a problem with viewstate being maintained. I use LoadControl to load
a user control and the data is sent down to the client correctly. However,
when I change some data and post it, the viewstate does not seem to load for
the user control upon sending it back down to the client. If I change the
data again, then the viewstate DOES seem to be maintained.

What gives?

Regards
Nov 17 '05 #1
1 1199
John -
I had quite a bit of trouble getting a usercontrol to work when the
usercontrol included webcontrols that I wanted to interact with the
parent.
The best way I found to work is to drag the usercontrol onto the
parent, then toggle the visible property, rather than using
LoadControl.
My web page is in GridLayout, so I programmatically move it to
position when it's changed to visible = true.
I also found that ViewState wasn't working. I found an usercontrol
example that showed removing the OnInit() function in the usercontrol
and replacing it with
public void Page_Init(object sender, EventArgs e)
{
InitializeComponent();
}
** I'm not sure why the example used this method. It seems like you
could just remove the base.OnInit(e) for the Designer generated code,
but I didn't try that.

Then, in the parent, add

this.Init += new System.EventHandler(this.ctlAddNewRule.Page_Init);
(** Mine is in C#, I'm not sure how to do it in VB)

I have this usercontrol on several pages, and it is working
consistently.

Dawn.

"John" <a@b.com> wrote in message news:<eb**************@tk2msftngp13.phx.gbl>...
Hi all,

I have a problem with viewstate being maintained. I use LoadControl to load
a user control and the data is sent down to the client correctly. However,
when I change some data and post it, the viewstate does not seem to load for
the user control upon sending it back down to the client. If I change the
data again, then the viewstate DOES seem to be maintained.

What gives?

Regards

Nov 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Steve McLellan | last post by:
Hi, Sorry to repost, but this is becoming aggravating, and causing me a lot of wasted time. I've got a reasonably large mixed C++ project, and after a number of builds (but not a constant...
1
by: John | last post by:
Hi all, I have a problem with viewstate being maintained. I use LoadControl to load a user control and the data is sent down to the client correctly. However, when I change some data and post...
10
by: neo | last post by:
hi, I am studying ASP.NET and have few questions - 1) The session ID and values of controls is stored in VIEWSTATE variable. So now when we put EnableViewState="false" in Page directive and...
5
by: Steven Licciardi | last post by:
I have an aspx page with nothing in it but one literal, which I populate with straight forward html (the html consists of about 25 tables with approx. 30 rows each and two columns with text in each...
11
by: Nad | last post by:
Hello, I have a page with two link buttons. When I click on the first one I call server.execute("target.aspx") to view target.aspx on the original page. Then I click on the second link button...
1
by: russ | last post by:
Hi all, Here's a problem I'm having with a dynamic table. Following the guidelines here (http://www.codeproject.com/aspnet/dynamiccontrols.asp), which make perfect sense. The problem is that...
1
by: batista | last post by:
Hello, I have a web page, which is being refresh after every 30 secs.Now, there is also a datagrid in it, which i bind in the pageload event. Now the problem is when the page is refresh after...
2
by: Pipo | last post by:
Nobody knows how to get the values provided in the client can be read in the user-control? If have made a Web Custom Control with 2 textboxes and 1 dropdownlist. The user fills in my control (the...
10
by: Lloyd Dupont | last post by:
When you define UserControl in source code the sample I see are often like that: ============ public string Text { get { String s = (String)ViewState; return ((s == null) ? String.Empty : s);...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.