4 Answers, 1 is accepted
0
Hello Ken,
Please, find attached a sample page which demonstrates collapsing/expanding a dock client-side when clicking on a button. I tested the attached page with the latest release and was not able to reproduce the problem you describe. If you call get_collapsed() on an asp button click and you do not want a postback ocurring you need to return false afterwards.
I would like to request for more details about the scenario in which the problem you mention appears and a list of steps to reproduce the problem. It would be best if you send us your test page so that we can take a closer look at your code and get a better idea of the problem.
All the best,
Sophy
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Please, find attached a sample page which demonstrates collapsing/expanding a dock client-side when clicking on a button. I tested the attached page with the latest release and was not able to reproduce the problem you describe. If you call get_collapsed() on an asp button click and you do not want a postback ocurring you need to return false afterwards.
I would like to request for more details about the scenario in which the problem you mention appears and a list of steps to reproduce the problem. It would be best if you send us your test page so that we can take a closer look at your code and get a better idea of the problem.
All the best,
Sophy
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
David
Top achievements
Rank 1
answered on 18 Apr 2008, 04:02 PM
I reverted back to the old Prometheus controls and everything worked perfectly. This is a somewhat complex implementation. I will examine your example to see if I have missed anything. Below are code samples.
**********************************************************
Javascript:
***************************************
C#
**********************************************************
Javascript:
function btnExpand_ONCLICK(var1, var2) |
{ |
if(var1 == "widgetSetup") { |
var dock1 = $find("<%= rdzMain.FindControl("widgetSetup").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
var randomTest = "HELLO"; |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetSetup_T_PanelExpandTest").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetSetup_T_PanelCollapseTest").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("setupState", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetSetup_T_PanelExpandTest").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetSetup_T_PanelCollapseTest").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("setupState", "off", 100); |
} |
} else if(var1 == "widgetFlow") { |
var dock1 = $find("<%= rdzMain.FindControl("widgetFlow").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetFlow_T_PanelExpandTest").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetFlow_T_PanelCollapseTest").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("flowState", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetFlow_T_PanelExpandTest").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetFlow_T_PanelCollapseTest").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("flowState", "off", 100); |
} |
} else if(var1 == "widgetDayTime") { |
var dock1 = $find("<%= rdzMain.FindControl("widgetDayTime").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetDayTime_T_PanelExpandTest").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetDayTime_T_PanelCollapseTest").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("daytimeState", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetDayTime_T_PanelExpandTest").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetDayTime_T_PanelCollapseTest").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("daytimeState", "off", 100); |
} |
} else if(var1 == "widgetStations") { |
var dock1 = $find("<%= rdzMain.FindControl("widgetStations").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetStations_T_PanelExpandTest").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetStations_T_PanelCollapseTest").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("stationsState", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetStations_T_PanelExpandTest").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetStations_T_PanelCollapseTest").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("stationsState", "off", 100); |
} |
} else if(var1 == "widgetCustomPlants") { |
var dock1 = $find("<%= rdzMain.FindControl("widgetCustomPlants").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetCustomPlants_T_PanelExpandTest").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetCustomPlants_T_PanelCollapseTest").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("customplantsState", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetCustomPlants_T_PanelExpandTest").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetCustomPlants_T_PanelCollapseTest").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("customplantsState", "off", 100); |
} |
} else if(var1 == "widgetUserMode") { |
var dock1 = $find("<%= FindControlRecursive(rdzMain.FindControl("widgetStations"), "rdzStations").FindControl("widgetUserMode").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetUserMode_T_PanelExpandTestSub").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetUserMode_T_PanelCollapseTestSub").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("widgetUserMode", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetUserMode_T_PanelExpandTestSub").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetUserMode_T_PanelCollapseTestSub").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("widgetUserMode", "off", 100); |
} |
} else if(var1 == "widgetAutoMode") { |
var dock1 = $find("<%= FindControlRecursive(rdzMain.FindControl("widgetStations"), "rdzStations").FindControl("widgetAutoMode").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetAutoMode_T_PanelExpandTestSub").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetAutoMode_T_PanelCollapseTestSub").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("widgetAutoMode", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetAutoMode_T_PanelExpandTestSub").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetAutoMode_T_PanelCollapseTestSub").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("widgetAutoMode", "off", 100); |
} |
} else if(var1 == "widgetOffMode") { |
var dock1 = $find("<%= FindControlRecursive(rdzMain.FindControl("widgetStations"), "rdzStations").FindControl("widgetOffMode").ClientID %>"); |
var Collapsed = dock1.get_Collapsed(); |
if(Collapsed) |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetOffMode_T_PanelExpandTestSub").style.display = "none"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetOffMode_T_PanelCollapseTestSub").style.display = "inline"; |
dock1.set_Collapsed(false); |
SetCookie("widgetOffMode", "on", 100); |
} |
else |
{ |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetOffMode_T_PanelExpandTestSub").style.display = "inline"; |
document.getElementById("ctl00_containerMain_widgetStations_C_ctl00_widgetOffMode_T_PanelCollapseTestSub").style.display = "none"; |
dock1.set_Collapsed(true); |
SetCookie("widgetOffMode", "off", 100); |
} |
} |
return false; |
} |
***************************************
C#
for (int i = 0; i < alWidgetList.Count; i++) |
{ |
WidgetObj woAlert = (WidgetObj)alWidgetList[i]; |
//Adding the widget |
RadDock rdoAlert = new RadDock(); |
rdoAlert.Text = woAlert.title; |
rdoAlert.ID = woAlert.uID; |
rdoAlert.UniqueName = woAlert.uID; |
rdoAlert.Width = Unit.Percentage(100); |
rdoAlert.DefaultCommands = Telerik.Web.UI.Dock.DefaultCommands.None; |
rdoAlert.ToolTip = woAlert.toolTip; |
rdoAlert.Title = woAlert.title; |
rdoAlert.AutoPostBack = false; |
rdoAlert.EnableDrag = false; |
Panel pnlExpand = new Panel(); |
pnlExpand.ID = "PanelExpandTest"; |
string displayState = setInitialPanelVisibilityFromCookies(woAlert.uID); |
string inverseDisplayState; |
if (displayState == "none") |
{ |
inverseDisplayState = "inline"; |
} |
else |
{ |
inverseDisplayState = "none"; |
} |
pnlExpand.Style.Add("display", displayState); |
//Should check the current state of the cookie and toggle the panel accordingly |
Panel pnlCollapse = new Panel(); |
pnlCollapse.ID = "PanelCollapseTest"; |
pnlCollapse.Style.Add("display", inverseDisplayState); |
ImageButton btnDocExpandTest = new ImageButton(); |
btnDocExpandTest.ImageUrl = "Vista/Dock/rdExpand.gif"; |
btnDocExpandTest.AlternateText = "ExpandTest"; |
btnDocExpandTest.ID = woAlert.title + "ExpandTest"; |
const string onClientClick1 = "btnExpand_ONCLICK('{0}', '{1}'); return false;"; |
btnDocExpandTest.OnClientClick = string.Format(onClientClick1, rdoAlert.ClientID, "blue"); |
pnlExpand.Controls.Add(btnDocExpandTest); |
ImageButton btnDocCollapseTest = new ImageButton(); |
btnDocCollapseTest.ImageUrl = "Vista/Dock/rdCollapse.gif"; |
btnDocCollapseTest.AlternateText = "CollapseTest"; |
btnDocCollapseTest.ID = woAlert.title + "CollapseTest"; |
const string onClientClick2 = "btnExpand_ONCLICK('{0}', '{1}'); return false;"; |
btnDocCollapseTest.OnClientClick = string.Format(onClientClick2, rdoAlert.ClientID, "blue"); |
pnlCollapse.Controls.Add(btnDocCollapseTest); ...... |
0
Accepted
Hi Ken,
Thank you for the provided code. I tried to simulate your scenario using the code snippets you have sent us but I was not able to reproduce the problem you experience. Please, note that the get_Collapsed() and set_Collapsed() are replaced with get_collapsed() and set_collapsed() in the latest client-side API of the RadDock for ASP.NET AJAX. Please, try to change the names of these functions with the correct ones and let me know whether the problem still exists. You can take a look at the RadDock Client Object help article for reference to the client-side API of the RadDock.
Greetings,
Sophy
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
Thank you for the provided code. I tried to simulate your scenario using the code snippets you have sent us but I was not able to reproduce the problem you experience. Please, note that the get_Collapsed() and set_Collapsed() are replaced with get_collapsed() and set_collapsed() in the latest client-side API of the RadDock for ASP.NET AJAX. Please, try to change the names of these functions with the correct ones and let me know whether the problem still exists. You can take a look at the RadDock Client Object help article for reference to the client-side API of the RadDock.
Greetings,
Sophy
the Telerik team
Instantly find answers to your questions at the new Telerik Support Center
0
Accepted
David
Top achievements
Rank 1
answered on 21 Apr 2008, 03:38 PM
Thanks changing the case on collapsed fixed it!