troubleshooting Question

Opening a window using javascript

Avatar of AnneSKS
AnneSKS asked on
4 Comments1 Solution295 ViewsLast Modified:
I have a radwindow that I want to open when I click on a button in a listview.
I also have parameters to send to the window using a querystring.
I am calling a javascript function to open the radwindow, from the code behind, where I send a parameter to construct the query string.

So far, I have everything working except that the rad window is only opening on the second click.

Thank you for your help

This is the page with the list view and the button to open the radwindow:
The button to open the radwindow is called: btnUpload, and call the btnUpload_OnCommand function to trigger the javascript function ShoweditForm:
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="RadWindow.aspx.cs" Inherits="TESTING.RadWindow" %>

<%@ Register tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"%>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">

<telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
    <script type="text/javascript">
        function ShowEditForm(id) {
            window.radopen("FileUpload.aspx?ID=" + id, "UserListDialog");
            return false;

        function refreshGrid() {
                $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
        <telerik:ajaxsetting ajaxcontrolid="RadAjaxManager1"/>

<telerik:RadAjaxLoadingPanel runat="server" ID="gridLoadingPanel"/>

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true"  Height="500px" Width="520px" Title="Attach/Remove file(s)" VisibleStatusbar="false"  Modal="true" />

<telerik:RadListView ID="LV" runat="server"  DataKeyNames="ID" OnNeedDataSource="LV_NeedDataSource" >
        <fieldset style="border: none;" >
            <table cellpadding="0" cellspacing="0"   >
                        <asp:Label ID="lblID" runat="Server" Text='<%# Eval("ID") %>' />
                        <asp:TextBox ID="txtMCDesc" runat="Server" Text='<%# Eval("MCDesc") %>' />
                        <telerik:RadButton ID="btnUpload"  Text="Attach/remove file(s)" runat="server" Skin="Metro" Width="130px"  AutoPostBack="true" OnClick="btnUpload_OnCommand"/>        


The C# code, that sends the parameter and call the javascript function is:
        protected void btnUpload_OnCommand(object sender, EventArgs e)
            RadButton btnUpload = (RadButton)sender;
            RadListViewDataItem Item = (RadListViewDataItem)((RadButton)sender).NamingContainer;
            int ID = int.Parse(((Label)Item.FindControl("lblID")).Text.ToString());
            btnUpload.Attributes["href"] = "javascript:void(0);";
            btnUpload.Attributes["Onclick"] = String.Format("return ShowEditForm('{0}');", ID);
Join our community to see this answer!
Unlock 1 Answer and 4 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros