Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
389 views

Below is my scenario:

Scenario:

1. I have one telerik:RadAjaxManager which has telerik:AjaxSettings. In it, AjaxControlID is a button Id and AjaxUpdatedControl is a table which contains that button along with few textboxes, requiredfieldvalidators for them and one server side button.

2. The button has onclientclick and onclick events registered.

3. Onclientclick event calls a simple javascript function which does some validation of form data and returns true or false. (OnClientClick="return ValidatePage();")

4. Onclick event calls some server side implementation.

 Behavior:

1. When a button is clicked,  requiredfieldvalidators (only checks if data is entered) gets fired.

2. When data is entered in the textboxes, javascript function 'ValidatePage()' (checks if VALID data is entered) gets fired.

3. When ValidatePage() returns false, server side event doesn't get fired.(Which is desired behavior)

4. When ValidatePage() returns true, still server side event doesn't get fired.(Which is not desired behavior)

5. When OnclientClick event registration is removed, the server side event gets fired through AJAX after entering data in the textboxes.

6. When button is moved out of the table, both, the javascript function and the server side event gets fired but normal postback occurs.

Desired behavior:

1. First requiredfieldvalidators should get fired.

2. Then 'ValidatePage()' should get fired. If it returns false, it should restrict server side call. If it returns true, server side event should get called through AJAX.

Please let me know if you have any comments on it.

Regards,

Shubha
Kostadin
Telerik team
 answered on 07 Feb 2013
3 answers
214 views

Hello,

When opening a RadWindow via .setUrl and .show(), two postbacks are envoked on the destination page, one for .setUrl and one for .show().

Is it possible to only cause one postback?

Below is sample code:

I cannot use navigateUrl of RadWindow because I need to pass querystring values.

I cannot use radopen() function because of styling issues.

RadWindowDoublePostback.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadWindowDoublePostback.aspx.cs" Inherits="WebApplication1.RadWindowDoublePostback" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">

        </telerik:RadScriptManager>

        <asp:Button Text="ShowWindow" runat="server" ID="Button1" OnClientClick="showWindow(); return false;"/>

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server">

            <Windows>

                <telerik:RadWindow ID="RadWindow1" runat="server" ReloadOnShow="true">

                </telerik:RadWindow>

            </Windows>

        </telerik:RadWindowManager>

        <script type="text/javascript">

            function showWindow() {

                //var oWnd = radopen("RadWindowCloseDialog.aspx", "RadWindow1");

                var oWnd = $find("<%= RadWindow1.ClientID %>");

                if (oWnd) {

                    oWnd.setUrl('<%= ResolveUrl("RadWindowDoublePostbackDiaolog.aspx") %>');

                    oWnd.show();

                }

            }

        </script>

    </div>

    </form>

</body>

</html>


RadWindowDoublePostbackDiaolog.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="RadWindowDoublePostbackDiaolog.aspx.cs" Inherits="WebApplication1.RadWindowDoublePostbackDiaolog" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

</head>

<body>

    <form id="form1" runat="server">

    <div>

        RadWindowDoublePostbackDiaolog

    </div>

    </form>

</body>

</html>

Is it possible to only cause one postback when I open the window?

Thanks!

Marin Bratanov
Telerik team
 answered on 07 Feb 2013
4 answers
183 views
Hey at Telerik

I have tried for hours now to show/hide columns depending on the selected index of an in a RadGrid imbedded RadComboBox.

The problem is that if i try to rebind in the SelectedIndexChanged event of the imbedded RadComboBox the Inserted Item is disposed.

If i don't rebind the visibility of the columns are not refreshed.

