View Full Version : Change coolite control state while in UpdatePanel async postback

May 03, 2008, 5:36 PM
Suggesting the following code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Coolite.Web.UI" Namespace="Coolite.Web.UI" TagPrefix="cool" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script language="CS" runat="server">
protected void Button1_Click(object sender, EventArgs e)
Label1.Text += "A ";
Label2.Text += Label1.Text;
protected void Button2_Click(object sender, EventArgs e)
FieldSet1.Collapsed = false;
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<cool:ScriptManager ID="ScriptManager2" runat="server" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button1" />
<cool:Panel ID="Panel1" runat="server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Label ID="Label1" runat="server" Height="30px" Text="Label" Width="61px"></asp:Label>
<asp:Button ID="Button2" runat="server" OnClick="Button2_Click" Text="Button2" CausesValidation="False" />
<cool:FieldSet ID="FieldSet1" runat="server" Collapsible="True" Width="200px" Collapsed="True">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<asp:Label ID="Label2" runat="server" Height="35px" Text="Label" Width="78px"></asp:Label>
<asp:AsyncPostBackTrigger ControlID="Button1" />


How can I make Button2 (nested in an UpdatePanel) expand (uncollapse) FieldSet1 from code behind?

Jun 04, 2008, 10:28 PM
Hi omeriko9,

With the latest version 0.5 build, I think your sample will work with one small modification... you should call the .Collapse() method on FieldSet1.


protected void Button2_Click(object sender, EventArgs e)

Hope this helps.