.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 25th, 2009, 06:54 PM
akpaga akpaga is online now
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: May 2008
Posts: 117 akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level)akpaga User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 15 m 31 sec
Reputation Power: 3
ASP.Net/VB.Net - Showing the database item as first item in the drop down list box

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

Reply With Quote
  #2  
Old June 29th, 2009, 04:10 PM
rclark's Avatar
rclark rclark is offline
I do .NET for a living
ASP Free Beginner (1000 - 1499 posts)
 
Join Date: Sep 2003
Location: Florida
Posts: 1,434 rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level)rclark User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 2 Days 20 h 25 m 53 sec
Reputation Power: 157
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)

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > ASP.Net/VB.Net - Showing the database item as first item in the drop down list box


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump





 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
Stay green...Green IT