protected void rgvEgenskaber_PreRender(object sender, EventArgs e)
    {
        if (this.rgvEgenskaber.MasterTableView.IsItemInserted || this.rgvEgenskaber.EditItems.Count > 0)
        {
            GridEditableItem gridEditableItem = null;
            if (this.rgvEgenskaber.MasterTableView.IsItemInserted)
                gridEditableItem = this.rgvEgenskaber.MasterTableView.GetInsertItem();
            else
                gridEditableItem = this.rgvEgenskaber.EditItems[0] as GridEditableItem;
            DLDataContext dLDataContext = new DLDataContext();
            Egenskab egenskab = dLDataContext.Egenskabs.First(eg => eg.Egenskabid.Equals(Guid.Parse(((RadComboBox)((GridDataItem)gridEditableItem)["EgenskabID"].Controls[1]).SelectedValue)));
            //if (gridEditableItem.DataItem != null)
            //{
            this.rgvEgenskaber.MasterTableView.Columns.OfType<GridColumn>().Where(c => c.UniqueName.Equals("Valglistevaerdi") || c.UniqueName.Equals("Decimalvaerdi") || c.UniqueName.Equals("Heltalsvaerdi")).ToList().ForEach(c => c.Visible = false);
            switch (egenskab.Type)
            {
                case "H":
                    this.rgvEgenskaber.MasterTableView.GetColumn("Heltalsvaerdi").Visible = true;
                    break;
                case "D":
                    this.rgvEgenskaber.MasterTableView.GetColumn("Decimalvaerdi").Visible = true;
                    break;
                case "V":
                    this.rgvEgenskaber.MasterTableView.GetColumn("Valglistevaerdi").Visible = true;
                    break;
                default:
                    break;
            }
        }
    }
protected void rcbEgenskabID_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        this.rgvEgenskaber.MasterTableView.Rebind();
  }

 

protected void rgvEgenskaber_ItemCommand(object source, GridCommandEventArgs e)
    {
        switch (e.CommandName)
        {
            case RadGrid.InitInsertCommandName:
                e.Canceled = true;
                if (Request.QueryString["elementType"] != null && Request.QueryString["elementId"] != null)
                {
                    string elementType = Request.QueryString["elementType"];
                    string elementId = Request.QueryString["elementId"];
                    DLContext.DLDataContext dLDataContext = new DLDataContext();
                    Bestemmelse bestemmelse = dLDataContext.Bestemmelses.First(b => b.Bestemmelseid.Equals(Guid.Parse(elementId)));
                    Egenskab egenSkab = dLDataContext.Egenskabs.First();
                    Egenskabsforklaring egenskabsforklaring = dLDataContext.Egenskabsforklarings.First();
                    if (!e.Item.OwnerTableView.IsItemInserted)
                        e.Item.OwnerTableView.InsertItem(new Egenskabsvaerdi() { Egenskabsvaerdiid = Guid.NewGuid(),  Egenskab = egenSkab, Egenskabsforklaring = egenskabsforklaring, Bestemmelse = bestemmelse });
                }
                break;
            case RadGrid.PageCommandName:
                break;
            default:
                break;
        }
    }

 

I hope you can help me with this problem.

Sincerly Jan

Maria Ilieva
Telerik team
 answered on 07 Feb 2013
3 answers
103 views


