Hi,
i open a radwindow fro ma button inside a templatecolumn in a detailtable.
In the radwindow i have a radbutton when i click it the OnClick event doesn't fire.
Here the code.
<%@ Page Title="" Language="C#" MasterPageFile="~/SiteT.Master" AutoEventWireup="true" CodeBehind="AnalisiExc.aspx.cs" Inherits="IPadAdmin.AnalisiExc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="StyleSection" runat="server">
<style>
.RadGrid {
border-radius: 10px;
overflow: hidden;
}
th {
font-size: 14px;
}
td {
font-size: 13px;
}
</style>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
<script type="text/javascript">
var radWindow1 = null;
var radGrid1 = null;
function pageLoad() {
radGrid1 = $find("<%= RadGrid1.ClientID %>");
radWindow1 = $find("<%= RadWindow1.ClientID %>");
}
</script>
</telerik:RadCodeBlock>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentSection" runat="server">
<form id="form1" runat="server" onsubmit="return validateForm()">
<telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
<div class="row page-titles">
<div class="col-md-5 align-self-center">
<telerik:RadCodeBlock runat="server">
<h3 class="text-primary"><a href="<%=Page.ResolveUrl("~/Default.aspx") %>">Dashboard</a></h3>
</telerik:RadCodeBlock>
</div>
<div class="col-md-7 align-self-center">
<ol class="breadcrumb">
<li class="breadcrumb-item">Amministrazione</li>
<li class="breadcrumb-item">Analisi</li>
<li class="breadcrumb-item">Eccezioni</li>
</ol>
</div>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="table-responsive m-t-40">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" UpdateInitiatorPanelsOnly="true">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="RadGrid1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
<telerik:AjaxSetting AjaxControlID="Button1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecorationZoneID="demo" DecoratedControls="All" EnableRoundedCorners="false" />
<telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
<asp:LinkButton ID="Button1"
runat="server"
CssClass="btn btn-primary btn-rounded m-b-10 m-l-5"
Text="AGGIORNA"
OnClick="Button1_Click">
</asp:LinkButton>
<div class="form-inline">
<label class="control-label"> Anno </label>
<telerik:RadNumericTextBox runat="server" ID="txtAnno" NumberFormat-DecimalDigits="0" NumberFormat-GroupSeparator="" Width="100px" />
<label class="control-label"> Mese </label>
<telerik:RadComboBox ID="cmbMese" runat="server" AutoPostBack="false" TabIndex="6" AppendDataBoundItems="true">
<Items>
<telerik:RadComboBoxItem runat="server" Value="0" Text="(Seleziona un mese)" />
<telerik:RadComboBoxItem runat="server" Value="1" Text="Gennaio" />
<telerik:RadComboBoxItem runat="server" Value="2" Text="Febbraio" />
<telerik:RadComboBoxItem runat="server" Value="3" Text="Marzo" />
<telerik:RadComboBoxItem runat="server" Value="4" Text="Aprile" />
<telerik:RadComboBoxItem runat="server" Value="5" Text="Maggio" />
<telerik:RadComboBoxItem runat="server" Value="6" Text="Giugno" />
<telerik:RadComboBoxItem runat="server" Value="7" Text="Luglio" />
<telerik:RadComboBoxItem runat="server" Value="8" Text="Agosto" />
<telerik:RadComboBoxItem runat="server" Value="9" Text="Settembre" />
<telerik:RadComboBoxItem runat="server" Value="10" Text="Ottobre" />
<telerik:RadComboBoxItem runat="server" Value="11" Text="Novembre" />
<telerik:RadComboBoxItem runat="server" Value="12" Text="Dicembre" />
</Items>
</telerik:RadComboBox>
</div>
<br />
<div>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="True" AllowSorting="true" EnableLoadOnDemand="True" ShowGroupPanel="true" OnNeedDataSource="RadGrid1_NeedDataSource"
AutoGenerateColumns="False" AllowPaging="False" PageSize="50" Skin="Material" OnItemCommand="RadGrid1_ItemCommand" OnGroupsChanging="RadGrid1_GroupsChanging" OnDetailTableDataBind="RadGrid1_DetailTableDataBind"
OnItemDataBound="RadGrid1_ItemDataBound" OnCustomAggregate="RadGrid1_CustomAggregate"
RenderMode="Lightweight" ShowFooter="True" ShowStatusBar="True" Culture="it-IT" GridLines="None" Width="100%">
<PagerStyle Mode="NumericPages"></PagerStyle>
<GroupingSettings CaseSensitive="false" />
<MasterTableView DataKeyNames="AG,SlpCode,Mese" AllowMultiColumnSorting="False" GroupLoadMode="Client" HierarchyLoadMode="Client"
CommandItemDisplay="Top" ShowGroupFooter="true" EnableHierarchyExpandAll="true" Caption="" TableLayout="Fixed">
<CommandItemSettings ShowAddNewRecordButton="false" ShowSaveChangesButton="false" ShowCancelChangesButton="false" ShowExportToExcelButton="true" />
<GroupByExpressions>
<telerik:GridGroupByExpression>
<SelectFields>
<telerik:GridGroupByField FieldAlias="Limite" FieldName="Limite" />
<telerik:GridGroupByField FieldAlias="Valid" FieldName="Valid" />
<telerik:GridGroupByField FieldAlias="AG" FieldName="AG" />
</SelectFields>
<GroupByFields>
<%--<telerik:GridGroupByField FieldName="CA" SortOrder="Ascending"></telerik:GridGroupByField>--%>
<telerik:GridGroupByField FieldName="AG" SortOrder="Ascending"></telerik:GridGroupByField>
<%--<telerik:GridGroupByField FieldName="Mese" SortOrder="Ascending"></telerik:GridGroupByField>--%>
</GroupByFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<DetailTables>
<telerik:GridTableView runat="server" AllowFilteringByColumn="False" AllowSorting="False" AllowAutomaticUpdates="false"
AutoGenerateColumns="False" AllowPaging="false" DataKeyNames="DocEntry" Caption="" Skin="Material"
RenderMode="Lightweight" ShowFooter="False" ShowStatusBar="True" CellSpacing="0" Name="Rate">
<Columns>
<telerik:GridBoundColumn DataField="DocEntry" HeaderText="" ReadOnly="True" Visible="false" UniqueName="DocEntry" />
<telerik:GridBoundColumn DataField="Aut" HeaderText="" ReadOnly="True" Visible="false" UniqueName="AutV" />
<telerik:GridBoundColumn DataField="Dec" HeaderText="" ReadOnly="True" Visible="false" UniqueName="Dec" />
<telerik:GridDateTimeColumn DataField="Data" HeaderText="Data" SortExpression="DocDate" ReadOnly="False" DataType="System.DateTime" DataFormatString="{0:D}"
UniqueName="Data">
</telerik:GridDateTimeColumn>
<telerik:GridBoundColumn DataField="DocNum" HeaderText="#" SortExpression="DocNum" ReadOnly="True" Visible="True"
UniqueName="DocNum">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CardCode" HeaderText="Codice" SortExpression="CardCode" ReadOnly="True" Visible="True"
UniqueName="CardCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CardName" HeaderText="Rag. Sociale" SortExpression="CardName" ReadOnly="True"
UniqueName="CardName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Pagamento" HeaderText="Pagamento" SortExpression="Pagamento" ReadOnly="True"
UniqueName="Pagamento">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Netto" HeaderText="Netto" SortExpression="Netto" DataFormatString="{0:N2}" AllowFiltering="false" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right"
UniqueName="Netto">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RatDoc" HeaderText="RatDoc" SortExpression="RatDoc" ReadOnly="True"
UniqueName="RatDoc">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RatBp" HeaderText="RatBp" SortExpression="RatBp" ReadOnly="True"
UniqueName="RatBp">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Aut." AllowFiltering="false" UniqueName="Aut">
<ItemTemplate>
<telerik:RadCheckBox ID="chkAut" runat="server" Checked='<%# Bind("Aut") %>' OnCheckedChanged="chkAut_CheckedChanged" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Dec." AllowFiltering="false" UniqueName="Dec">
<ItemTemplate>
<telerik:RadCheckBox ID="chDec" runat="server" Checked='<%# Bind("Dec") %>' OnCheckedChanged="chDec_CheckedChanged" />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText=""
AllowFiltering="false">
<HeaderStyle Width="102px" />
<ItemTemplate>
<asp:LinkButton ID="cmdNota" runat="server" Text="NOTA" OnClientClick='<%# String.Format("openConfirmationWindow({0}); return false;", Eval("DocEntry")) %>'
CssClass="bookNowLink" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</telerik:GridTableView>
</DetailTables>
<Columns>
<%--<telerik:GridBoundColumn DataField="CA" HeaderText="AREA" SortExpression="AREA" ReadOnly="True" UniqueName="CA" />--%>
<telerik:GridBoundColumn DataField="AG" HeaderText="AG" SortExpression="AG" ReadOnly="True" UniqueName="AG" />
<telerik:GridBoundColumn DataField="SlpCode" HeaderText="Codice" ReadOnly="True" UniqueName="SlpCode" />
<telerik:GridBoundColumn DataField="AGE" HeaderText="Agente" SortExpression="AGE" ReadOnly="True" UniqueName="AGE" />
<telerik:GridBoundColumn DataField="Anno" HeaderText="Anno" ReadOnly="True" UniqueName="Anno" AllowFiltering="false" />
<telerik:GridBoundColumn DataField="Mese" HeaderText="Mese" SortExpression="Mese" ReadOnly="True" AllowFiltering="false" UniqueName="Mese" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" />
<telerik:GridBoundColumn DataField="Numero" HeaderText="Totali" SortExpression="Numero" ReadOnly="True" Groupable="false" UniqueName="Numero" Aggregate="Sum" FooterText="Totali: " FooterStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right" ItemStyle-HorizontalAlign="Right" AllowFiltering="false" />
<telerik:GridBoundColumn DataField="Valore" HeaderText="Valore" SortExpression="Valore" DataFormatString="{0:N2}" AllowFiltering="false" ItemStyle-HorizontalAlign="Right" HeaderStyle-HorizontalAlign="Right"
UniqueName="Valore" FooterText="Tot: " Aggregate="Sum" FooterStyle-HorizontalAlign="Right" Groupable="false">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Limite" HeaderText="Limite" SortExpression="" ReadOnly="True" UniqueName="Limite" AllowFiltering="false" />
<telerik:GridBoundColumn DataField="Valid" HeaderText="" SortExpression="" ReadOnly="True" UniqueName="Valid" Display="false" />
<telerik:GridTemplateColumn HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="center" HeaderText="Term"
AllowFiltering="false" UniqueName="Term" Groupable="false">
<ItemTemplate>
<telerik:RadCheckBox ID="chkTerm" runat="server" Checked='<%# Bind("Term") %>' OnCheckedChanged="chkTerm_CheckedChanged" />
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True">
<Selecting AllowRowSelect="True"></Selecting>
<Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True"
ResizeGridOnColumnResize="False"></Resizing>
</ClientSettings>
<FilterMenu RenderMode="Lightweight"></FilterMenu>
<HeaderContextMenu RenderMode="Lightweight"></HeaderContextMenu>
<GroupingSettings ShowUnGroupButton="true"></GroupingSettings>
</telerik:RadGrid>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<telerik:RadWindowManager RenderMode="Lightweight" ID="RadWindowManager1" ShowContentDuringLoad="false" VisibleStatusbar="true"
ReloadOnShow="true" runat="server" EnableShadow="true">
<Windows>
<telerik:RadWindow RenderMode="Lightweight" ID="RadWindow1" runat="server" VisibleTitlebar="true" Modal="true" Width="500px" Height="300px"
Behaviors="None" VisibleStatusbar="false">
<ContentTemplate>
<asp:Panel ID="FirstStepPanel" runat="server">
<div>
<asp:HiddenField ID="DocEntry" ClientIDMode="Static" runat="server" />
<hr class="lineSeparator" style="margin: 12px 0 12px 0" />
<table width="99%">
<tr>
<td>
<telerik:RadTextBox ID="txtNota" runat="server" TextMode="MultiLine" Rows="6" MaxLength="250" Width="99%"></telerik:RadTextBox>
</td>
</tr>
</table>
<hr class="lineSeparator" style="margin: 12px 0 15px 0" />
<telerik:RadButton RenderMode="Lightweight" ID="cmdApprova" runat="server" Text="INSERISCI" CausesValidation="false" OnClientClicking="RadConfirm"
Width="120px" OnClick="cmdApprova_Click" UseSubmitBehavior="false" />
<telerik:RadButton RenderMode="Lightweight" ID="cmdAnnulla" runat="server" Text="ANNULLA"
Width="120px" OnClientClicking="cancelClicking" UseSubmitBehavior="false" />
</div>
</asp:Panel>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
</form>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="ScriptSection" runat="server">
<script>
function validateForm() {
var errors = false;
var testo = document.getElementById('<%= txtAnno.ClientID %>');
if (testo.value == '') {
errors = true;
alert('Inserire un anno la ricerca.');
} else {
errors = false;
}
if (errors == false) {
document.getElementById("form1").submit();
}
}
function openConfirmationWindow(val) {
var radtextbox = $find('<%=txtNota.ClientID %>');
radtextbox.clear();
document.getElementById("DocEntry").value = val;
radWindow1.set_title('Nota');
radWindow1.show();
}
function RadConfirm(sender, args) {
var callBackFunction = function (shouldSubmit) {
if (shouldSubmit) {
sender.click();
if (Telerik.Web.Browser.ff) {
sender.get_element().click();
}
}
};
var text = "Proseguire con l'\operazione?";
radconfirm(text, callBackFunction, 300, 200, null, "RadConfirm");
args.set_cancel(true);
}
function cancelClicking(sender, args) {
radWindow1.close();
args.set_cancel(true);
}
function AlertInvia(sender, args) {
args.set_cancel(!window.confirm("Proseguire con l\'operazione?"));
}
</script>
</asp:Content>
Hi Fabrizio,
From the code you've shared, I understand you are experiencing an issue with the RadButton (with ID cmdApprova) inside the RadWindow and that the OnClick event is not firing for this button.
Here are a few things to check or do:
<telerik:RadButton RenderMode="Lightweight" AutoPostBack="true" ... >
After trying the above, if the button still doesn't work as expected, consider creating a simpler page with just the button and the required logic. This will help you determine if the problem lies within the larger context of the page or with the button itself.