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

Click event of button

6 Answers 192 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Markus
Top achievements
Rank 1
Markus asked on 02 Jan 2008, 03:29 PM
I have replaced the radAjaxManager for ASP.Net with the one of the prometheus controls. Now the click event of a button no more fires if the button is included in the manager and a update control is defined. With the "old" radAjaxManager everything worked fine.
Any ideas?

6 Answers, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 04 Jan 2008, 07:19 AM
Hello Markus,

The button requires updated control when ajaxified by the manager (see point 5 here) and this simple scenario works just fine with the Prometheus RadAjaxManager as well:

http://www.telerik.com/demos/aspnet/prometheus/Ajax/Examples/Common/FormValues/DefaultCS.aspx

Let us know if you need further assistance.

Best wishes,
Konstantin Petkov
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 04 Jan 2008, 08:15 AM
I have update controls added, but the click event still not fires.
0
Giuseppe
Telerik team
answered on 04 Jan 2008, 09:28 AM
Hi Markus,

Could you post the markup of the problematic page here or open a formal support ticket with a sample application that we can investigate locally?

Looking forward to your reply.


Kind regards,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 04 Jan 2008, 11:19 AM
Here is the code, the example uses the Northwind database. In order to get it work you must modify the connect string in "Page_Load" for your needs. Just select an item from list and click the "Select" button. As you can see the selected row will not be shown on bottom of grid. If you enable the button by default it is working and it is also working if you use the NON prometheus radAjaxManager and radGrid.

Default.aspx:
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="radAjaxButtonProblem._Default" %> 
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml" > 
<head runat="server">  
    <title>Untitled Page</title> 
 
    <script type="text/javascript" language="JavaScript">  
    <!--  
      
        var rgrdMegaDipoList  
 
        function MegaDispoOnRowSelected(sender)  
        {  
          
            var intSelIndex  
 
            if (sender.get_masterTableView().get_selectedItems().length > 0)  
            {  
              intSelIndex = sender.get_masterTableView().get_selectedItems().ItemIndex  
            }  
            window.document.forms[0].cmdStart.disabled = (intSelIndex == -1)  
              
        }  
          
        function OnActiveRowChanged(row)  
         {  
            row.Owner.SelectRow(row.Control, true);  
         }  
 
        function MegaDispoOnGridCreated()  
        {  
          rgrdMegaDipoList = this 
        }  
 
      // --> 
    </script> 
 
</head> 
<body> 
    <form id="form1" runat="server">  
        &nbsp;<div> 
            <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
            </telerik:RadScriptManager> 
      
    </div> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                    <Telerik:AjaxSetting AjaxControlID="cmdStart">  
                        <UpdatedControls> 
                            <Telerik:AjaxUpdatedControl ControlID="lblCat" /> 
                        </UpdatedControls> 
                    </Telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
        &nbsp;  
        <br /> 
                <table border="0" cellpadding="0" cellspacing="0">  
                    <tr> 
                        <td valign="top">  
                            <Telerik:RadGrid ID="rgrdMegaDispoList" runat="server" AllowSorting="True" AutoGenerateColumns="False" GridLines="None" Skin="Office2007" DataSourceID="datMegadispo" Font-Names="verdana,tahoma,helvetica" Font-Overline="False" Font-Size="8px" Font-Strikeout="False">  
                                <MasterTableView DataSourceID="datMegadispo" DataKeyNames="CategoryId" NoMasterRecordsText="Es sind keine Datens&#228;tze vorhanden." CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst" Dir="LTR" Frame="Border" TableLayout="Auto">  
                                    <Columns> 
                                        <Telerik:GridBoundColumn DataField="CategoryId" HeaderText="Kostenstelle" SortExpression="CategoryId" UniqueName="CategoryId" ReadOnly="True" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None"></Telerik:GridBoundColumn> 
                                        <Telerik:GridBoundColumn DataField="CategoryName" HeaderText="Auftrag" SortExpression="CategoryName" UniqueName="CategoryName" ReadOnly="True" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" ForceExtractValue="None"></Telerik:GridBoundColumn> 
                                    </Columns> 
                                    <ExpandCollapseColumn Resizable="False" Visible="False" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">  
                                        <HeaderStyle Width="20px" /> 
                                    </ExpandCollapseColumn> 
                                    <RowIndicatorColumn Visible="False" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">  
                                        <HeaderStyle Width="20px" /> 
                                    </RowIndicatorColumn> 
                                    <EditFormSettings> 
                                        <EditColumn CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType">  
                                        </EditColumn> 
                                    </EditFormSettings> 
                                </MasterTableView> 
                                <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True" AllowColumnHide="True" AllowKeyboardNavigation="True">  
                                    <Selecting AllowRowSelect="True" /> 
                                    <ClientEvents OnRowSelected="MegaDispoOnRowSelected" OnGridCreated="MegaDispoOnGridCreated" OnActiveRowChanged="OnActiveRowChanged" /> 
                                </ClientSettings> 
                                <ExportSettings> 
                                    <Pdf FontType="Subset" PaperSize="Letter" /> 
                                    <Excel Format="Html" /> 
                                </ExportSettings> 
                                <SortingSettings SortToolTip="Hier klicken um zu sortieren" /> 
                            </Telerik:RadGrid> 
                            <asp:SqlDataSource ID="datMegaDispo" runat="server"></asp:SqlDataSource> 
                        </td> 
                        <td valign="top">  
                            &nbsp;<asp:Button ID="cmdStart" runat="server" Text="Select" style="width: 90px" Enabled="false"  /><br /> 
                            &nbsp;  
                        </td> 
                    </tr> 
                </table> 
        Selected category:  
        <asp:Label ID="lblCat" runat="server" Text=""></asp:Label> 
          
    </form> 
</body> 
</html> 
 

Code behind:
Partial Public Class _Default  
    Inherits System.Web.UI.Page  
 
    Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgs) Handles Me.Load  
 
        Dim strSQL As String 
 
        datMegaDispo.ConnectionString = "Data Source=jabba;Initial Catalog=northwind;User ID=DDUser;Password=DDUser" 
        strSQL = "SELECT CategoryId, CategoryName  " & _  
                 "FROM Categories " 
        datMegaDispo.SelectCommand = strSQL  
 
    End Sub 
 
    Protected Sub cmdStart_Click(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles cmdStart.Click  
 
        lblCat.Text = CStr(rgrdMegaDispoList.MasterTableView.DataKeyValues(rgrdMegaDispoList.SelectedItems(0).ItemIndex).Item("CategoryId"))  
 
    End Sub 
 
End Class 
0
Giuseppe
Telerik team
answered on 04 Jan 2008, 02:38 PM
Hello Markus,

In your scenario you will need to handle the AjaxSettingCreating server-side event of the AjaxManager and set the UseSubmitBehavior property of the Button initator to true:

protected void RadAjaxManager1_AjaxSettingCreating(object sender, Telerik.Web.UI.AjaxSettingCreatingEventArgs e) 
    Button initiator = e.Initiator as Button; 
    if (initiator != null) 
    { 
        initiator.UseSubmitBehavior = true
    } 


Hope this helps.


All the best,
Manuel
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Markus
Top achievements
Rank 1
answered on 04 Jan 2008, 02:58 PM
This solves the problem! Thanks a lot!
Tags
Ajax
Asked by
Markus
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Markus
Top achievements
Rank 1
Giuseppe
Telerik team
Share this question
or