
June 29th, 2009, 04:10 PM
|
 |
I do .NET for a living
|
|
Join Date: Sep 2003
Location: Florida
|
|
Quote: | Originally Posted by akpaga Hi
In edit customer page
i have a field called state that has drop down box with all the states of usa populated in the aspx page but since it is an edit page the drop down box first (item) state shud be the state that the customer has added in the add customer page and that is stored in sql table.
So for suppose if he has entered "NY" intially then the drop down in the edit page for the customer should be showing Ny as the first item and rest of the states below. How can i achieve this?
thank you |
There are a couple of ways to do it. I will assume you get the customer information before entering the customer edit page so you have the saved state name in a variable; let's say sState and the drop down list is called ddlState.
Code:
If Not Page.IsPostBack Then
'Get Customer Data (fill sState variable)
ddlState.SelectedIndex = ddlState.Items.IndexOf(ddlState.Items.FindByValue( sState))
Else
'Do stuff for post back...
End If
__________________
Roger (.NET MCP)
|