Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 9th, 2003, 04:20 AM
Registered User
Join Date: Dec 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems with SelectedIndexChanged not firing

Hello, I have a few issues but this one is stopping me in my tracks.
I am making a asp.net app using VB, and I have some basic controls on my web form: drop down list box, button, label. Now when I double click on the drop down box and I get the SelectedIndexChanged event and fill it in with some basic code, when I run the app that event doesnt even get ran. Now I have a web form button and web form drop down box. Also the button command and text values are Submit.

Also I am trying to store what value was selected in the drop down box and carry it over to the postback page so I can do other means with that value, but I am unable to save it using ViewState() function. Well am unsure if its saving the value but getting the value out of it could be failing also. I cant debug it since the server isnt setup to do it, so I kinda have to use the lable to send output text.

Also another problem, in my button event I have this code
ViewState.Add("INDEX", 1)

in my load event I got this code
If IsPostBack = True Then
   Label1.Text = CType(ViewState("INDEX"), String)
end if

The value isnt being sent over, and those 2 lines dealing with ViewState are the only code related to that, also I have enableviewstate for the button and drop down to true. I am not making a new viewstate obj which I dont think I need to myself. But anyway the code isnt working so if there are any settings that I need for this to work let me know.

Thank you.
Reply With Quote
  #2 (permalink)  
Old December 9th, 2003, 10:27 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

First off, you shouldn't need to do save a value from a control in viewstate. The controls save their own values in viewstate already. You don't need to use viewstate if you have everything set up correctly.

How are you populating the DDL? This has significant bearing on the problem depending on how the DDL is getting populated. If your are databinding the DDL then the problem may be very easy to solve. Typically, people will databind a DDL but not make it conditional based on "IsPostback". This results in the DDL being re-bound every time the page is loaded. The process of binding the control causes the viewstate information (i.e., what the previous value was) to get lost so the framework has no way of knowing that the value has changed.

Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 9th, 2003, 02:29 PM
Registered User
Join Date: Dec 2003
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

How I am populating the DDL is I have a function that opens an xml file and gets the values that I want then closes it and each time I have the right value I will add it to the list.

The reason why I am trying to use viewstate is because all my values are going away and I need to reread that xml file to pop the DDL again, but it defaults to 0 index, which means to me its because of the repop. By this point I dont know what value was selected after I clicked the button.

Also if I select a value from the list then click the button it doesnt get the value I selected so I can use it but rather defaults to 0 even if I selected index 1.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dropdownlist on selectedindexchanged RoniR ASP.NET 1.x and 2.0 Application Design 4 April 6th, 2012 04:50 PM
selectedindexchanged event not firing kaliaparijat ASP.NET 2.0 Professional 1 June 5th, 2008 08:58 AM
Problem with Dropdownlist.SelectedIndexChanged haydar BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 July 20th, 2007 10:26 AM
SelectedIndexChanged & Databinding problems blakemi4 Visual Basic 2005 Basics 0 August 1st, 2006 08:55 AM
SelectedIndexChanged venterjo General .NET 7 December 15th, 2004 09:21 AM

All times are GMT -4. The time now is 04:34 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.