473,387 Members | 1,549 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,387 software developers and data experts.

Trouble with Webb App using c#.net

4
Hi!

I'm having some troubleswith a custom web control.

When I use the web control "normally", that is, I throw it into the web page at design time, its viewstate is maintained along postbacks.

However, if I add this custom control at runtime to a place holder, it loses it's viewstate when the first (and the second, and the tirdm and so on) postback is fired.

The custom control is basically a DropDownList, and as I said, the problem is that that it resets back to it's first element everytime I postback. And i see this doesn't happen with "regular" dropdownlists, I mean, the ones that already come included with the language.

ˇif anyone can help me, I'd really appreciate it!
Nov 19 '07 #1
4 919
RedSon
5,000 Expert 4TB
Hi!

I'm having some troubleswith a custom web control.

When I use the web control "normally", that is, I throw it into the web page at design time, its viewstate is maintained along postbacks.

However, if I add this custom control at runtime to a place holder, it loses it's viewstate when the first (and the second, and the tirdm and so on) postback is fired.

The custom control is basically a DropDownList, and as I said, the problem is that that it resets back to it's first element everytime I postback. And i see this doesn't happen with "regular" dropdownlists, I mean, the ones that already come included with the language.

ˇif anyone can help me, I'd really appreciate it!
Can you save your state as a cookie? Or perhaps use a hidden field to save that information?
Nov 19 '07 #2
fgl82
4
I think I may be able to implement one of those "solutions" but my question is, "shouldn't my custom control act like any other .net control???"

I was expecting to receive an answer like"you have to do this and your control will behave like any "stock" control"...

But i guess I could try your approach.

Thank you.

ps: if anyone has a better solution, one that involves my control behaving as it should, I'm still listening! =D
Nov 19 '07 #3
fgl82
4
Ah, and I don't know either how to make a custom control whose class is not abstract, anyone knows how to do that, so I can instantiate my control at runtime, instead of leaving it laying on the page and referencing it at runtime?
Nov 19 '07 #4
fgl82
4
I think I just solved it by using "LoadControl"! =)
Nov 19 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: George Hester | last post by:
http://tinyurl.com/5uj6w The lower middle icon the "block" should not drop down when the mouse is over it. How can I stop that? Also the navigation divs both top and bottom should follow the...
6
by: Richard | last post by:
Ok. I've quoted the inner stuff as needed. When I click on the "form" {no errors} all I get is a momentary whiteout of the saturn image and the saturn image returns intact. No image swapping, no...
11
by: Jake j | last post by:
Yes, this is a simple and straightforward thing to do as long as the .js file doesn't use a function. When I try a script with a function in a js file I can't get it to work (though it works fine...
3
by: Serious_Practitioner | last post by:
Hello, all - A few days ago, I posted the following message - Hello all, and thank you for your help in the recent past. Got a new error message in the last few days. While working with...
1
by: Serious_Practitioner | last post by:
Good day - As you suggested, I got and used the right version of Jetcomp, and I also tried to run compact and repair a couple of times. I think that the compact and repair process doesn't fully...
6
by: Daniel Walzenbach | last post by:
Hi, I have a web application which sometimes throws an “out of memory” exception. To get an idea what happens I traced some values using performance monitor and got the following values (for...
5
by: yawnmoth | last post by:
I'm having some difficulty with adding elements to a webpage via the DOM. The following works: main.htm: <script> js = document.createElement('script'); js.src='test.js';...
9
by: Donius | last post by:
Hey everyone, i am doing some stuff where i'd like to pop up a little confirmation before a user clicks on a 'delete' link. Just trying to keep the markup clean, i added an attribute ...
7
by: petermichaux | last post by:
Hi, I have tried the following based on suggestions of the best way to insert JavaScript into a page. This is instead of using eval(). Unfortunately IE says "unexpected call to property or...
10
by: whisher | last post by:
Hi. I'm not able to understand why this simple snippet doesn't work with IE. It works fine with FF and Opera 9. Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.