I have referred to this post as a means to solve my problem:
http://forums.asp.net/p/1154395/1895548.aspx
I realize this post is really old and has been
solved...I also used this code as a starting point for my own
application. Anyways, My App disables all sliders on a report
read-only page.
My code works in Firefox but will not work in IE. I think it is a
issue of when I call this. when my javascript is called the Slider
AJAX Control's events are not properly set up, so when I go to
disable/clear the javascript event handler I recieve an error because
the javascript handler has not been created yet. All of my AJAX
sliders are created dynamically in the Page_Init event. If anyone has
knows at what point in time in the Page Load process that I should be
running my code to disable the sliders please let me know. Thanks in
advance for any help!
I was originally using the ClientScript.registerStartUpScript function but that wasn't working in Firefox.
ASP C# CODE:
//Page_PreRender
protected void Page_PreRender(object sender, EventArgs e)
{
string javascriptToCall = "";
Table table = (Table)plhTable.FindControl("tblEvalFormReport");
//disable all sliders if read only view
if (readOnly)
{
TextBox slider;
//loop through all elements
for (int i = 1; i <= 75; i += 2)
{
//create slider control
slider = EvalForm.findTableControl("q" + i.ToString(), table);
javascriptToCall += "disableSlider('" + slider.ID + "'); ";
}
//Inject onload all disableSliders function calls into onload event
HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("masterbody");
body.Attributes.Add("onload", javascriptToCall);
}
}
public static TextBox findTableControl(string controlID, Table tbl)
{
TextBox control = (TextBox)tbl.FindControl(controlID);
return control;
}
JS CODE:
function disableSlider(slider)
{
//alert(slider);
$clearHandlers($find(slider)._handle);
$clearHandlers($find(slider)._railElement);
}