Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
548 views
Hi, I have an issue that I can't solve with RadWindow and RadAjaxManager

When the user closes a RadWindow after editing something (for example editing an appointment from RadGrid or editing a row from RadSchedule), and clicks the OK button (that does something server side with a callback in C#), the control will postback despire RadAjaxManager setting. This is very annoying because the page is entirely redrawn.

When the user open the popup (that is also a server side event) RadAjaxManager works correctly and postback does not happen.

Any Idea?

This is my scenario taken by the example of editing a radschedule with a custom radwindow popup:

Radmanager is

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>                       
           <telerik:AjaxSetting AjaxControlID="RadScheduler1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="calendarPopup" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnOk">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnCancel">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadScheduler1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>


Here is the RadWindow:

<telerik:RadWindow ID="calendarPopup" runat="server" Skin="Windows7" AutoSize="True"
                            Animation="Fade" EnableShadow="True" Modal="True" Opacity="100">
                            <Localization Maximize="<%$ Resources:RadWindow, Maximize %>" Minimize="<%$ Resources:RadWindow, Minimize %>"
                                Close="<%$ Resources:RadWindow, Close %>" PinOff="<%$ Resources:RadWindow, PinOff %>"
                                PinOn="<%$ Resources:RadWindow, PinOn %>" Reload="<%$ Resources:RadWindow,Reload %>"
                                Restore="<%$ Resources:RadWindow, Restore%>" Cancel="<%$ Resources:RadWindow, Cancel %>" />
                            <ContentTemplate>
                                <table width="100%">
                                    <tr>
                                        <td>
                                            <asp:Literal ID="lblAppointmentName" runat="server" Text="Nome del Calendario"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtAppointmentName" runat="server" Width="250px"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:Literal ID="lblAppointmentDescription" runat="server" Text="Descrizione Evento"></asp:Literal>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <asp:TextBox ID="txtAppointmentDescription" runat="server" Width="250px" TextMode="MultiLine"
                                                Height="200"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="float: right;">
                                            <br />
                                            <telerik:RadButton ID="btnOk" runat="server" Text="Salva" OnClick="btnOk_Click" Skin="Windows7">
                                                <Icon PrimaryIconCssClass="rbOk" PrimaryIconLeft="4" PrimaryIconTop="4" />
                                            </telerik:RadButton>
                                            <telerik:RadButton ID="btnCancel" runat="server" Text="Annulla" OnClick="btnCancel_Click"
                                                Skin="Windows7">
                                                <Icon PrimaryIconCssClass="rbCancel" PrimaryIconLeft="4" PrimaryIconTop="4" />
                                            </telerik:RadButton>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </telerik:RadWindow>

Here is the Callback used to open the popup (that works with ajax)

protected void RadScheduler1_FormCreating(object sender, SchedulerFormCreatingEventArgs e)
        {
            e.Cancel = true;
 
            switch (e.Mode)
            {
                case SchedulerFormMode.AdvancedEdit:
                case SchedulerFormMode.Edit:
                    {
                        calendarPopup.Title = "Edit Appointment";
 
                        // Edit inizializing code here
                    }
                    break;
                case SchedulerFormMode.AdvancedInsert:
                case SchedulerFormMode.Insert:
                    {
                        calendarPopup.Title = "Create Appointment";
 
                        txtAppointmentName.Text = String.Empty;
                        txtAppointmentDescription.Text = String.Empty;
                    }
                    break;
            }
 
            //This will open the popup!
            string script = "function f(){$find(\"" + calendarPopup.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }


And Here is the callback that does not work.. because every time it closes the popup it will redraw the entire page:

protected void btnCancel_Click(object sender, EventArgs e)
        {
            //This will close the popup!
            string script = "function f(){$find(\"" + calendarPopup.ClientID + "\").hide(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
        }
 
         protected void btnOk_Click(object sender, EventArgs e)
         {
             //This will close the popup!
             string script = "function f(){$find(\"" + calendarPopup.ClientID + "\").hide(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
             ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
 
//Creating or Saving appointment here
         }


Where am I Wrong? The same behaviour happens with the RadGrid. I suppose it is a wrong AjaxManager Setting.. but I read carefully and I didn't find nothing for my scenario.

Thanks for any help 
Marin Bratanov
Telerik team
 answered on 18 Oct 2013
4 answers
1.7K+ views
Hey everyone,

I have a RadGrid with which i am using Advance Data binding using NeedDataSource Event.I have form template inside asp panel for inserting and editing into grid.Panel consists of 2 buttons save and cancel.On save button the items actually got inserted or edited in the grid but are'nt visible until i load the whole form again(debugging it again..!!).I mean i want the grid to be reloaded on every insert,delete or update,which is not happening.Do i have to call this event every time i perform a manual insert or update?....

Thanks
Amit
Radoslav
Telerik team
 answered on 18 Oct 2013
15 answers
3.2K+ views
Hi there

I have a radgrid with gridtemplatecolumns

In 3 of the edit item template columns I have text boxes

All 3 text boxes have standard .net required field validators which are disabled by default

However, If a user enters text in any one of the 3 text boxes then I want to enable the required field validators for the remaining 2. 

If the user clears all the text boxes, then the validators should be disabled again for all 3 text boxes

In other words, either all 3 text boxes must have values, or all 3 text boxes must be empty (in either insert or edit mode) in order to validate

Does anyone know how this can be accomplished client side (and server side if poss)?

Thanks in advance :-)
Konstantin Dikov
Telerik team
 answered on 18 Oct 2013
