?
Solved

How to intialize dropdownlist with Session variable in a formview control

Posted on 2009-04-05
2
Medium Priority
?
924 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

800 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