Get value from control
-
Hi all, i have a aspx:text box, aspx:list box and an html button in my webform and when the user type something in the text box and click this value will be added to the list box, i have used javascript for this. now my problem is that, when i tried to take the items in the listbox in csharp code ( in submit button click), i dont get any value ( listbox.items.count shows zero). How can i get the values of this list box at server side code that i have populated at the client side? anyone please help me. Thanks in Advance... Regards, Ali
-
Hi all, i have a aspx:text box, aspx:list box and an html button in my webform and when the user type something in the text box and click this value will be added to the list box, i have used javascript for this. now my problem is that, when i tried to take the items in the listbox in csharp code ( in submit button click), i dont get any value ( listbox.items.count shows zero). How can i get the values of this list box at server side code that i have populated at the client side? anyone please help me. Thanks in Advance... Regards, Ali
post your code how you add the items to the list
Eric H.
-
post your code how you add the items to the list
Eric H.
function AddToList() { optn = new Option(); optn.text = document.forms[0].txtMonth.value; optn.value = optn.text; document.forms[0].listBox1.options.add(optn); } this is the code to add items to list box from textboc txtMonth.
-
function AddToList() { optn = new Option(); optn.text = document.forms[0].txtMonth.value; optn.value = optn.text; document.forms[0].listBox1.options.add(optn); } this is the code to add items to list box from textboc txtMonth.
- I try you code and it doesn't work. 2) Protected Sub Submit1_ServerClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit1.ServerClick MsgBox(listBox1.SelectedItem.Text) End Sub I hope that I understood what you meant
Eric H.