Click here to Skip to main content
15,905,229 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
hi,
i have two listboxes for my matrimonial website
listbox for "star"
first listbox is lstleftstar
and
second listbox is lstrightstar

i used javascript & jquery for two listbox moving items on mouse doubleclick event

but when i click on submit button for insert the items from lstleftstar to lstrightstar
then that time
nothing is work..
listbox items shows counting "0" items.

i disabled ajax but not work..

my coding is
please just check this code and i copy my main coding here of only listbox and i have doubted..
*********************************
XML
<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;
        }
        function OnRequestStart(target, arguments) {
            if (arguments.get_eventTarget().indexOf("Button1") > -1) {
                arguments.set_enableAjax(false);
            }
        }
    </script>
**************************************************
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    </telerik:RadAjaxManager>
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" Width="100%" ClientEvents-OnRequestStart="OnRequestStart">


<table>
<tr>
                        <td class="table_register2_td_left">
                            &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Star
                        </td>
                        <td>
                            <asp:ListBox ID="lst_leftstar" onDblClick="lst_left_star_DblClicked();" runat="server"
                                Height="100px" Width="180px"></asp:ListBox>
                            <div style="margin-bottom: 0px; display: inline; position: relative; top: -35px;">
                                <img src="images/lr-arrow.gif" alt="" /></div>
                            <asp:ListBox ID="lst_rightstar" onDblClick="lst_right_star_DblClicked();" runat="server"
                                Height="100px" Width="180px"></asp:ListBox>
                        </td>
                    </tr>
</table>

***********************************************
coding is  aspx.cs
===================

problem is here that cant entered in for loop.

Cls_RegisterInfo clsregisterinfo = new Cls_RegisterInfo();
protected void Button1_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        dt.Columns.Add("Star_Id");

        for (int i = 0; i < lst_rightstar.Items.Count; i++)
        {
            dt.Rows.Add("");

            dt.Rows[i]["Star_Id"] = lst_rightstar.Items[i].Value;
        }

        clsregisterinfo.Dtstd = dt;				pass items in class file  clsregisterinfo
        clsregisterinfo.insert_profile_star();			its a class file method insert_profile_star();
    }


==> how to do ??
Posted
Updated 25-Feb-14 1:00am
v2
Comments
ZurdoDev 25-Feb-14 7:36am    
Where are you stuck?
Manish Dalwadi 25-Feb-14 7:52am    
dr.
coding for insert is perfect

if i used two buttons for moving items then that time this coding is perfectly running and inserting selected items in database

but here
when i click on submit button for insert listbox item
that time problem occured...
because..
i used javascript for moving listbox item (on doubleclick event move items)
so when i submit items not pass in serverside..
Herman<T>.Instance 26-Feb-14 6:47am    
also use javascript to subit because the server controls do not know that they were updated only on the clientside
Manish Dalwadi 26-Feb-14 7:02am    
tried but not success..
if any code then please tell me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900