Urgent listbox values in Server side.
-
I have moved the values from one listbox to another listbox by using Javascript. How can I reterive the values from the second listbox in server side ie., code behind? Because i will store the selected values in DB. Assume that the First listbox ------------- Raja Jayaraj Meena Rupa Kannan Radha I Moved the Meena , Kannan to Second Listbox Second Listbox ------------- Meena Kannan In Add_Click I have to assign the values in a string in comma separation For example string m_Names; m_Names=Meena,Kannan;
-
I have moved the values from one listbox to another listbox by using Javascript. How can I reterive the values from the second listbox in server side ie., code behind? Because i will store the selected values in DB. Assume that the First listbox ------------- Raja Jayaraj Meena Rupa Kannan Radha I Moved the Meena , Kannan to Second Listbox Second Listbox ------------- Meena Kannan In Add_Click I have to assign the values in a string in comma separation For example string m_Names; m_Names=Meena,Kannan;
hey guy just use the datareader and insert add the item of one listbox like dim dr as dataadapter cmd.commandtext="select ur datatable" dr.open dr=cmd.executereader dr.read listbox2.text=add.item("datacolumnname") dr.close lucky
-
hey guy just use the datareader and insert add the item of one listbox like dim dr as dataadapter cmd.commandtext="select ur datatable" dr.open dr=cmd.executereader dr.read listbox2.text=add.item("datacolumnname") dr.close lucky
The above method doesnt looks to be efficient. Since it will call for a postbacl each time... Try this. Listbox sends "all" the selected values as postback to the server side. This hint is enough to get the job done [:)]. So what u need to do is... 1.. before form submit, u need to selecte all the items in the listbox from which u want to read the values. (this will be done in javascript) 2...string str = Request.Form["MySelectedListBox"] 3... "str" will contain "values" of al the items as csv. 4.. string []selectedItems = str.split(','); 5...foreach(string strItem in selectedItems) { //Insert into database. } Please grade the reply.. in case it helped you. Thanks.