Add items in Drop Down List or List Box using JavaScript.
<script type="text/javascript"> function AddItem(Text,Value) { // Create an Option object
var opt = document.createElement("option"); // Add an Option object to Drop Down/List Box document.getElementById("DropDownList").options.add(opt);
// Assign text and value to Option object opt.text = Text; opt.value = Value; }<script />
Actually script helped me a lot,when i play around ajax :). thanks to the creator
courtesy:http://chiragrdarji.wordpress.com/2007/06/06/add-items-in-drop-down-list-or-list-box-using-javascript/
If u had any trouble just ask, Happy to help u :)
Stay Tune...
Have a nice day... 'N happy Coding :)
How can this be modified to add items from a sqlite database?
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteUse System.Data.SQLite.SQLiteParameter. Try this out. (I may have some syntax wrong because I'm not able to test this right now...but it should be similar)
ReplyDeleteSQLiteCommand cmd3 = new SQLiteCommand("select distinct(ACTION) from ACTION_LIST where CATEGORY=@category", conn2);
cmd3.Parameters.Add(new SQLiteParameter("@category",comboBox1.Text));