473,503 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Weird ViewState issue in a Custom Control

I have a custom WebControl that I am working on, it's weird...

I have two Properties, that I save to ViewState. I know they save, and
have
verified this with the ViewState viewer... When a postback happens, one
of
the properties is there, the other is null... not sure WTF the issue
is...

I tried overriding the LoadViewState and SaveViewState, the save is
called,
but the load never seems to be called... this is ASP.Net 1.1, and 2.0
isn't an
option... any feedback/help would be appreciated.

has anyone had any issues like this before? I've seen a few postings
with
similar issues, but no conclusive answers.... I *could* use a hidden
form
field rendered with the control to track this (I am actually doing that
anyway
for a non-postback mode), but this is unreliable if in a hidden panel
(for
example) the input elements won't be there, I need the ViewState...

--
Michael J. Ryan - tracker1(at)theroughnecks(dot)com -
www.theroughnecks.net
icq: 4935386 - AIM/AOL: azTracker1 - Y!: azTracker1 - MSN/Win: (email)

Dec 1 '05 #1
2 1035
Tracker1 - Michael J. Ryan wrote:
I have a custom WebControl that I am working on, it's weird...

I have two Properties, that I save to ViewState. I know they save, and
have
verified this with the ViewState viewer... When a postback happens, one
of
the properties is there, the other is null... not sure WTF the issue
is...


How is your control instatiated?

On the aspx or dynamicly?

Thomas Skovsende
Dec 2 '05 #2
> How is your control instatiated?

On the aspx or dynamicly?


It was actually the parent control that was causing the issue... I was
using Controls.AddAt() inside the parent control's CreateChildControls
overload.. apparently that doesn't work properly... I was able to get
around it, but using Controls.Add() before the
base.CreateChildControls() call... Was a hard thing to find, since the
problem was because of another control.. *sigh* killed almost 2 days on
this issue.

Another thing I hadn't considered, was using the
Page.RegisterClientScriptBlock to put a hidden input field on the
form... in any case, it's working now *finally*.. keyed in on searching
on the LoadViewState overload not firing, which is how I found the
answer.

Dec 2 '05 #3

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

Similar topics

3
1816
by: Chris Thompson | last post by:
I have a page that uses a custom object I wrote to build a table. I also have a post back to the page to remove items from that table. When the page loads I can see the viewstate code on the...
2
3169
by: Jay Walker | last post by:
I created a custom DataGridColumn based on Marcie Robillard's MSDN Article: Creating Custom Columns for the ASP.NET Datagrid...
3
1856
by: Chris Newby | last post by:
I have a very simple custom control that derives from WebControls.Panel and implements INamingContainer. It appear that controls created as children of my custom control are having ViewState...
10
3060
by: Robert | last post by:
I have an app that was originally 1.1, now migrated to 2.0 and have run into some sporadic viewstate errors...usually saying the viewstate is invalid, eventvalidation failed or mac error. My web...
1
1648
by: Christophe Peillet | last post by:
I have a CompositeControl with two types of properties: 1.) Mapped Properties that map directly to a child control's properties (ex.: this.TextboxText = m_txt.Text). These properties are handled...
5
1768
by: Mark Olbert | last post by:
I have a composite control (under ASPNET2; derived from CompositeControl) which contains a label. The contents of the label are set when the control is created to a user-supplied value. What's...
3
2055
by: Adrian Parker | last post by:
v1.1 and v2.0 We have a problem with viewstate not being stored. What's happening is that we create controls in CreateChildControls and add them to a container on the page (whether it be a...
0
2131
by: webmaster | last post by:
Hi all, I'm tearing my hair out with this one. I have successfully implemented by own RadioButtonList in order to provide additional functionality and a DIV rather than TABLE-based layout in...
9
2654
by: =?Utf-8?B?TUNN?= | last post by:
I'm sure the answer to my question varies depending on the situation, but I am looking for a general "best practice". If I have an asp.net application and I load certain data from a database,...
0
7074
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
7322
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...
0
7451
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5000
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4667
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3161
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3150
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
374
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.