manish dalwadi

manish dalwadi

  • NA
  • 93
  • 3.3k

insert listbox items in database using javascript

Feb 26 2014 2:45 AM
hi,
i used javascript(on double click) for moving items from first listbox to second listbox..
and want to second listbox items store in database
but i am fail to do this..
hard work and hard search i ask you here.
so please help me...i need the solution for my site..

i have two tables
1) star_master
and
2) profile_star


two listboxes
1) lst_leftstar
2) lst_rightstar

lst_leftstar is display(load) from star_aster table
and lst_rightstar will be blank..

select(doubleclcik on) items for move items lst_leftstar to lst_rightstar
and lst_rightstar items will be store in database....
i tried too much..but my coding is failed here...
coz when i click on submit button "lst_rightstar" show me 0 items in loop.
my javascript coding is :=
 
 
 
<script type="text/javascript"> /* star */
function lst_left_star_DblClicked() {
var left_lst = document.getElementById("<%=lst_leftstar.ClientID%>");
var right_lst = document.getElementById("<%=lst_rightstar.ClientID%>");
for (var i = 0; i < left_lst.length; i++) {
if (left_lst.options[i].selected == true) {
right_lst.options[right_lst.length] =
new Option(left_lst.options[i].text,
left_lst.options[i].value);
left_lst.options[i] = null;
i = i - 1;
}
}
return;
}
</script>
<script type="text/javascript">
function lst_right_star_DblClicked() {
var left_lst = document.getElementById("<%=lst_leftstar.ClientID%>");
var right_lst = document.getElementById("<%=lst_rightstar.ClientID%>");
for (var i = 0; i < right_lst.length; i++) {
if (right_lst.options[i].selected == true) {
left_lst.options[left_lst.length] = new Option(right_lst.options[i].text, right_lst.options[i].value);
right_lst.options[i] = null;
i = i - 1;
}
}
return;
}
</script>
<asp:ListBox ID="lst_leftstar" onDblClick="lst_left_star_DblClicked();" runat="server"
Height="100px" Width="180px"></asp:ListBox>
<asp:ListBox ID="lst_rightstar" onDblClick="lst_right_star_DblClicked();" runat="server"
Height="100px" Width="180px"></asp:ListBox>
 
 .............
please tell me how can i stored my listbox items in database.
i tried but not success...
please tell me how can i insert this listbox data in database..
please give me simple coding