5 answers
137 views
I have the following RadDropDownTree on my page:

<telerik:RadDropDownTree ID="rddtrForeas" runat="server" 
  EnableFiltering="True"
  DefaultMessage="Select sth"
  DataTextField="Title"           
  DataFieldID="SomeId"  
  CheckBoxes="SingleCheck"            
  ExpandNodeOnSingleClick="true"  
  D
ataValueField="SomeId"  
  DefaultValue="-1" 
  DataFieldParentID="ParentId">
     <ButtonSettings ShowCheckAll="False" ShowClear="true"></ButtonSettings>
     <DropDownSettings Height="400" AutoWidth="Enabled" CssClass="mis-rddtree" OpenDropDownOnLoad="False" ></DropDownSettings><br>           
     <
FilterSettings Filter="Contains" FilterTemplate="ByText" Highlight="Matches" EmptyMessage="Write here for filtering" ></FilterSettings>
</telerik:RadDropDownTree>

In my code behind inside Page_Load  I set the DataSource to a list of three items. I then perform data bind and then set the
SelectedValue to the Ids of the first and second item.

I have noticed that if the "Title" field of my objects contains two consecutive blank spaces or ends with a blank space the drop down
tree control does not function properly. I.e. you cannot deselect in any way the node with the "problematic" title.

Peter Filipov
Telerik team
 answered on 18 Oct 2013
3 answers
160 views
Hi,

I have developed a database driven web application which when loaded for the first time needs to fetch some heavy data from the server.
I don't want the user to see the white screen for a minute or so before the application actually appears. So i want to show the loading sign showing percentage or a bar which shows that the application being loaded and user knows that application will be there after the loading finishes (eg. just as when we login to gmail, before showing the mails a nice loading sign is there showing the percentage of data processed.)

Can anyone help in this topic. It will be really great help.

Thanks in advance.
Galin
Telerik team
 answered on 18 Oct 2013
3 answers
255 views
Hi,

I'm using a modal RadWindow control as a popup which allows users to select certain elements for processing.  When this processing successfully completes, the RadWindow uses the RegisterStartupScript method of the ScriptManager object to call a Javascript function which closes the RadWindow and runs another Javascript function on the parent page to refresh a RadGrid control.

In the RadWindow code behind, the button that initiates the processing is tied to a RadAjaxPanel control for the purpose of displaying a LoadingPanel.  I am overriding the OnError event to capture and record the details of any error that bubbles up from the other application layers.

