Show Radwindow on submit click

6 posts, 1 answers
  1. Naresh
    Naresh avatar
    10 posts
    Member since:
    Aug 2013

    Posted 21 Nov 2013 Link to this post

    Hi I want to show Radwindow on submit click. can any one please send me server side code on click event.

    Thanks,
    Naresh
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 21 Nov 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Naresh
    Naresh avatar
    10 posts
    Member since:
    Aug 2013

    Posted 22 Nov 2013 Link to this post

    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.

     

     

     

  5. Naresh
    Naresh avatar
    10 posts
    Member since:
    Aug 2013

    Posted 22 Nov 2013 Link to this post

    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;

    }

  6. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 25 Nov 2013 Link to this post

    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.  
  7. Naresh
    Naresh avatar
    10 posts
    Member since:
    Aug 2013

    Posted 05 Dec 2013 Link to this post

    Thanks Shinu.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017