I am trying to update a grid that is bound.  When I hit the javascript code that does the close and rebind the args are undefined (see code snippet 1.  As I step through the server side code all looks good. I tried using both ScriptManager and ClientScript.  Any thoughts???  thanks...
code snippet 1....
            function CloseAndRebind(args) {
                alert('args ' + args);
                GetRadWindow().BrowserWindow.refreshGrid(args);
                GetRadWindow().close();
            }

code snippet 2...
        protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
        {
            if (e.CommandName == "Update")
            {
                //ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
                ScriptManager.RegisterStartupScript(this,Page.GetType(), "mykey", "CloseAndRebind();", true);
            }
}

protected void DetailsView1_ItemUpdating(object sender, DetailsViewUpdateEventArgs e)
        {
            //logic to truncate long string to prevent SQL error
            for (int i = 1; i < 6; i++)
            {
                string val = e.NewValues[i - 1].ToString();
                int maxLength = i * 10;
                if (val.Length > maxLength) e.NewValues[i - 1] = val.Substring(0, maxLength);
            }
        }
Maria Ilieva
Telerik team
 answered on 07 Feb 2013
5 answers
125 views
hi, i am having an issue on Splitter and its radslidingpane on IE8. When i set the splitter to a certain height (from my case 95-97%), the sliding event will keep looping the browser resize event. Any idea how this will happen?
Vessy
Telerik team
 answered on 07 Feb 2013
1 answer
869 views

How can I stop timer(in other words stop browser refresh/page refresh), while dragging a task from RadGrid to RadScheduler and how can I start timer(in other words start browser refresh/page refresh), after the task is dropped.
My drag and drop is similar to this demo
http://demos.telerik.com/aspnet-ajax/scheduler/examples/draganddropintegration/defaultcs.aspx?product=scheduler

This is my code for RadScheduler:
<telerik:RadScheduler ID="rsTicketsSchedule" runat="server" AllowInsert="False" DisplayDeleteConfirmation="False"
                            Localization-HeaderToday="Today" EnableCustomAttributeEditing="True" EnableDescriptionField="True"
                            Height="100%" EnableExactTimeRendering="true" EnableViewState="true" OverflowBehavior="Scroll"
                            ShowAllDayRow="false" OnAppointmentDataBound="TicketsSchedule_AppointmentDataBound"
                            OnNavigationComplete="rsTicketsSchedule_NavigationComplete" OnNavigationCommand="rsTicketsSchedule_NavigationCommand"
                            OnTimeSlotCreated="rsTicketsSchedule_TimeSlotCreated" OnAppointmentUpdate="onApptUpdate"
                            OnClientAppointmentDoubleClick="rsClientAppointmentDoubleClick" OnClientAppointmentClick="singleClick"
                            OnClientAppointmentContextMenu="CheckTimerStatus" OnClientAppointmentContextMenuItemClicked="handleClick"
                            OnClientFormCreated="ClientFormCreated" OnDataBound="rsTicketsSchedule_DataBound"
                            OnClientAppointmentMoveEnd="AppointmentMoved" OnClientAppointmentDeleting="OnClientAppointmentDeleting"
                            OnClientAppointmentMoveStart="StopTimer" 
                            CustomAttributeNames="HasAttachment"    DataReminderField="Reminder" OnClientAppointmentEditing= "StopTimer"    >
                           <AppointmentTemplate>
                                 <div>
                                         <asp:Panel ID="RecurrencePanel" CssClass="rsAptRecurrence" runat="server" Visible="false" />
                                         <asp:Panel ID="RecurrenceExceptionPanel" CssClass="rsAptRecurrenceException" runat="server"
                                              Visible="false" />
                                       <%--  <asp:Panel ID="ReminderPanel" CssClass="rsAptReminder" runat="server" Visible="true" />--%>
                                         <div id="ApptImageDiv" style="text-align:right; position:absolute; width:95%;" >
                                             <asp:Image ID="ApptAttachmentImg" runat="server"  Width="16px" Height="17px" style=" margin-right:5px; background:url(img/sprite-alpha.png)-166px -34px no-repeat; background-position: -98px -66px; border:transparent; " 
                                                           Visible='<%# String.IsNullOrEmpty(Container.Appointment.Attributes["HasAttachment"])? false : Boolean.Parse(Container.Appointment.Attributes["HasAttachment"]) %>'
                                              />
                                          </div>
                                         <%#Eval("Subject") %>     
                                  
                                  </div>
                            </AppointmentTemplate    >
                        
                            <AppointmentContextMenus     >
                            </AppointmentContextMenus>
                            <DayView UserSelectable="True" GroupBy="TechName" GroupingDirection="Horizontal" />
                            <WeekView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical" />
                            <MonthView UserSelectable="True" GroupBy="TechName" GroupingDirection="Vertical" />
                            <TimelineView ColumnHeaderDateFormat="h:mm tt" GroupingDirection="Vertical" HeaderDateFormat="MM/dd/yyyy h:mm tt"
                                NumberOfSlots="21" SlotDuration="00:30:00" StartTime="08:00:00" />
                            <AdvancedForm EnableCustomAttributeEditing="True" Modal="True" />
                            <ResourceTypes>
                                <telerik:ResourceType Name="TechName" />
                                <telerik:ResourceType Name="TicketState" />
                            </ResourceTypes>
                            <Reminders Enabled="true"></Reminders>
                                
                        </telerik:RadScheduler>

Thanks for your help in advance

Boyan Dimitrov
Telerik team
 answered on 07 Feb 2013
8 answers
219 views

Hi!


I'm trying to use RadRotator as a simple thumb rotative Image Gallery. I would like to show the loading gif while the image is not fully loaded and visible in the client. My problem is to remove the background Loading image. Is there anyway of doing that? I've tried to use the onload image DOM event to run javascript that does the pretended, but I can't know which image fired the function :-|.

The desired effect is this.

Regards,
Rodrigo S.
Martin Roussel
Top achievements
Rank 1
 answered on 07 Feb 2013
1 answer
86 views
Hi

I need to make grid pager look like as show on http://knox.netliance.net/Pump/IndexUI.aspx
but not able to make it like that.

Can you please help me for css?

Regards
Atul Kumar Srivastav
Princy
Top achievements
Rank 2
 answered on 07 Feb 2013
7 answers
314 views
Hi, I have a RadGrid defined below. When I click the built-in "Export to PDF" button I get the error listed below:

<telerik:RadGrid ID="RadGrid4" runat="server" Width="99.7%" PageSize="20" AllowPaging="false"
                            AllowSorting="True" AllowFilteringByColumn="false" AllowMultiRowSelection="True"
                            ShowGroupPanel="false" GridLines="None" ShowFooter="false" ShowHeader="true" GroupingEnabled="false"
                            Skin="WebBlue" EnableHeaderContextAggregatesMenu="false" EnableHeaderContextMenu ="false"
                            AutoGenerateColumns="false" EnableViewState="True"
                            OnItemCommand="RadGrid4_OnItemCommand" OnDetailTableDataBind="RadGrid4_DetailTableDataBind" OnItemDataBound="RadGrid4_OnItemDataBound" OnNeedDataSource="RadGrid4_NeedDataSource"
                            OnGroupsChanging="RadGrid4_OnGroupsChanging" OnColumnsReorder="RadGrid4_OnColumnsReorder">
                             
                            <MasterTableView HierarchyLoadMode="ServerBind"
                             CommandItemDisplay="Top" CommandItemSettings-ShowAddNewRecordButton="false"
                             CommandItemSettings-ShowExportToExcelButton="true" CommandItemSettings-ShowExportToWordButton="true"
                             CommandItemSettings-ShowExportToPdfButton="true" CommandItemSettings-ShowExportToCsvButton="true" AllowMultiColumnSorting="true"
                             Caption="">
 
                                 <Columns>
                                        <telerik:GridTemplateColumn HeaderText="Name" meta:resourcekey="labName" UniqueName="strEnterpriseSiteContactNameValue" HeaderStyle-Width="50%" Resizable="true" Reorderable="true" SortExpression="strEnterpriseSiteContactNameValue">
                                            <ItemTemplate>
                                              <%# Eval("strEnterpriseSiteContactNameValue")%>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
 
                                        <telerik:GridTemplateColumn HeaderText="Title" meta:resourcekey="labTitle" UniqueName="strEnterpriseSiteContactTitleValue" HeaderStyle-Width="50%" Resizable="true" Reorderable="true" SortExpression="strEnterpriseSiteContactTitleValue">
                                            <ItemTemplate>
                                              <%# Eval("strEnterpriseSiteContactTitleValue")%>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
 
                                        <telerik:GridTemplateColumn HeaderText="Company" meta:resourcekey="labCompany" UniqueName="strEnterpriseSiteContactCompanyValue" HeaderStyle-Width="50%" Resizable="true" Reorderable="true" SortExpression="strEnterpriseSiteContactCompanyValue">
                                            <ItemTemplate>
                                              <%# Eval("strEnterpriseSiteContactCompanyValue")%>
                                            </ItemTemplate>
                                        </telerik:GridTemplateColumn>
                                        
                                  </Columns> 
 
                                        <DetailTables>
                                            <telerik:GridTableView ShowHeader="false" Name="Detail">
                                                <Columns>
                                                    <telerik:GridTemplateColumn HeaderText="" UniqueName="strEnterpriseSiteContactField" HeaderStyle-Width="25%" ItemStyle-CssClass="GridFieldColumn" Resizable="true" Reorderable="true">
                                                        <ItemTemplate>
                                                          <%# Eval("strEnterpriseSiteContactField")%>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                    <telerik:GridTemplateColumn HeaderText="" UniqueName="strEnterpriseSiteContactFieldValue" HeaderStyle-Width="75%" Resizable="true" Reorderable="true">
                                                        <ItemTemplate>
                                                          <%# Eval("strEnterpriseSiteContactFieldValue")%>
                                                          <asp:HyperLink ID="hlEnterpriseSiteContact" Target="_blank" runat="server" Text='<%# Eval("strEnterpriseSiteContactLinkResource")%>' NavigateUrl='<%# Eval("strEnterpriseSiteContactLinkValue")%>'></asp:HyperLink>
                                                          <asp:Image runat="server" ID="imageProfile" ImageUrl='<%# "ImageHandler.ashx?FileLocation=" + DataBinder.Eval(Container.DataItem, "strEnterpriseSiteContactProfileImageDirectoryPath") + "&FileName=" + DataBinder.Eval(Container.DataItem, "strEnterpriseSiteContactProfileImageFilePath") %>' AlternateText="" Height="80px" Width="65px" BorderWidth="0"></asp:Image>
                                                        </ItemTemplate>
                                                    </telerik:GridTemplateColumn>
                                                </Columns>  
                                            </telerik:GridTableView>
                                        </DetailTables>
 
                            </MasterTableView>
 
                            <PagerStyle Mode="NextPrevAndNumeric"></PagerStyle>
 
                                    <ClientSettings AllowRowsDragDrop="false" AllowDragToGroup="false" AllowColumnsReorder="false" ReorderColumnsOnClient="false" ColumnsReorderMethod="Reorder">
                                        <Resizing AllowRowResize="False" EnableRealTimeResize="True" ResizeGridOnColumnResize="false" AllowColumnResize="true" AllowResizeToFit="true"/>
                                        <Animation AllowColumnReorderAnimation="false" AllowColumnRevertAnimation="true" />
                                        <Selecting AllowRowSelect="false"  />
                                    </ClientSettings>
 
                                    <SortingSettings SortedBackColor="Azure" EnableSkinSortStyles="false" />
 
                           <GroupingSettings ShowUnGroupButton="true" />
 
                        </telerik:RadGrid>

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
 
Exception Details: System.SystemException: System.ArgumentException: Illegal characters in path.
  at System.Security.Permissions.FileIOPermission.HasIllegalCharacters(String[] str)
  at System.Security.Permissions.FileIOPermission.AddPathList(FileIOPermissionAccess access, AccessControlActions control, String[] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList)
  at System.Security.Permissions.FileIOPermission..ctor(FileIOPermissionAccess access, String path)
  at System.Web.InternalSecurityPermissions.PathDiscovery(String path)
  at System.Web.HttpRequest.MapPath(VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping)
  at System.Web.HttpRequest.MapPath(VirtualPath virtualPath)
  at System.Web.HttpServerUtility.MapPath(String path)
  at Telerik.Web.Apoc.Image.ApocImageFactory.TryMapPath(String path, String& physPath)
  at Telerik.Web.Apoc.Image.ApocImageFactory.Make(String href)
  at Telerik.Web.Apoc.Fo.Flow.ExternalGraphic.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableCell.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.TableRow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.AbstractTableBody.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Table.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Block.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area, Region region)
  at Telerik.Web.Apoc.Fo.Flow.Flow.Layout(Area area)
  at Telerik.Web.Apoc.Fo.Pagination.PageSequence.Format(AreaTree areaTree)
  at Telerik.Web.Apoc.StreamRenderer.Render(PageSequence pageSequence)
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.EndElement()
  at Telerik.Web.Apoc.Fo.FOTreeBuilder.Parse(XmlReader reader)

