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

Button not postbacking

1 Answer 76 Views
Button
This is a migrated thread and some comments may be shown as answers.
Jocelyn
Top achievements
Rank 1
Jocelyn asked on 16 Oct 2012, 04:51 PM
I have a page with a grid and a RadWindowManager with some windows.

Inside these window I have some other controls which I use to interact with the grid.

Now I add a button somewhere in my page:

<telerik:RadButton runat="server" ID="RadButton1" AutoPostBack="true" OnClick="btnAjouter_Click">
</telerik:RadButton>

But for some reason, when I click on this button nothing happen. There is no postback and no javascript error.

I tried to put a UserControl that I use in a RadWindow in comment and the button seems to work...

My UserControl looks like this:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="WindowDivergence.ascx.vb"
    Inherits="GESPHARxLite_2.WindowDivergence" %>
<%@ Import Namespace="GESPHARxLite_2.GestionMessages" %>
 
<div class="WindowDivergence">
    <%--Ordonnance--%>
    <div>
        <div class="alignLeft wdLabel">
            <telerik:RadCodeBlock runat="server">
                <%=GetMessageEx(750).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadTextBox runat="server" ID="txtNoOrdo" ReadOnly="true" Width="35px">
            </telerik:RadTextBox>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadTextBox runat="server" ID="txtMedicament" ReadOnly="true" Width="250px">
            </telerik:RadTextBox>
        </div>
        <div class="spacer">
        </div>
    </div>
    <%--Type de divergence--%>
    <div>
        <div class="alignLeft wdLabel">
            <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
                <%=GetMessageEx(6203).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadComboBox runat="server" ID="cboTypeDivergence" Width="291px" OnClientSelectedIndexChanged="TypeChanged">
            </telerik:RadComboBox>
        </div>
        <div class="spacer">
        </div>
    </div>
    <%--Intervenants--%>
    <div>
        <div class="alignLeft wdLabel wdLabelValidator">
            <telerik:RadCodeBlock ID="RadCodeBlock2" runat="server">
                <%=GetMessageEx(900).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <asp:RequiredFieldValidator runat="server" ID="rfvIntervenant" ErrorMessage="*" ControlToValidate="cboIntervenant"></asp:RequiredFieldValidator>
            <telerik:RadComboBox runat="server" ID="cboIntervenant" Width="100px" DropDownWidth="200px"
                HighlightTemplatedItems="true" OnClientSelectedIndexChanged="IntervenantChanged">
                <ItemTemplate>
                    <div class="cboContentContener">
                        <div>
                            <b>
                                <%=GetMessageEx(389).Texte%>
                            </b>
                            <%#DataBinder.Eval(Container, "Text")%>
                        </div>
                        <div>
                            <b>
                                <%=GetMessageEx(205).Texte%>
                            </b>
                            <%#DataBinder.Eval(Container, "Attributes['Description']")%>
                        </div>
                    </div>
                </ItemTemplate>
            </telerik:RadComboBox>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadTextBox runat="server" ID="txtIntervenant" Width="185px" ReadOnly="true">
            </telerik:RadTextBox>
        </div>
        <div class="spacer">
        </div>
    </div>
    <%--Date révision--%>
    <div>
        <div class="alignLeft wdLabel wdLabelValidator">
            <telerik:RadCodeBlock ID="RadCodeBlock3" runat="server">
                <%=GetMessageEx(3163).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <asp:RequiredFieldValidator runat="server" ID="rfvDateRevision" ErrorMessage="*" ControlToValidate="rdpDateRevision"></asp:RequiredFieldValidator>       
            <telerik:RadDatePicker runat="server" ID="rdpDateRevision" Width="126px">
            </telerik:RadDatePicker>
        </div>
        <div class="spacer">
        </div>
    </div>
    <%--Medecin traitant--%>
    <div>
        <div class="alignLeft wdLabel wdLabelValidator">
            <telerik:RadCodeBlock ID="RadCodeBlock4" runat="server">
                <%=GetMessageEx(665).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <asp:RequiredFieldValidator runat="server" ID="rfvMedecin" ErrorMessage="*" ControlToValidate="cboMedecinTraitant"></asp:RequiredFieldValidator>           
            <telerik:RadComboBox runat="server" ID="cboMedecinTraitant" Width="100px" HighlightTemplatedItems="true"
                DropDownWidth="200px" AllowCustomText="true" OnClientSelectedIndexChanged="MedecinChanged">
                <ItemTemplate>
                    <div class="cboContentContener">
                        <div>
                            <b>
                                <%=GetMessageEx(209).Texte%>
                            </b>
                            <%#DataBinder.Eval(Container, "Text")%>
                        </div>
                        <div>
                            <b>
                                <%=GetMessageEx(237).Texte%>
                            </b>
                            <%#DataBinder.Eval(Container, "Attributes['Nom']")%>
                        </div>
                    </div>
                </ItemTemplate>
            </telerik:RadComboBox>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadTextBox runat="server" ID="txtMedecinTraitant" Width="185px" ReadOnly="true">
            </telerik:RadTextBox>
        </div>
        <div class="spacer">
        </div>
    </div>
    <%--État de divergence--%>
    <div>
        <div class="alignLeft wdLabel">
            <telerik:RadCodeBlock ID="RadCodeBlock5" runat="server">
                <%=GetMessageEx(6210).Texte%>:
            </telerik:RadCodeBlock>
        </div>
        <div class="alignLeft wdDataInput">
            <telerik:RadComboBox runat="server" ID="cboEtatDivergence" Width="291px">
            </telerik:RadComboBox>
        </div>
        <div class="spacer">
        </div>
    </div>
    <div class="wdLabel">
        <telerik:RadCodeBlock ID="RadCodeBlock6" runat="server">
            <%=GetMessageEx(335).Texte%>
        </telerik:RadCodeBlock>
    </div>
    <div style="padding: 5px;">
        <telerik:RadTextBox runat="server" ID="txtCommentaire" TextMode="MultiLine" MaxLength="2000"
            Width="432px" Height="70px">
        </telerik:RadTextBox>
    </div>
    <div class="wdFooter">
        <telerik:RadButton runat="server" ID="btnSave" Text="Ok" OnClientClicked="btnOk_OnClick">
        </telerik:RadButton>
        <telerik:RadButton runat="server" ID="btnAnnuler" Text="Annuler" OnClientClicked="btnAnnuler_OnClick">
        </telerik:RadButton>
    </div>
