Hi all I have designed a radwindow manager which will have a dropdown and a textbox and a button which are placed inside a update panel.
Every thing works fine but on button click I am closing my window manager as follows
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
But this didn't work can some one help me this is my design and code
<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Behavior="Default"
InitialBehavior="None">
<Windows>
<telerik:RadWindow ID="RadWindow1" runat="server" Behaviors="Default" InitialBehaviors="None"
OpenerElementID="btn" Width="650" Height="480" VisibleOnPageLoad="false">
<ContentTemplate>
<asp:UpdatePanel ID="up" runat="server" OnUnload="up_Unload">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="rdcmb" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="radbtn" EventName="Click" />
</Triggers>
<ContentTemplate>
<telerik:RadComboBox ID="rdcmb" runat="server" AutoPostBack="true" OnSelectedIndexChanged="sel">
<Items>
<telerik:RadComboBoxItem Text="One" Value="One" />
<telerik:RadComboBoxItem Text="Two" Value="Two" />
<telerik:RadComboBoxItem Text="Three" Value="Three" />
<telerik:RadComboBoxItem Text="Four" Value="Four" />
</Items>
</telerik:RadComboBox>
<telerik:RadTextBox ID="rdText" runat="server">
</telerik:RadTextBox>
<telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
</telerik:RadButton>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
<telerik:RadButton ID="rdbtnwhAnother" Text="Add WithHolding" runat="server" ButtonType="LinkButton"
OnClick="rdbtnwhAnother_Click">
</telerik:RadButton>
Code
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
}
}
protected void rdbtnwhAnother_Click(object sender, EventArgs e)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = true;
}
protected void btn_Click(object sender, EventArgs e)
{
RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
}
protected void sel(object sender, EventArgs e)
{
rdText.Text = rdcmb.SelectedItem.Text;
}
protected void up_Unload(object sender, EventArgs e)
{
/* Cast sender as an updatePanel, and use reflection to invoke * * the page's scriptmanger registerUpdatePanel() method * * */
//RadWindowManager1.Windows[0].VisibleOnPageLoad = false;
UpdatePanel aUpdatePanel = sender as UpdatePanel;
MethodInfo m = (
from methods in typeof(ScriptManager).GetMethods(
BindingFlags.NonPublic | BindingFlags.Instance
)
where methods.Name.Equals("System.Web.UI.IScriptManagerInternal.RegisterUpdatePanel")
select methods).First<MethodInfo>();
m.Invoke(ScriptManager.GetCurrent(aUpdatePanel.Page), new object[] { aUpdatePanel });
}
<script type="text/javascript">
function getRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function clientClose(arg) {
getRadWindow().close(arg);
}
</script>
<telerik:RadButton ID="radbtn" runat="server" Text="Save" OnClick="btn_Click">
</telerik:RadButton>
protected void btn_Click(object sender, EventArgs e)
{
string script = "clientClose('');";
ScriptManager.RegisterStartupScript(Page, typeof(Page),
"closeScript", script, true);
}