Inline Editing with radgrid and need to bind javascipt runtim

2 posts, 1 answers
  1. Amitkumar
    Amitkumar avatar
    66 posts
    Member since:
    Aug 2009

    Posted 24 Feb 2010 Link to this post

    Hello All,

    I am using RadGrid in UserControl, and that user control call from aspx page,

    I am using RadGrid with inline editing to insert, and update records, during editing when i click on save button(i.e. Image) that time it will fire the following event, and based on proxyAttendeeAvailable.IsInvitedOrBookedForAnyAgenda(eventAttendeeId, (System.DateTime)rdpDate.SelectedDate, (System.DateTime)rtpTimeFrom.SelectedDate, (System.DateTime)rtpTimeTo.SelectedDate) function result bind the javascipt function and it should fire the javascript function mention below, what was wrong with javascipt binding, and why javascipt function is not executed.

    protected void rgAvailability_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        if (!e.Item.OwnerTableView.IsItemInserted)
                    AttendeeAvailableDateAndTimeService.AttendeeAvailableDateAndTimeClient proxyAttendeeAvailable = new ePlannerPro2Client.AttendeeAvailableDateAndTimeService.AttendeeAvailableDateAndTimeClient();

                        RadDatePicker rdpDate = e.Item.FindControl("txtAvailableDate") as RadDatePicker;
                        RadTimePicker rtpTimeFrom = e.Item.FindControl("txtTimeFrom") as RadTimePicker;
                        RadTimePicker rtpTimeTo = e.Item.FindControl("txtTimeTo") as RadTimePicker;

                        System.DateTime vsDate = System.Convert.ToDateTime(ViewState["AvailabilityDate"].ToString());
                        System.DateTime vsFromTime = System.Convert.ToDateTime(ViewState["AvailabilityTimeFrom"].ToString());
                        System.DateTime vsToTime = System.Convert.ToDateTime(ViewState["AvailabilityTimeTo"].ToString());

                        System.Guid eventAttendeeId = System.Guid.Empty;

                        if (CurrentUser != null && !CurrentUser.EventAttendeeId.Equals(System.Guid.Empty))
                            eventAttendeeId = CurrentUser.EventAttendeeId;

                        if (!vsDate.Equals(rdpDate.SelectedDate) || !vsFromTime.Equals(rtpTimeFrom.SelectedDate) || !vsToTime.Equals(rtpTimeTo.SelectedDate) && !System.Convert.ToBoolean(hfResult.Value))
                            if (proxyAttendeeAvailable.IsInvitedOrBookedForAnyAgenda(eventAttendeeId, (System.DateTime)rdpDate.SelectedDate, (System.DateTime)rtpTimeFrom.SelectedDate, (System.DateTime)rtpTimeTo.SelectedDate))
                                StringBuilder controls = new StringBuilder();
                                ImageButton updateBtn = e.Item.FindControl("UpdateButton") as ImageButton;

                                if (updateBtn != null)
                                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                                    sb.Append(@"IsInvited('" + updateBtn.UniqueID + "');");
                                    RadScriptManager.RegisterStartupScript(updateBtn, this.GetType(), "PopupUpdateMsg", sb.ToString(), false);
                            hfResult.Value = "true";

                        bool isValid = false;

                        if (System.Convert.ToBoolean(hfResult.Value))
                            isValid = SubmitRecord(source, e);

                        if (isValid == false)
                            e.Canceled = true;
                    catch { }
                        if (proxyAttendeeAvailable != null)
                            proxyAttendeeAvailable = null;

    <telerik:RadCodeBlock ID="RadCode" runat="server">
        <script language="javascript" type="text/javascript">
            function IsInvited(sender) {
                alert('Is Invited');
                document.getElementById("<%=hfResult.ClientID %>").value = false;

                var valid = confirm("One of the existing agenda falls outside the updated availibility date and time, would you like to continue?");
                if (valid) {
                    document.getElementById("<%=hfResult.ClientID %>").value = valid;
                    __doPostBack(sender, '');
                    return true;

                return false;

    Thanks in Advance

  2. Answer
    Mira avatar
    1124 posts

    Posted 26 Feb 2010 Link to this post

    Hello Amit,

    Please take a look at the RADAjax Manager does not load JS files in dynamically loaded user control forum topic and the attached to it projects to see various ways for implementing the desired functionality.

    I hope you find it useful.

    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