Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How to intialize dropdownlist with Session variable in a formview control

Posted on 2009-04-05
2
Medium Priority
?
928 Views
Last Modified: 2013-12-17
Hi,

   I have one question on asp.net formview control.
I have a formview control on my webpage. It has a dropdown list. I am populating it with data coming from database. Also, the dropdown list should have one more value in the list which is coming from session variable(from another page) and that should be the default value for the ddlist. I can populate the dropdown vid the data from database. But i donno how to add the session value in the dropdown list.
 Can i have suggestions.

Thanks
0
Comment
Question by:dotnetuser07
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 4

Expert Comment

by:y0usuf
ID: 24074284
After binding dropdownlist from database.
You can add the item from session by

dropdownlist.items.add(new listItem(session("DropDowlistItemToAddText"),session("DropDowlistItemToAddValue")))
0
 
LVL 4

Accepted Solution

by:
y0usuf earned 750 total points
ID: 24074288
Or you can also use AppendDataItems=True Property of dropdownlist

If you do this FIrst Add the Session item to the dropdownlist
dropdownlist.items.add(new listItem(session("DropDowlistItemToAddText"),session("DropDowlistItemToAddValue")))

And then bind the dropdownlist from database
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question