473,386 Members | 1,705 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.

Saving on SelectedIndexChanged

Any ideas on what the best method is for the following: I have a
dropdownlist which determines some of the contents of the rest of the
page. The Dropdownlist's AutoPostback is set to true so when a user
changes the item in the list the page gets reloaded with new
information. My problem is that if they change any of the related info
I need to save it in the postback, presumably in the
SelectedIndexChanged event. I only seem to be able to access the newly
selected item and therefore cannot save the previous item's details.
This seems like a fairly standard process but I can't seem to see the
best way of doing it.

Any ideas?

Mar 1 '06 #1
2 1009
Hi James,

You could save the current selected item's details in the viewstate.

ViewState["myInfo"] = yourObject
When there is a postback, you can get the old info, and set it again
with the new selected item.

Make sure that your object /info is Serializable, otherwise it cannot
be placed inside the viewstate if I'm not mistaken

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx

ja*************@hotmail.com wrote:
Any ideas on what the best method is for the following: I have a
dropdownlist which determines some of the contents of the rest of the
page. The Dropdownlist's AutoPostback is set to true so when a user
changes the item in the list the page gets reloaded with new
information. My problem is that if they change any of the related info
I need to save it in the postback, presumably in the
SelectedIndexChanged event. I only seem to be able to access the newly
selected item and therefore cannot save the previous item's details.
This seems like a fairly standard process but I can't seem to see the
best way of doing it.

Any ideas?


Mar 1 '06 #2
Hi Ward,

Thanks for this. I did try this method myself, but my code seemed to
get very confusing and I was wondering if there was another way. I
guess not. If anyone else has any other methods I would appreciate
hearing them, otherwise it looks like Viewstate is the way.

Mar 2 '06 #3

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

Similar topics

0
by: LV | last post by:
Hello, I would like to manually set one of my list view items as selected. When this item is set, I would like for a method to execute. I have a delegate on the list view for SelectedIndexChanged....
0
by: LV | last post by:
Hello, When I manually set a list view item to be a selected item, the SelectedIndexChanged event is not firing. Am I missing something here? using System; using System.Windows.Forms; ...
1
by: Donal | last post by:
I have 3 related dropdowns. When the 1st is changed, the 2nd is updated, and when the 2nd is changed, the 3rd is updated. When i change the 1st dropdown (sites), the SelectedIndexChanged fires...
0
by: mathieu cupryk | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
0
by: PeacError | last post by:
Using Microsoft Visual Studio .NET 2003, Visual C# .NET 1.1: I apologize if this question has been addressed elsewhere, but I could not find a reference to it in the search engine for this...
0
by: Luis Esteban Valencia | last post by:
in the Button1_Click I need to make the 1st column saved as readonly. How can I do this? using System; using System.Collections; using System.ComponentModel; using System.Data; using...
0
by: tafpin | last post by:
I have an application with a datagrid. In the IDE I have 2 template columns. The first has an image button and the second contains a link button. According to the results that I get back I must...
3
by: Alec MacLean | last post by:
Hi, I have a couple of win forms where I am editing values that are stored in a SQL database. I'm using the listbox control to hold the data object each form interacts with. Each object is...
4
by: lakepeir | last post by:
Hello, I have combobox with a selectedindexchanged method that seems to be called when starting the application, launching the form with the combobox and making a change in the drop down box of...
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: 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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.