I have an application with five webslider controls on one screen. Each has "ValueChanged" set to ON. I am using VS2008 (with SP1).
I have code associated with each _ValueChanged(object sender, EventArgs e) event - but the code does not appear to be executing; I added a pop-up message when the event-routine is executed and the pop-up never occurs.
How do you recommend I troubleshoot this further?
Should I delete the code for ValueChanged event and setup the ValueChanged events again?
ADDED: I changed the ValueChanged property from ON to ASYNC and that helped resolve the issue.
ADDED: I thought at one point this was resolved but it is still an open-issue. Please read my reply below.
Thank you for your previous post.
I traced the above compilation error to a reference "webSlider1" instead of "webslider1". I made that change and the run-time compilation error went away.
However, I am still "stuck." I have proven to myself at least that the "postback" operation is not happening.
The previous developer used the web slider extender from the CodePlex Ajax Toolkit. The form had five sliders and movement in any one handle triggered a SQL script on the server (there is a 3-5 second pause).
When I replaced the five web slider extenders with Infragistics'webslider controls, I am now not getting the SQL script triggered on the server. I put a "message" in the _ValueChanged event and the "message" does not appear, implying the code in the _ValueChanged event is not being called by the "postback" operation.
The message I added was essentially modifying the text in a label control - which was different text for each of the five webslider controls.
Let me ask you this. Is it possible the postback operation is triggering a "page_load" event instead of the "_ValueChanged" event?
Have you any suggestions or ideas?
Should I perform a javascript "postback"?
Please reply.
Thank you for your reply.
However, I am now getting a run-time compiler error:
Compilation ErrorDescription: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.Compiler Error Message: CS1061: 'ASP.test_aspx' does not contain a definition for 'webslider1_ValueChanged' and no extension method 'webslider1_ValueChanged' accepting a first argument of type 'ASP.test_aspx' could be found (are you missing a using directive or an assembly reference?)
I updated my markup to this:
<ig:WebSlider ID="webslider1" runat="server" ContentAlignment="TopOrLeft" EnableTheming="True" Height="60px" Width="275px" OnValueChanged="webslider1_ValueChanged"> <ClientEvents ValueChanged="webslider1_ValueChanged" /> <Thumb ImageUrl="~/Images/slider_handle.gif" FocusImageUrl="~/Images/slider_handle.gif" HoverImageUrl="~/Images/slider_handle.gif" PressedImageUrl="~/Images/slider_handle.gif" /> <AutoPostBackFlags ValueChanged="Async" /></ig:WebSlider>
Having "clientevents", I kept my javascript function header but left the function empty:
function webslider1_ValueChanged(sender, e) { }
Should I remove the "clientevents" attribute and javascript function all together?
My "heading" in the markup test.aspx has this:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="test.aspx.cs" MasterPageFile="~/Masterpages/ApplicationMaster.master" Inherits="EcoMethod.Web.EcoManagement" %><%@ MasterType VirtualPath="~/MasterPages/ApplicationMaster.master" %>
<%@ Register assembly="Infragistics35.Web.v10.2, Version=10.2.20102.2101, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.EditorControls" tagprefix="ig" %>
In the file test.aspx.cs, I have this code:
protected void webSlider1_ValueChanged(object sender, Infragistics.Web.UI.EditorControls.SliderValueChangedEventArgs e){ lblwebslider1.Text = webslider1.Value.ToString();}
I believe this solution should have worked. But instead, the code returns the run-time compiler error mentioned above (CS1061) on execution. What did I miss?
Please help me get this "right"; my boss has had his patience tested.
Once again, thank you.
Hello Wayne,
For markup of the WebSlider should look like this:
Currently you have the client event for ValueChanged defined however OnValueChanged needs to be defined as well. Also the code you have for the javascript function webslider1_ValueChanged is not required for a postback. The control should automatically postback and do the asynchronous operation.
Let me know if you have any questions with this matter.
Sincerely,Duane HoytDeveloper Support Engineer, MCTSInfragisticshttp://ko.infragistics.com/support
I believe the error is in the javascript code I added to force a postback. We need the "postback" to work within asp.net web-parts. It is crucial.
The previous developers (contractors; off-shore outsource) created this application and are no longer associated with the company; they used asp.net web-parts and have a master page (with it named "form1"). I believe that framework could be part of this problem.
The markup looks like this:
<ig:WebSlider ID="webslider1" runat="server" ContentAlignment="TopOrLeft" EnableTheming="True" Height="60px" Width="275px" > <ClientEvents ValueChanged="webslider1_ValueChanged" /> <Thumb ImageUrl="~/Images/slider_handle.gif" FocusImageUrl="~/Images/slider_handle.gif" HoverImageUrl="~/Images/slider_handle.gif" PressedImageUrl="~/Images/slider_handle.gif" /> <AutoPostBackFlags ValueChanged="Async" /></ig:WebSlider><asp:Label Font-Bold="True" Font-Size="12px" ForeColor="Black" ID="lblPriceSlider" runat="server" BorderStyle="None"></asp:Label>
The C# code in the application looks like this:
protected void webslider1_ValueChanged(object sender, Infragistics.Web.UI.EditorControls.SliderValueChangedEventArgs e) { lblPriceSlider.Text = webslider1.Value.ToString(); }
Following your earlier advice, I added postback code. For the "postback:, I am using this code in the markup page:
function webslider1_ValueChanged(sender, e) { var theform = document.forms("form1"); theform.__EVENTTARGET.value = sender; theform.__EVENTARGUMENT.value = e; theform.submit(); }
I sense there is a disconnect. I am repeatedly getting "object required" on the call to javascript function. Could that be another problem? I need two parameters (sender and e). Could it be I am missing the parameters in the attribute definition?
Is there any chance of getting autopostback to work?
Please help.
Thank you.
However, if I move the ValueChanged="WebSlider1_ValueChanged" after the "width" attribute (as you recommended) I get a compiler "message" saying: "Validation (ASP.Net): Attribute 'ValueChanged' is not a valid attribute of element 'WebSlider'."
Following your advice, I added postback code. For the "postback:, I am using this code in the markup page:
function webslider1_ValueChanged(sender, e) { var theform = document.forms("form1"); theform.__EVENTTARGET.value = sender; theform.__EVENTARGUMENT.value = e; theform.submit(); }(form1 is the name of the master form in web-parts.) Does that "postback" code look OK?
I am still "stuck", trying a combination of your suggestions but I wanted to reply with this right away...