C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




trouble with viewstates and dynamic web user controls!


Posted Date: 18 Jul 2008      Total Responses: 2

Posted By: lejdi       Member Level: Bronze     Points: 1


Hi there, I`m new to ASP.NET.
My situation is like that:
I have built a web user control that has 2 dropdownlists and a textBox.
I manage to add as many copies of the control at runtime on the host page as i want. I want that when the user selects an item from the fist dropdownlist the second list gets filled. Also the textbox will take the selected value of the second dropdownlist.

Basically i`m trying to build a filter component for querying a database.

my problem:
when i change the selection in d.d.l.1 event gets fired but value in d.d.l.2 doesn`t change. I debugged and the selected value of d.d.l.1 is set to null..?
I add the items of d.d.l.1 at runtime by parameters that i pass to the constructor of web user control.
I have read about page-life-cycle, viewstates, tried everything but...

There are 2 possibilities:
1-I`m totally idiot- and i messing the whole situation.
2-The situation is really complicated.
i can provide all the code if anybody is interested in helping me.

have a nice time wherever you are and a big thank you in advance!




Responses

Author: Prachi Purwar    18 Jul 2008Member Level: GoldRating:     Points: 4
Hi,

There are two possibilites to generate this problem:
1. You have not set AutopostBack property as true of first dropdown list
2. SelectedIndexChange event is not attached with code behind SelectedIndexChange event. Bind this event with codebehind event.

After that you face any problem, kindly send your code. After that, I will try to resolve your problem.

Thanks,
Prachi Purwar



Author: lejdi    18 Jul 2008Member Level: BronzeRating:     Points: 3
Thanks Prachi for the promt response@ it was all fault of ddl@if i left it with no static list item it generated null exception when i tried to access selected item@that was the problem@i#ll post the code when i#ll be home@ have a nice time@


Post Reply
You must Sign In to post a response.
Next : Payment Gateway
Previous : How to close an ASP.Net active web page
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

SPOC

Contact Us    Privacy Policy    Terms Of Use