RadWindow Confirm Not Posting Back

7 posts, 1 answers
  1. Brad
    Brad avatar
    39 posts
    Member since:
    Aug 2010

    Posted 27 Oct 2010 Link to this post

    I'm implementing the RadWindow as a confirm dialog as show in the demo. However, my form never posts back.

    I've narrowed the issue down to this:


    In the demo, the input renders as follows:
    <input type="submit" style="" class="PostbackButton" id="PostbackButton1" onclick="return blockConfirm('Are you sure you want to postback?', event, 330, 100,'','Custom title');" value="Confirm postback with radconfirm" name="PostbackButton1">

    On my page, the input renders as follows:
    <input type="button" id="ctl00_bodyContentPlaceHolder_uxTimeCard_uxContainer_uxSaveTimesheet" onclick="return blockConfirm(this, event,'Saving timesheet...','Rows without time will be removed. Do you want to continue?', 350, 150);WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$bodyContentPlaceHolder$uxTimeCard$uxContainer$uxSaveTimesheet", "", true, "", "", false, true))" value="save timesheet" name="ctl00$bodyContentPlaceHolder$uxTimeCard$uxContainer$uxSaveTimesheet" class="rfdDecorated" tabindex="-1">
    Notice the additional WebForm_DoPostBackWithOptions in my onclick event as opposed to the demo. So when the line callerObj["onclick"] = ""; fires, the event is totally removed.

    Please advise.
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 28 Oct 2010 Link to this post

    Hello Brad,

    Could you please post your original code?


    Best wishes,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Brad
    Brad avatar
    39 posts
    Member since:
    Aug 2010

    Posted 28 Oct 2010 Link to this post

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="TimeCard.ascx.cs" Inherits="Time_Controls_TimeCard" %>
    <%@ Register TagPrefix="blueSky" TagName="ProjectList" Src="~/Time/Controls/MiniControls/ProjectList.ascx" %>
    <%@ Register TagPrefix="blueSky" TagName="ServiceList" Src="~/Time/Controls/MiniControls/ServiceList.ascx" %>
    <style type="text/css">
    </style>
    <telerik:RadAjaxManagerProxy ID="uxLoadingManagerProxy" runat="server" />
    <telerik:RadScriptBlock ID="uxScriptBlock" runat="server">
        <script type="text/javascript">
            /* WEEKENDING
             */
            function getDateFromID(ID) {
                var name = ID.split("_");
                var date = [parseInt(name[name.length - 3]), parseInt(name[name.length - 2]), parseInt(name[name.length - 1])];
                return date;
            }
            function selectLastDayOfWeek(sender, eventArgs) {
                eventArgs.set_cancel(true);
                var day = eventArgs.get_renderDay();
                var row = day.DomElement.parentNode;
                var selected = day.get_isSelected();
                var calendar = sender;
                calendar.unselectDates(calendar.get_selectedDates());
                if (!selected) {
                    var rowCells = row.getElementsByTagName("td"); //get all the cells of the row
                    calendar.selectDate(getDateFromID(rowCells[rowCells.length - 1].DayId));
                }
            }
        </script>
        <script type="text/javascript">
        function setActiveRow(index){
                var grid = $find("<%= uxGrid.ClientID %>");
                grid.set_activeRow(grid.MasterTableView.get_dataItems()[index].get_element());
            }
            /* HOURS */
            var indexExpression = "[0-9]{1}$";
            var summaries = new Array(null, null, null, null, null, null, null);
            var tempValue = new Array(<%= HourSummary[0] %>, <%= HourSummary[1] %>, <%= HourSummary[2] %>
            , <%= HourSummary[3] %>, <%= HourSummary[4] %>, <%= HourSummary[5] %>, <%= HourSummary[6] %>);
     
            function registerSummary(sender, args) {
                summaries[sender.get_id().match(indexExpression) - 1] = sender;
            }
            function blur(sender, args) {
                summaries[sender.get_id().match(indexExpression) - 1].set_value(tempValue[sender.get_id().match(indexExpression) - 1] + sender.get_value());
            }
            function focus(sender, args) {
                tempValue[sender.get_id().match(indexExpression) - 1] = summaries[sender.get_id().match(indexExpression) - 1].get_value() - sender.get_value();
            }
        </script>
        <script type="text/javascript">
            //the following code use radconfirm to mimic the blocking of the execution thread.
            //The approach has the following limitations:
            //1. It works only for elements that have *click* method, e.g. links and buttons
            //2. It cannot be used in if(!confirm) checks
            window.blockConfirm = function (callerObj, mozEvent, title, text, oWidth, oHeight) {
                var ev = mozEvent ? mozEvent : window.event; //Moz support requires passing the event argument manually
                //Cancel the event
                ev.cancelBubble = true;
                ev.returnValue = false;
                if (ev.stopPropagation) ev.stopPropagation();
                if (ev.preventDefault) ev.preventDefault();
     
                //Determine who is the caller
                var callerObj = ev.srcElement ? ev.srcElement : ev.target;
     
                //Call the original radconfirm and pass it all necessary parameters
                if (callerObj) {
                    //Show the confirm, then when it is closing, if returned value was true, automatically call the caller's click method again.
                    var callBackFn = function (arg) {
                        if (arg) { // 'OK' was clicked; fire server-side click event
                            console.log(callerObj["onclick"]);
                            callerObj["onclick"] = ""; // remove the client click event ??
                            console.log(callerObj["onclick"]);
                            if (callerObj.click) { callerObj.click(); } //Works for all buttons in IE, but does not work for link buttons in Moz
                            else if (callerObj.tagName == "A") { //We assume it is a link button!
                                try { eval(callerObj.href) }
                                catch (e) { }
                            }
                        }
                    }
                    radconfirm(text, callBackFn, oWidth, oHeight, callerObj, title);
                }
                return false;
            }
        </script>
    </telerik:RadScriptBlock>
    <telerik:RadAjaxPanel ID="uxContent" runat="server">
        <container:LinedGreyTop ID="uxContainer" runat="server">
            <TitleTemplate>
                <table cellpadding="0" cellspacing="0" width="100%">
                    <tr>
                        <td align="left" valign="middle">
                            <asp:Image ID="uxWeekStatusImage" runat="server" SkinID="Lock" AlternateText="The week is locked. You cannot enter or modify time in this week." /><telerik:RadToolTip
                                ID="uxWeekStatusImageToolTip" runat="server" SkinID="Default" TargetControlID="uxWeekStatusImage"
                                Position="MiddleRight" />
                        </td>
                        <td align="left" valign="middle">
                            <asp:Label ID="uxWeekEndingLabel" runat="server" Text="week ending " style="vertical-align:middle;" />
                            <telerik:RadDatePicker ID="uxWeekEndingDate" runat="server" AutoPostBack="true" Skin="Sitefinity"
                                EnableTheming="false" Width="225px" DateInput-CssClass="weekEndingDate" DateInput-HoveredStyle-CssClass="weekEndingDateHovered"
                                OnSelectedDateChanged="uxWeekEndingDate_SelectedDateChanged">
                                <Calendar runat="server" ShowColumnHeaders="false" ShowRowHeaders="false">
                                    <ClientEvents OnDateClick="selectLastDayOfWeek" />
                                </Calendar>
                            </telerik:RadDatePicker>
                            <telerik:RadToolTip ID="uxWeekEndingDateToolTip" runat="server" ToolTip="click to select a different week"
                                SkinID="Default" TargetControlID="uxWeekEndingDate" Position="MiddleRight" />
                        </td>
                        <td align="center" valign="middle">
                            <asp:Label ID="uxStatusMessage" runat="server" CssClass="h8" />
                        </td>
                        <td align="right" valign="middle">
                            <telerik:RadToolTip ID="uxQuickEntryPopoutToolTip" runat="server" SkinID="Default"
                                TargetControlID="uxQuickEntryPopout" Position="TopRight" />
                            <asp:Button ID="uxSaveTimesheet" runat="server" Text="save timesheet" OnClientClick="return blockConfirm(this, event,'Saving timesheet...','<p>Rows without time will be removed.</p><p><b>Do you want to continue?<b></p>', 350, 150);"
                                OnClick="uxSave_Click" />
                            <span style="color: #B4B4B4;">|</span>
                            <asp:Button ID="uxSubmitTimesheet" runat="server" Text="submit timesheet" OnClientClick="return blockConfirm(this, event,'Submitting timesheet...','Submitting your timesheet cannot be undone; do you want to continue?', 330, 100);"
                                OnClick="uxSubmitTimesheet_Click" />
                            <span style="color: #B4B4B4;">|</span>
                            <milrose:PopupWindow ID="uxQuickEntryPopout" runat="server" ButtonCssClass="launchMiniEntry"
                                ButtonCssClassHover="launchMiniEntryHover" ToolTip="launch quick entry" />
                        </td>
                    </tr>
                </table>
            </TitleTemplate>
            <ContentTemplate>
                <telerik:RadGrid ID="uxGrid" runat="server" AutoGenerateColumns="false" AllowPaging="false"
                    AllowSorting="false" CssClass="timeCard" Skin="Windows7" ShowStatusBar="false"
                    OnNeedDataSource="uxGrid_NeedDataSource" OnItemDataBound="uxGrid_ItemDataBound"
                    OnDeleteCommand="uxGrid_DeleteCommand">
                    <ClientSettings>
                        <Selecting AllowRowSelect="false" />
                    </ClientSettings>
                    <MasterTableView TableLayout="Fixed" DataKeyNames="WeekEnding,CompanyId,ContactId,ProjectId,ProjectPhaseId,ServiceId,IsBillable,Comments"
                        HeaderStyle-CssClass="timeEntryHeader" ItemStyle-CssClass="timeEntryRow" AlternatingItemStyle-CssClass="timeEntryAlternateRow"
                        FooterStyle-CssClass="timeEntryFooter" ShowFooter="true" ShowHeader="true">
                        <Columns>
                            <%-- COPY PREVIOUS ENTRY --%>
                            <telerik:GridTemplateColumn HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="uxDuplicateCurrent" runat="server" SkinID="Copy" AlternateText="add duplicate row"
                                        CausesValidation="false" CommandArgument='<%# Container.ItemIndex %>' ToolTip="copy previous entry"
                                        Visible='<%# !(bool)DataBinder.Eval(Container.DataItem, "IsClosed") %>' OnClick="uxDuplicateCurrent_Click" />
                                    <telerik:RadToolTip ID="uxDuplicateCurrentToolTip" runat="server" SkinID="Default"
                                        TargetControlID="uxDuplicateCurrent" Position="TopRight" />
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:ImageButton ID="uxNewRecord" runat="server" SkinID="Add" CausesValidation="false"
                                        ToolTip="add new row" OnClick="uxNewRecord_Click" />
                                </FooterTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- PROJECT ID --%>
                            <telerik:GridTemplateColumn HeaderText="Project" HeaderStyle-Font-Bold="true" HeaderStyle-Width="90px"
                                HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <blueSky:ProjectList ID="uxProjectList" runat="server" EmptyMessage="Project:" ErrorCssClass="errorInput"
                                        FilterByUserId="aconfer@milrose.com" SelectionRequired="true" ShowHeader="false"
                                        Enabled='<%# !(bool)DataBinder.Eval(Container.DataItem, "IsClosed") %>' SelectedProjectAndPhase='<%# DataBinder.Eval(Container.DataItem, "MRC") %>' />
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:LinkButton ID="uxNewRecordText" runat="server" CausesValidation="false" Text="add new record"
                                        OnClick="uxNewRecord_Click" />
                                </FooterTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- SERVICE --%>
                            <telerik:GridTemplateColumn HeaderText="Service" HeaderStyle-Font-Bold="true" HeaderStyle-Width="110px"
                                HeaderStyle-HorizontalAlign="Center" ItemStyle-Width="125px" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <blueSky:ServiceList ID="uxServiceList" runat="server" EmptyMessage="Service:" ErrorCssClass="errorInput"
                                        SelectionRequired="true" Text='<%# DataBinder.Eval(Container.DataItem, "ServiceFriendlyName") %>'
                                        ShowHeader="false" Enabled='<%# !(bool)DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                        SelectedValue='<%# DataBinder.Eval(Container.DataItem, "ServiceId") %>' />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- IS BILLABLE --%>
                            <telerik:GridTemplateColumn HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center">
                                <HeaderTemplate>
                                    <asp:ImageButton ID="uxIsBillableImage" runat="server" SkinID="Money" OnClientClick="toggleIsBillable();"
                                        ToolTip="is the item billable?" /></HeaderTemplate>
                                <ItemTemplate>
                                    <asp:CheckBox ID="uxIsBillable" runat="server" TextAlign="Left" Checked='<%# DataBinder.Eval(Container.DataItem, "IsBillable") %>'
                                        Enabled='<%# !(bool)DataBinder.Eval(Container.DataItem, "IsClosed") %>' ToolTip="is the item billable?" />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- COMMENTS --%>
                            <telerik:GridTemplateColumn HeaderText="Comments" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <telerik:RadTextBox ID="uxComments" runat="server" MaxLength="250" Width="95%" Text='<%# DataBinder.Eval(Container.DataItem, "Comments") %>'
                                        ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>' />
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- DAYS --%>
                            <telerik:GridTemplateColumn HeaderStyle-Width="450px">
                                <HeaderTemplate>
                                    <table cellpadding="0" cellspacing="0" width="100%" class="timeEntry">
                                        <tr>
                                            <td align="center" valign="middle" class="<%# IsToday1 %> <%# Day1Type %> <%# Day1("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay1" runat="server" Text='<%# Day1(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday2 %> <%# Day2Type %> <%# Day2("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay2" runat="server" Text='<%# Day2(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday3 %> <%# Day3Type %> <%# Day3("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay3" runat="server" Text='<%# Day3(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday4 %> <%# Day4Type %> <%# Day4("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay4" runat="server" Text='<%# Day4(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday5 %> <%# Day5Type %> <%# Day5("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay5" runat="server" Text='<%# Day5(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday6 %> <%# Day6Type %> <%# Day6("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay6" runat="server" Text='<%# Day6(DayHeaderNameFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday7 %> <%# Day7Type %> <%# Day7("ddd") %> dayHeaderName">
                                                <asp:Label ID="uxDay7" runat="server" Text='<%# Day7(DayHeaderNameFormatString) %>' />
                                            </td>
                                        </tr>
                                        <tr>
                                            <td align="center" valign="middle" class="<%# IsToday1 %> <%# Day1Type %> <%# Day1("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate1" runat="server" Text='<%# Day1(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday2 %> <%# Day2Type %> <%# Day2("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate2" runat="server" Text='<%# Day2(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday3 %> <%# Day3Type %> <%# Day3("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate3" runat="server" Text='<%# Day3(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday4 %> <%# Day4Type %> <%# Day4("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate4" runat="server" Text='<%# Day4(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday5 %> <%# Day5Type %> <%# Day5("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate5" runat="server" Text='<%# Day5(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday6 %> <%# Day6Type %> <%# Day6("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate6" runat="server" Text='<%# Day6(DayHeaderDateFormatString) %>' />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday7 %> <%# Day7Type %> <%# Day7("ddd") %> dayHeaderDate">
                                                <asp:Label ID="uxDate7" runat="server" Text='<%# Day7(DayHeaderDateFormatString) %>' />
                                            </td>
                                        </tr>
                                    </table>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <table cellpadding="0" cellspacing="0" width="100%" class="timeEntry">
                                        <tr>
                                            <td align="center" valign="middle" class="<%# IsToday1 %> <%# Day1Type %> <%# Day1("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours1" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" InvalidStyle-HorizontalAlign="Left" MaxValue="16"
                                                    MinValue="0" NumberFormat-DecimalDigits="2" NumberFormat-KeepTrailingZerosOnFocus="true"
                                                    ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>' ReadOnlyStyle-CssClass="timeEntryReadOnly"
                                                    Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours1") %>' ClientEvents-OnBlur="blur"
                                                    ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday2 %> <%# Day2Type %> <%# Day2("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours2" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" InvalidStyle-HorizontalAlign="Left" MaxValue="16"
                                                    MinValue="0" NumberFormat-DecimalDigits="2" NumberFormat-KeepTrailingZerosOnFocus="true"
                                                    ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>' ReadOnlyStyle-CssClass="timeEntryReadOnly"
                                                    Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours2") %>' ClientEvents-OnBlur="blur"
                                                    ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday3 %> <%# Day3Type %> <%# Day3("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours3" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" MaxValue="16" MinValue="0" NumberFormat-DecimalDigits="2"
                                                    NumberFormat-KeepTrailingZerosOnFocus="true" ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                                    ReadOnlyStyle-CssClass="timeEntryReadOnly" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours3") %>'
                                                    ClientEvents-OnBlur="blur" ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday4 %> <%# Day4Type %> <%# Day4("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours4" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" MaxValue="16" MinValue="0" NumberFormat-DecimalDigits="2"
                                                    NumberFormat-KeepTrailingZerosOnFocus="true" ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                                    ReadOnlyStyle-CssClass="timeEntryReadOnly" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours4") %>'
                                                    ClientEvents-OnBlur="blur" ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday5 %> <%# Day5Type %> <%# Day5("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours5" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" MaxValue="16" MinValue="0" NumberFormat-DecimalDigits="2"
                                                    NumberFormat-KeepTrailingZerosOnFocus="true" ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                                    ReadOnlyStyle-CssClass="timeEntryReadOnly" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours5") %>'
                                                    ClientEvents-OnBlur="blur" ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday6 %> <%# Day6Type %> <%# Day6("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours6" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" MaxValue="16" MinValue="0" NumberFormat-DecimalDigits="2"
                                                    NumberFormat-KeepTrailingZerosOnFocus="true" ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                                    ReadOnlyStyle-CssClass="timeEntryReadOnly" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours6") %>'
                                                    ClientEvents-OnBlur="blur" ClientEvents-OnFocus="focus" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday7 %> <%# Day7Type %> <%# Day7("ddd") %> hours">
                                                <telerik:RadNumericTextBox ID="uxHours7" runat="server" AllowOutOfRangeAutoCorrect="false"
                                                    EmptyMessage="0.00" EmptyMessageStyle-CssClass="timeEntryEmpty" EnabledStyle-HorizontalAlign="Right"
                                                    FocusedStyle-CssClass="timeEntryFocus" HoveredStyle-CssClass="timeEntryHover"
                                                    IncrementSettings-Step=".25" MaxValue="16" MinValue="0" NumberFormat-DecimalDigits="2"
                                                    NumberFormat-KeepTrailingZerosOnFocus="true" ReadOnly='<%# DataBinder.Eval(Container.DataItem, "IsClosed") %>'
                                                    ReadOnlyStyle-CssClass="timeEntryReadOnly" Width="100%" Text='<%# DataBinder.Eval(Container.DataItem, "Hours7") %>'
                                                    ClientEvents-OnBlur="blur" ClientEvents-OnFocus="focus" />
                                            </td>
                                        </tr>
                                    </table>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <table cellpadding="0" cellspacing="0" width="100%" class="timeEntry">
                                        <tr>
                                            <td align="center" valign="middle" class="<%# IsToday1 %> <%# Day1Type %> <%# Day1("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary1" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[0] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday2 %> <%# Day2Type %> <%# Day2("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary2" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[1] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday3 %> <%# Day3Type %> <%# Day3("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary3" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[2] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday4 %> <%# Day4Type %> <%# Day4("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary4" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[3] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday5 %> <%# Day5Type %> <%# Day5("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary5" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[4] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday6 %> <%# Day6Type %> <%# Day6("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary6" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[5] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                            <td align="center" valign="middle" class="<%# IsToday7 %> <%# Day7Type %> <%# Day7("ddd") %> summary">
                                                <telerik:RadNumericTextBox ID="uxSummary7" runat="server" EmptyMessage="0.00" EnabledStyle-HorizontalAlign="Right"
                                                    ForeColor="#4B4B4B" NumberFormat-DecimalDigits="2" ReadOnly="true" Width="100%"
                                                    Value='<%# HourSummary[6] %>' ClientEvents-OnLoad="registerSummary" />
                                            </td>
                                        </tr>
                                    </table>
                                </FooterTemplate>
                            </telerik:GridTemplateColumn>
                            <%-- DELETE --%>
                            <telerik:GridButtonColumn ButtonType="ImageButton" HeaderStyle-Width="25px" HeaderStyle-HorizontalAlign="Center"
                                ItemStyle-HorizontalAlign="Center" ConfirmText="Delete this entry?" ConfirmDialogType="RadWindow"
                                ConfirmTitle="Delete" CommandName="Delete" Text="Delete" UniqueName="DeleteColumn" />
                        </Columns>
                    </MasterTableView>
                </telerik:RadGrid>
            </ContentTemplate>
        </container:LinedGreyTop>
    </telerik:RadAjaxPanel>

  4. Cori
    Cori avatar
    562 posts
    Member since:
    Jul 2010

    Posted 29 Oct 2010 Link to this post

    Hello Brad,

    Have you tried testing your project without the use of ajax. The DoPostBackWithOptions is added by the RadAjaxPanel. For it to work with ajax you'll need to modify your blockConfirm method, so it's called from the OnRequestStart client-side method of RadAjaxPanel and then cancel or proceed with the ajax call from there. To make sure the blockConfirm method is only called on the button click, you'll need to check the get_eventTarget property and make sure it matches the button's id property. Inside that the OnRequestStart, for the blockConfirm, you could probably use a similar approach like in this forum post:

    http://www.telerik.com/community/forums/aspnet-ajax/menu/blockconfirm-on-radmenuitemclicking-event.aspx

    Where you can pass eventArgs.get_domEvent() to your blockConfirm method.

    I hope that helps.
  5. Answer
    Fiko
    Admin
    Fiko avatar
    1406 posts

    Posted 02 Nov 2010 Link to this post

    Hi Guys,

    I recommend you this very simple approach in order to simulate blocking the execution thread:
    1. Implement the handler in this way:
      function OnClientClickHandler(clickedButton)
      // Button is clicked
          function callbackFunction(arg)
          {
              if (arg)
              {
                  // Continue postback
                  __doPostBack(clickedButton.name, ""); // Actual postback
              }
          }
          radconfirm("Are you sure", callbackFunction, 300, 100, null, "Delete an item");
      }
    2. Attach the handler as shown bellow:
      <asp:Button ID="Button1" runat="server" Text="Delete" OnClientClick="OnClientClickHandler(this); return false;"
          OnClick="Button1_Click" />

    For your convenience I have attached a demo project to the thread.

    Regards,
    Fiko
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Brad
    Brad avatar
    39 posts
    Member since:
    Aug 2010

    Posted 02 Nov 2010 Link to this post

    If this works then how come everywhere you look there are outrageously complex scripts with users whining about there being no one-liner implementations of this and Telerik complaining back that the outrageously complex methods are the only way around the problem of browser-thread-blocking?
  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 03 Nov 2010 Link to this post

    Hello Brad,

    In short - because the different approaches depend on the exact scenario that the customer is having.


    Sincerely yours,
    Georgi Tunev
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top