This is a migrated thread and some comments may be shown as answers.

Show Radwindow on submit click

5 Answers 151 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Naresh
Top achievements
Rank 1
Naresh asked on 22 Nov 2013, 02:24 AM
Hi I want to show Radwindow on submit click. can any one please send me server side code on click event.

Thanks,
Naresh

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 22 Nov 2013, 02:50 AM
Hi Naresh,

Please have a look into the following code snippet to show a RadWindow on OnClick event of RadButton. 

ASPX:
<telerik:RadButton ID="RadButton1" runat="server" Text="Show RadWindow" OnClick="RadButton1_Click">
</telerik:RadButton>

C#:
protected void RadButton1_Click(object sender, EventArgs e)
{
    RadWindow window = new RadWindow();
    Label lbl = new Label();
    lbl.Text = "RadWindow";
    window.ContentContainer.Controls.Add(lbl);
    window.VisibleOnPageLoad = true;
    form1.Controls.Add(window);
}

Hope this will helps you.
Thanks,
Shinu.
0
Naresh
Top achievements
Rank 1
answered on 22 Nov 2013, 12:51 PM
I already have that radwindow on aspx and

RadWindow1.VisibleOnPageLoad = true; on code behind, problem with this is my webpage will be back again when I click on any UI control it popsup again.

 

 

 

0
Naresh
Top achievements
Rank 1
answered on 22 Nov 2013, 02:55 PM
Hi Shinu,
here is the code that I have
every time click on edit from radgrid radwindow pops.
UI:

<

 

 

form id="form1" runat="server">

 

<asp:ScriptManager runat="server"></asp:ScriptManager>

 

<asp:UpdatePanel runat="server">

 

<ContentTemplate>

 

<asp:Label ID="Label1" runat="server" Text="Label" Visible="false"></asp:Label>

 

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource"

 

AllowPaging="true">

 

<MasterTableView DataKeyNames="ID" CommandItemDisplay="Top">

 

<Columns>

 

<telerik:GridEditCommandColumn>

 

</telerik:GridEditCommandColumn>

 

<telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="ID"></telerik:GridBoundColumn>

 

<telerik:GridTemplateColumn>

 

<ItemTemplate>

 

<asp:CheckBox ID="CheckBox1" runat="server" />

 

</ItemTemplate>

 

</telerik:GridTemplateColumn>

 

</Columns>

 

</MasterTableView>

 

</telerik:RadGrid>

 

</ContentTemplate>

 

</asp:UpdatePanel>

 

<asp:UpdatePanel runat="server">

 

<ContentTemplate>

 

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />

 

</ContentTemplate>

 

</asp:UpdatePanel>

 

<asp:UpdatePanel ID="Updatepanel1" runat="server">

 

<ContentTemplate>

 

<telerik:RadWindowManager ID="radwinmgr" runat="server">

 

<Windows>

 

<telerik:RadWindow ID="RadWindow1" runat="server">

 

<ContentTemplate>

 

<center><h1>Submission Report</h1>

The following elections have been made to your account for fixed income elections. Please read

 

<br />

 

<table style="width: 700px;">

 

<tr>

 

<h2>Election (Level Election)</h2>

 

<br />

 

</tr>

 

<tr>

 

<asp:CheckBox ID="CheckBox2" runat="server" Text="Premium - Default"></asp:CheckBox><br />

 

<asp:CheckBox ID="CheckBox3" runat="server" Text="Do not Premium"></asp:CheckBox>

 

</tr>

 

</table>

 

</center>

 

</ContentTemplate>

 

</telerik:RadWindow>

 

</Windows>

 

</telerik:RadWindowManager>

 

</ContentTemplate>

 

</asp:UpdatePanel>

 

</form>

Code behind:

 

 

 

 

 

 

protected void Button1_Click(object sender, EventArgs e)

{

RadWindow1.VisibleOnPageLoad =

 

 

 

 

 

true;

}

 

 

 

 

 

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

{

 

 

 

 

 

dynamic data1 = new[] {

 

 

 

 

 

new { ID = 1, Name ="Name_1",Customdate = DateTime.Now},

 

 

 

 

 

new { ID = 2, Name = "Name_2",Customdate = DateTime.Now},

 

 

 

 

 

new { ID = 3, Name = "Name_3",Customdate = DateTime.Now},

 

 

 

 

 

new { ID = 4, Name = "Name_4",Customdate = DateTime.Now},

 

 

 

 

 

new { ID = 5, Name = "Name_5",Customdate = DateTime.Now}

};

RadGrid1.DataSource = data1;

}

0
Accepted
Shinu
Top achievements
Rank 2
answered on 25 Nov 2013, 09:30 AM
Hi Naresh,

Since you are setting VisibleOnPageLoad property of RadWindow  to true, it will open every postback. So one suggestion is that you can call the client side function to show the RadWindow. Please have a look into the following code snippet which works fine at my end.

C#:
protected void Button1_Click(object sender, EventArgs e)
{
    string script = "function f(){showWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true); 
}

JavaScript:
<script type="text/javascript">
    function showWindow() {
        var win = $find("<%=RadWindow1.ClientID %>");
        win.Show();
    }
</script>

Hope this will helps you.
Thanks,
Shinu.  
0
Naresh
Top achievements
Rank 1
answered on 05 Dec 2013, 03:45 PM
Thanks Shinu.
Tags
Ajax
Asked by
Naresh
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Naresh
Top achievements
Rank 1
Share this question
or