The code works wonderfully when the processing completes successfully, or when a user clicks on a "cancel" button to exit the RadWindow and return to the parent page.  However, if there is an error, I can't figure out how to get the RadWindow to close.  I'm using IE 7, and all I see is the yellow "warning" triangle that contains mention of an error message to the effect of "'length' is null or not an object" (although I'm not using the "length" property of anything, referencing arrays, etc. in my code).

In the overridden OnError event, I've tried using ScriptManager.RegisterStartupScript and ClientScript.RegisterStartupScript, and good old Response.Write() to try to get the page to run any Javascript after the error--but nothing is working.  Any ideas on what I'm missing?  Code is below:

RadWindow definition on the parent page:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"
                <Windows> 
                    <telerik:RadWindow ID="NewSamplePopup" 
                        Behaviors="Move,Pin" 
                        ReloadOnShow="true" 
                        Modal="true" 
                        runat="server" 
                        Height="520" 
                        Width="600" 
                        NavigateUrl="./NewSamplePopup.aspx" 
                        VisibleStatusbar="false" 
                        Title="Getting Available Sample Types...Please Wait" 
                        ShowContentDuringLoad="false"
                    </telerik:RadWindow> 
</telerik:RadWindowManager> 





Javascript definition in the RadWindow's markup:
<body> 
    <telerik:RadCodeBlock runat="server"
        <script type="text/javascript"
            function GetRadWindow() { 
                var oWindow = null
                if (window.radWindow) 
                    oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog        
                else if (window.frameElement.radWindow) 
                    oWindow = window.frameElement.radWindow; //IE (and Moz as well)        
                return oWindow; 
            } 
 
            function RadWindowClose() { 
                GetRadWindow().Close(); 
            } 
             
            function CloseAndRebind(args) { 
                GetRadWindow().Close(); 
                GetRadWindow().BrowserWindow.refreshGrid(args); 
            } 
             
        </script> 
    </telerik:RadCodeBlock> 

Relevant methods from the RadWindow code-behind:
        protected void btnGetTests_Click(object sender, EventArgs e) 
        { 
            // code that throws an error... 
        } 
 
       protected void btnCancel_Click(object sender, EventArgs e) 
        { 
            // close the form - this works!!! 
            ScriptManager.RegisterStartupScript(thisthis.GetType(), "close""RadWindowClose();"true); 
        } 
 
protected override void OnError(EventArgs e) 
        { 
            // At this point we have information about the error 
            HttpContext ctx = HttpContext.Current; 
 
            Exception exception = ctx.Server.GetLastError(); 
            ///////// 
            // Logic to handle error here 
            ///////// 
            ctx.Server.ClearError(); 
 
            // Gets called but doesn't work! 
            ScriptManager.RegisterStartupScript(thisthis.GetType(), "close""RadWindowClose();"true); 
 
        } 

Ultimately I would like the Javascript function to redirect the parent page to a custom error screen.  I'm pretty sure I can do this once I get the RadWindow to execute any Javascript.

Thanks!

Dan

Shinu
Top achievements
Rank 2
 answered on 18 Oct 2013
1 answer
44 views
We are using the RadCalendar on this one page but get this error message when using the http://validator.w3.org HTML validator and HTML 5:

line 254, Column 382: The cellspacing attribute on the table element is obsolete. Use CSS instead. …3-10-15" title="" /><table cellspacing="0" class="rcTable" style="width:100%;">

My question is how do we suppress the cellspacing attribute and only use css to get rid of this error?
Vasil
Telerik team
 answered on 18 Oct 2013
3 answers
357 views

 

Hi,

I am not able to bind the data with custom data attribute.
Is it possible to bind the data in telerik grid control?
I am trying like this..


 

 

<Columns>

  <telerik:GridTemplateColumn Display="false"> 
    <ItemTemplate>
      <asp:Label runat="server" ID="lblRowStyle"  
        data-IsDevStrikeThrough='<%# Bind("IsDevStrikeThrough") %>'
        data-IsDevShowAsterik='<%# Bind("IsDevShowAsterik") %>'
        data-IsDevEditable='<%# Bind("IsDevEditable") %>'/>
    </ItemTemplate>  

  </telerik:GridTemplateColumn>

</Columns>

 

 

 

 

<Columns>

  <telerik:GridTemplateColumn Display="false">

    <ItemTemplate>

      <asp:Label runat="server" ID="lblRowStyle"  
       data-IsDevStrikeThrough='<%# DataBinder.Eval(Container, "Attributes['IsDevStrikeThrough']") %>'
       data-IsDevShowAsterik='<%# DataBinder.Eval(Container, "Attributes['IsDevShowAsterik']") %>'
       data-IsDevEditable='<%# DataBinder.Eval(Container, "Attributes['IsDevEditable']")/>
     </ItemTemplate>  

  </telerik:GridTemplateColumn>

</Columns>

 

Kindly do the needful...

Kostadin
Telerik team
 answered on 18 Oct 2013
3 answers
186 views
I have written a javascript function which filters items in a radgrid depending on options that have been specified in a listbox by the user. This worked perfectly until I added a pager, which causes there to be less items on the page than the page size states. Is there anyway of, firstly accessing all rows in a grid (client-side) when a pager is in place, and secondly, forcing re-paging of the radgrid after rows have been hidden.

the javascript method i have implemented basically does this...

 

for (var i = 0; i < masterView.get_dataItems().length; i++) {
    var aCell= masterView.getCellByColumnUniqueName(masterView.get_dataItems()[i], "aCell")

 

 

 

    if (aCell!= null) {

 

 

        var cellValue = aCell.innerHTML;

 

 

 

        if (Exists(filterListbox.get_checkedItems(), cellValue) == false) {

 

            masterView.hideItem(i);

 

            continue;

 

        }
    }
    //now re-set paging so it still displays x items instead of x-(hidden item count)
 }

Konstantin Dikov
Telerik team
 answered on 18 Oct 2013
1 answer
38 views
Hi,
I need to create doctor wise slots can i do with app schedular
Plamen
Telerik team
 answered on 18 Oct 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?