.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

how to insert data into dropdown list in asp

Posted By: pradeep     Posted Date: February 25, 2010    Points:2   Category :ASP.Net
hi
in my asp application i have one textbox and one dropdown list control and submit button there my requirement is i will enter some data in textbox after clicking submit button my data should have to appear in dropdown list.any one plz give immediate reply.........

Responses
Author: Santosh             
Posted Date: February 26, 2010     Points: 5   

hi pradeep

it's very simple to add the text values in dropdownlist

inside the button click write the below code


dropdownlist1.items.add(textbox1.text)


regards
Santosh

Author: Sagar Pardeshi             
Posted Date: February 26, 2010     Points: 5   
Author: TotalDotNet             
Posted Date: August 16, 2010     Points: 5   


Try using following code or use http://www.totaldotnet.com/ASPBASICCONTROLS/Properties_Demo/Prop_selectindex.aspx
protected void Button_Click(object sender, EventArgs e)
{
if (!IsPostBack)
{
dopdownlist1.Items.Add("Other Activities");
}
}




Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend