Click here to Skip to main content
15,885,366 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<body>

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

    <link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
        rel="stylesheet" type="text/css" />

    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>

    <link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css"
        rel="stylesheet" type="text/css" />

    <script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js"
        type="text/javascript"></script>

    <script type="text/javascript">
        $(function () {
            $('#<%= lstFruits.ClientID %>').multiselect({
                includeSelectAllOption: true
            });
        });
    </script>

    <form id="form1"  runat="server">
    <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
    
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <contenttemplate>
            <asp:ListBox ID="lstFruits" runat="server" SelectionMode="Multiple">
                <asp:ListItem Text="Mango" />
                <asp:ListItem Text="Apple" />
                <asp:ListItem Text="Banana" />
                <asp:ListItem Text="Guava" />
                <asp:ListItem Text="Orange" />
            
        </contenttemplate>
    
    <asp:Button ID="Button1" Text="Submit" runat="server" OnClick="Submit" />
    </form>
</body>


CS Code :
C#
protected void Submit(object sender, EventArgs e)
    {

        string message = "";
        foreach (ListItem item in lstFruits.Items)
        {
            if (item.Selected)
            {
                message += item.Text + ",";
            }
        }
        message = message.Substring(0, message.Length - 1);
        ScriptManager.RegisterClientScriptBlock((sender as Control), this.GetType(), "a", "alert('" + message + "')", true);

    }


From above code i placed button out from update panel then it working fine.
When i placed inside update panel,
When submit button, then drop down looking like list box from next request.

Can you please help me to come out from this issue.

Is there any possibility / shall i continue the same.

Please copy the code and try you can get more clarification.

Thanks

Its very important to me.
Posted
Updated 18-Dec-14 17:31pm
v2
Comments
[no name] 18-Dec-14 23:01pm    
u can use trigger inside the update panel

1 solution

declare an update trigger and include button into it
 
Share this answer
 

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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