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://es.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.
In the markup for the WebSlider control you can set the attribute OnValueChanged to the event handler name after Width so in this example will be:
OnValueChanged="WebSlider1_ValueChanged"
The actual signature of the method should be object sender and SliderValueChangedEventArgs e:
protected void WebSlider1_ValueChanged(object sender, Infragistics.Web.UI.EditorControls.SliderValueChangedEventArgs e){ }
protected void WebSlider1_ValueChanged(object sender, Infragistics.Web.UI.EditorControls.SliderValueChangedEventArgs e){
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?
Yes the most straightforward way is to set the AutoPostBack flag for ValueChanged attribute to "On".
Part of the ASP.NET lifecycle, Page Load always gets executed by every postback. The IsPostBack is just a property that returns whether a postback has occurred.
What's the aspx markup that you have setup for the web parts and the master page? It would help to troubleshoot and look into it further by knowing how the page is setup.
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!
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.
Although you replied and offered valuable input, as you can see I am still "stuck" on the postback.
Have you any update?
Thank you.