I found out that it has to do with the ImageURL of the <asp:Image> contained in of the child grid column. If I put a URL link (like "http://somedomain.com/someimage.jpg") it exports correctly.

Is there a way to workaround this or, worse case, handle the export event and remove the image from the export?

Thanks
Kostadin
Telerik team
 answered on 07 Feb 2013
1 answer
166 views
Hi,

I ajaxified a combobox which works fine, but I want it to be rendered inline:

ajaxManager.AjaxSettings.AddAjaxSetting(cb1, cb2, null, UpdatePanelRenderMode.Inline);

The control will be updated, but the generated panel won't be rendered as inline-block.
Using

AjaxSetting setting = new AjaxSetting(cb1.ID);
         setting.UpdatedControls.Add(new AjaxUpdatedControl(cb2.ID, null)
            {
               UpdatePanelRenderMode = UpdatePanelRenderMode.Inline
            });
         ajaxManager.AjaxSettings.Add(setting);
won't generate a panel at all and will throw an exception on postback because of the missing panel.

What else is necessary that the panel gets rendered as inline-block?
Maria Ilieva
Telerik team
 answered on 07 Feb 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Grant
Top achievements
Rank 3
Iron
Iron
Iron
Dean
Top achievements
Rank 1
Leland
Top achievements
Rank 2
Iron
Iron
Iron
Emil
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?