</div>
<telerik:RadScriptBlock runat="server" ID="sbDivergence">
 
    <script type="text/javascript">
        var oldText;
     
        function btnOk_OnClick(sender, args)
        {
            var win = $find('<%=Me.NamingContainer.BindingContainer.ClientID %>');
            if (Page_IsValid)
            {
                win.close(null);
            }
        }
 
        function btnAnnuler_OnClick(sender, args)
        {
            var win = $find('<%=Me.NamingContainer.BindingContainer.ClientID %>');
            win.close(null);
        }
 
        function IntervenantChanged(sender, args)
        {
            var item = args.get_item();
            var txtIntervenant = $find("<%=txtIntervenant.ClientID %>");
            txtIntervenant.set_value(item.get_attributes().getAttribute("Description"));
        }
 
        function MedecinChanged(sender, args)
        {
            var item = args.get_item();
            var txtMedecin = $find("<%=txtMedecinTraitant.ClientID %>");
 
            if (item != null)
            {
                txtMedecin.set_value(item.get_attributes().getAttribute("Nom"));
            }
            else
            {
                txtMedecin.set_value("");
            }
        }
         
        function TypeChanged(sender, args)
        {
            var item = args.get_item();
            var txtCommentaire = $find("<%=txtCommentaire.ClientID %>");
 
            txtCommentaire.set_value(item.get_attributes().getAttribute("Texte"));
        }
    </script>
 
</telerik:RadScriptBlock>

And my RadWindow:

<telerik:RadWindow ID="rwDivergence" runat="server" Width="470px" Height="350px"
    Modal="true">
    <ContentTemplate>
        <telerik:RadAjaxPanel runat="server" ID="diverPanel">
            <%--<GESPHARxLite_2:WinDivergence runat="server" ID="ucDiver" GridToRebind="gridMPA" />--%>
        </telerik:RadAjaxPanel>
    </ContentTemplate>
</telerik:RadWindow>

I can't find why my button only works when I put my UserControl in comment. 

Thanks.

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Oct 2012, 06:49 PM
Hello,

Please try with property.

   <telerik:RadButton  CausesValidation="false">
       </telerik:RadButton>
 
//OR
        <telerik:RadButton  EnableViewState="true">
       </telerik:RadButton>


Thanks,
Jayesh Goyani
Tags
Button
Asked by
Jocelyn
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or