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

Ajaxify javascript window

2 Answers 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Smiely
Top achievements
Rank 1
Smiely asked on 31 Jan 2011, 09:24 PM
I have a grid with image button column. On Client click I want to open window with some data from another class. The following code does that but need to click button twice. I just can not fugure out wants wrong. Please help.
.cs
if (e.CommandName == "viewQuals")
            {
                GridDataItem dataItem = (GridDataItem)e.Item;
                int id = int.Parse(dataItem["EIDColumn"].Text);
                ImageButton updateButton = dataItem["viewQualsColumn"].Controls[0] as ImageButton;
                updateButton.OnClientClick = "return viewQualsClick(" + id + ")";
               }
.aspx
function viewQualsClick(id) {
                  
                window.open("RES_MQ_new.aspx?empid=" + id, "", "width=550,height=700,resizable=yes,scrollbars=yes");
            }
 function ajaxRefresh() {
           var ram = $find("<%= RadAjaxManager.ClientID %>");
            ram.ajaxRequest("foo");
                  
            }
When I click for the first time, it goes to "<%= RadAjaxManager.ClientID %> and does nothing. And second click the window pops up with correct data.

 

 

 

2 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 03 Feb 2011, 10:58 AM
Hello Smiely,

Try assigning the OnClientClick property of the image button in the ItemDataBound event handler and see if it works thus.
I assume that the code snippet is from the ItemCommand event handler. And what happens now is that the first time you click the button, it goes to the server and the OnClientClick handler is assigned. On the next click the handler is already available and that is why the window is shown, on opposite of the first click.

Kind regards,
Iana
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Smiely
Top achievements
Rank 1
answered on 07 Feb 2011, 04:59 PM
Oh GREAT !! It worked !!! Thanks lana !!
Tags
Grid
Asked by
Smiely
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Smiely
Top achievements
Rank 1
Share this question
or