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.
Hello Wayne,
For the ValueChanged client side event should be checked in the ClientEvents node of the markup so for example:<ClientEvents ValueChanged="WebSlider1_ValueChanged" />
So the function should look like this:function WebSlider1_ValueChanged(sender, eventArgs) {
}
The signature is the same for the client events on our current infragistics controls with sender and eventArgs.
When you go to design view of the aspx page in Visual Studio, you can go to properties and then expand ClientEvents. Then scroll down to ValueChanged, open the dropdown, and choose add new handler. The function will be added in the script tag. This is a way to know the signature of the method being called.
Let me know if you have any questions with this matter.
Sincerely,Duane HoytDeveloper Support Engineer, MCTSInfragisticshttp://ko.infragistics.com/support
Thank you for your reply.
However, I can not get the application to execute a postback.
My employer does not want to use client-side scripting; they say if it takes more time to execute, so be it. But I cannot get the postback to execute at all.
That said, I have this setup in test.aspx:
<ig:WebSlider ID="webslider_PriceSlider" runat="server" ContentAlignment="TopOrLeft" EnableTheming="True" Height="60px" Width="275px"> <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>
In the ASP.NET application, I have code for _ValueChanged. For some reason, when the slider value changes, its not being executed. The control lblPriceSlider.Text is not being updated.
protected void webslider_PriceSlider_ValueChanged(object sender, EventArgs e){ lblPriceSlider.Text = webslider_PriceSlider.Value.ToString();}
This is not being executed. the lblPriceSlider is not being updated.
Although my employer does not want client-side scripting, I tried adding Javascript code through VS2008. However, if I try adding a client-side event in Javascript to the code in VS2008 through the webslider control's properties, I get this error:
Failure to add SCRIPT block to page.Please, before using "Add new handler..." option, try to select control differently. For example, click on the border of the control.If it fails as well, then you should type-in the name of a function and add SCRIPT block manually. The javascript block with the implementation of that function should appear within the HEADER of page or at another appropriate location.
With this error, it appears to me there a bug in the webslider control preventing a postback from occuring.
As I said in another post, I took over this project...I am replacing the AJAX slider extender with the NetAdvantage WebSlider control.
Do you see anything obvious?
How can I force a postback? What is the code for a postback?
Please help.
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.
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.
For allowing the control to have a postback all there is needed is to set the AutoPostBackFlags ValueChanged attribute to "On". There is no javascript code needed to perform a postback, only setting some attributes to the control is required.
You can also define the server side event ValueChanged in the page load event:
WebSlider1.ValueChanged += new Infragistics.Web.UI.EditorControls.SliderValueChangedEventHandler(WebSlider1_ValueChanged);
So in the typical asp.net lifecycle the page load event goes first and then the ValueChanged event of the control is after.
If you are still having issues, you can attach a sample to this thread that reproduces the issue you're experiencing and I can take a look at it.
You suggest I should rely on autopostback flags.
However, no postback is being triggered in my codebase. I have proven that be stripping out code to a basic ASP.NET label update within the server side code.
However, If I go with a single form, the postback occurs; but, if I use the ASP.NET page within a web parts framework (within a master page/form), no postback occurs.
But then you say the Page_Load executes before the _ValueChanged event. The Page_Load executes only on the initial page display or is it fired every time the postback takes place on the controls? That could be the issue... Can the Page_load be suppressed by checking the value "ispostback" or need the Page_Load routine be executed? This could resolve our issue - if Page_Load execution can be suppressed.
I hope that helps!
This is just a follow up on the thread on the setup you have in particular for the web parts and master page. How is this created along with the aspx markup?