?
Solved

scriptmanager in conjunction with toolkitscriptmanager using UpdatePanel

Posted on 2010-01-12
4
Medium Priority
?
1,497 Views
Last Modified: 2013-11-26
I need some help here.
I have a page which I am using the ToolkitScriptManager for the use of some AJAX Calendar Control Extenders, and that works fine.
Where I am running into a problem is using the UpdatePanel. I am not getting a partial or any postback on a listbox control. I have attached snippets of my code. How it is supposed to work is when a user clicks on an item in the Listbox it should update the lblLeads Label. Of course it should do this using Ajax, without doing a Postback noticeable to the user.

I have tried adding the regular ScriptManager and I get errors and when I have both of them loaded, ToolkitScriptManager and ScriptManager, I get an error saying that you can only have one Scriptmanager on the page.

Please help.

Thanks in advance.
<body>
<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
</asp:ToolkitScriptManager>

little further down... 

[List box code]
<td class="style7">
&nbsp;<asp:ListBox ID="ListBox1" runat="server" SelectionMode="Multiple" Width="199px" DataSourceID="ObjectDataSource2" DataTextField="Col001" 
DataValueField="Col001"                onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>
</td>

little bit further down...

[Update Panel code]
<td colspan="3">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblLeads" runat="server" Font-Bold="True" ForeColor="Red"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="ListBox1" />
</Triggers>
</asp:UpdatePanel>
</td>

[Code Behind for ListBox]
protected void ListBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            string myLeads = "";

            for (int i = 0; i < ListBox1.Items.Count; i++)
            {
                if (ListBox1.Items[i].Selected)
                {
                    myLeads += ListBox1.Items[i].Value + ", ";
                }
            }

            if (myLeads.Length > 0)
            {
                myLeads = myLeads.Substring(0, myLeads.Length - 2);
            }

            lblLeads.Text = myLeads;
        }

Open in new window

0
Comment
Question by:jljaleahy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 26

Expert Comment

by:Shaun Kline
ID: 26298042
List boxes do not cause a postback unless you specifically mark them with the AutoPostBack="True" property.
0
 

Author Comment

by:jljaleahy
ID: 26298084
Shaun,

Thanks for the quick response. I set that propert to true before, but failed to mention it in the post.

the problem with setting it to true, is that I get a regular postback, not an AJAX type postback, which I am looking for.

Any help is appreciated.

Thansk again.
0
 
LVL 26

Accepted Solution

by:
Shaun Kline earned 2000 total points
ID: 26323290
Instead of a postback trigger, try an asyncpostback trigger.
<asp:AsyncPostBackTrigger ControlID="ListBox1" EventName="SelectedIndexChanged" />
(This worked with the asp.net script manager.)
0
 

Author Closing Comment

by:jljaleahy
ID: 31676370
Thanks Shaun,
I had tried the Async but not in conjuction with the autopostback = true.

Thanks again.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question