Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
459 views
Hi,
I have created a custom http handler but I don't see that it is being called. When I put a breakpoint in the code for the custom handler, it never gets hit. I also see that when I cast the UploadResult object to my custom result object in the server side FileUploaded event after a postback, I get null.

It was working locally in VS2010 before I registered the handler in web.config. But I had to register the handler to deploy it to my IIS server.

What am I doing wrong?


Here is a snippet of what I'm doing.

Here is my upload control:
<telerik:RadAsyncUpload
        Width="225px"
        TargetFolder="~/Temp/TempUploadFiles"
        ID="upFiles"
        runat="Server"
        InputSize="20"
        AllowedFileExtensions="jpeg,jpg,gif,tif,png,bmp,pdf"
        OnFileUploaded="RadAsyncUpload1_FileUploaded"
        OnClientFileUploading="upFiles_onClientFileUploading"
        OnClientFileUploaded ="upFiles_onClientUploadFinished"
        OnClientFileUploadFailed="upFiles_onClientUploadFailed"
        OnClientFileDropped="upFiles_onClientUploadDropped"
        OnClientFileUploadRemoved="upFiles_onClientUploadRemoved"
        OnClientValidationFailed="OnClientValidationFailed"
        HttpHandlerUrl="~/UserControls/CustomHandlers/UploadHandler.ashx"
        MaxFileInputsCount="1"
        TemporaryFileExpiration="5"
        DisableChunkUpload="true"
        ><FileFilters><telerik:FileFilter Extensions="jpeg,jpg,gif,tif,png,bmp,pdf" /></FileFilters>
 </telerik:RadAsyncUpload>

This is my Custom Handler:
public class UploadHandler : AsyncUploadHandler, System.Web.SessionState.IRequiresSessionState
{
  
    protected override IAsyncUploadResult Process(UploadedFile file, HttpContext context, IAsyncUploadConfiguration configuration, string tempFileName)
    {
        // Populate the default (base) result into an object of type SampleAsyncUploadResult
        CustomAsyncUploadResult result = CreateDefaultUploadResult<CustomAsyncUploadResult>(file);
 
        //do some processing here...
        base.Process(file, context, configuration, tempFileName);
 
        return result;
    }
}


I have registered the handler in web.config:
<Configuration>
       ...
      <httpHandlers>
      <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false" />
      <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false" />
      <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
      <add path="UserControls/CustomHandlers/UploadHandler.ashx" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
    </httpHandlers>
    <httpModules>
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
      <add name="RoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    </httpModules>
   ...
   <system.webServer>
      <handlers>
      <remove name="ChartImage_axd" />
      <remove name="Telerik_Web_UI_SpellCheckHandler_axd" />
      <remove name="Telerik_Web_UI_DialogHandler_aspx" />
      <remove name="Telerik_RadUploadProgressHandler_ashx" />
      <remove name="Telerik_Web_UI_WebResource_axd" />
      <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
      <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
      <add name="UserControls/CustomHandlers/UploadHandler_ashx" verb="*" preCondition="integratedMode" path="UserControls/CustomHandlers/UploadHandler.ashx" type="Telerik.Web.UI.WebResource" />
    </handlers>
    <validation validateIntegratedModeConfiguration="false" />
 </system.webServer>
   ...
</Configuration>
Hristo Valyavicharski
Telerik team
 answered on 14 Jan 2014
1 answer
142 views
Greetings,

I was in bad need to RowClosing, RowClosed, RowOpening, and RowOpened client side events (I hope these will be added to a future release), so I tried to implement my own.

I planned to handle the respective BatchEdit events. They're called for each cell, so I need to detect their call on first and last editable cells of a row to fire the proper event.

Here are some of my code:

function _findVisibleEditableColumn(col)
    {
        return !col.get_readOnly() && col.get_visible();
    }
 
grid.add_batchEditClosed(function (sender, args)
        {
            var lastVisibleEditableColumn = _.findLast(gridColumnsSortedByDisplayIndex, _findVisibleEditableColumn);
 
            if(lastVisibleEditableColumn && lastVisibleEditableColumn.get_uniqueName() == args.get_columnUniqueName())
                grid.raise_batchEditRowClosed(args);
        });

The event handler uses lo dash findLast function to find the last editable column. The callback _findVisibleEditableColumn uses the ReadOnly property to determine that the column is editable. This theoretically looks good. But I found that this doesn't cover a real scenario.

I had a grid which had the last column a TemplateColumn without edit or insert templates specified. This column passed the check. Its ReadOnly property returns false but the BatchEditClosed event is not called for it.

I examined the Telerik.Web.UI.GridColumn objects in the inspector and found that they have a private _data object which has the property Editable.
get_readOnly property code is as follows:

get_readOnly:function(){return(typeof(this._data.ReadOnly)!="undefined")?true:false;
}

It doesn't use the _data.Editable property.

At last I modified my filter function as follows:

function _findVisibleEditableColumn(col)
    {
        return !col.get_readOnly() && col.get_visible() && col._data.Editable;
    }

This seems to be working well. But is this the right solution? What's the reliable method to determine if a column is editable?
Angel Petrov
Telerik team
 answered on 14 Jan 2014
3 answers
95 views
I have a basic grid for testing that has a content area for each row that can be expanded.  I am setting a custom image for the expand and collapse image.  This was confusing already as I tried a few different techniques to get it working.  Using an ExpandCollapseColumn element in markup seemed to do nothing, however, I was able to get it to work by using the properties on the master table element or by setting them in the column creation event in the code behind.

My problem is that no matter how I specify the images, they are lost after I expand a row and then collapse it.  Once collapsed the image src is shown as undefined in the browser.  The hierarchy loading mode is conditional.  The problem doesn't happen if I set it to "server on demand" or client.  I can't think of a reason why this would be by design, and I think the grid should be able to track its expand and collapse images especially if it can do so in client mode.

In the example I am setting the images in 2 different ways, and it still has the same issue.
<telerik:RadGrid ID="grdHeirarchyLoadTest" AutoGenerateColumns="false" OnColumnCreated="RadGrid1_ColumnCreated" ExpandCollapseColumn-CollapseImageUrl="~/images/arrow_expanded.gif" ExpandCollapseColumn-ExpandImageUrl="~/images/arrow_collapsed.gif" runat="server">
    <MasterTableView HierarchyLoadMode="Conditional" ExpandCollapseColumn-ButtonType="ImageButton">
        <Columns>
            <Telerik:GridBoundColumn DataField="Test" HeaderText="Test" />
        </Columns>
        <NestedViewTemplate>
            Test content
        </NestedViewTemplate>
    </MasterTableView>
</telerik:RadGrid>

protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)
{
    if (e.Column is GridExpandColumn)
    {
        (e.Column as GridExpandColumn).ButtonType = GridExpandColumnType.ImageButton;
        (e.Column as GridExpandColumn).ExpandImageUrl = "~/images/arrow_collapsed.gif";
        (e.Column as GridExpandColumn).CollapseImageUrl = "~/images/arrow_expanded.gif";
    }
}

Kostadin
Telerik team
 answered on 14 Jan 2014
1 answer
180 views
I have a sample program and trying to use the declarative binding using WCF service. It does not give error but only shows empty grid. it also shows the count but not the data. Data service returns data JSON data as well that I can see via browser developer tools.
            <ClientSettings>
                <ClientEvents OnDataBindingFailed="onError" />
                <DataBinding Location="DataService.svc"
                    SelectMethod="GetStatesForGrid"                    
                    DataPropertyName="Data"
                    FilterParameterType="Linq"
                    SortParameterType="Linq"></DataBinding>
            </ClientSettings>

Here is the service interface:
    [ServiceKnownType(typeof(State))]
    [ServiceContract]
    public interface IDataService
    {
        [OperationContract]
        [WebInvoke(Method = "POST", RequestFormat = WebMessageFormat.Json, ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Wrapped)]
        StateResult GetStatesForGrid(int startRowIndex, int maximumRows, string sortExpression, string filterExpression);

Here is the service code (this is just sample code, goal is not to actually try filtering paging etc, just to send data and see if it binds):

    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    public class DataService : IDataService
    {
        public StateResult GetStatesForGrid(int startRowIndex, int maximumRows, string sortExpression, string filterExpression)
        {
            StateResult result = new StateResult();
            List<State> states = GetDataFromDb();
            result.Count = states.Count;
            result.Data = states;

            return result;
        }

If I use the ASMX service and call the same service method - it works fine. But not for WCF.

Another issue is, I tried calling the same method via PageMethod and use the .aspx page and method name in the declarative clientsettings - but that gives error that 'startIndex' not found.
Marin
Telerik team
 answered on 14 Jan 2014
1 answer
46 views
Hi,

I am using drag and drop on the same RadTreeList. I removed paging on my Treelist and had
<Scrolling AllowScroll="true"/> in ClientSettings.
I am also using Ajax on it.
The Scrolling Functionality is normally working fine but It doesn't work,
When I try to drag an Item and Move it Up and Down to drop on something on the Same TreeList.
All the functionality is working fine when I don't have many items in the list,
I just need to get this scrolling thing done, If I have many items to display.
I tried many solutions online but all those seems to work with Silverlight.
Can you please help me with this? I wish I could have an event like 
AllowAutoScrollOnDragDrop which I use on RadGrid everytime.
<ClientSettings AllowAutoScrollOnDragDrop="true" >
<Scrolling AllowScroll="true" />
</ClientSettings>
Thanks in Advance, Narender

Venelin
Telerik team
 answered on 14 Jan 2014
5 answers
172 views
My Radgrid is binding to a list<>, the sort and staticHeader working fine, however it cannot sort and lost staticHeader after export to excel. Can anyone help me? Thanks.


protected void btnExportToExcel_Click(object sender, ImageClickEventArgs e)
    {
        ConfigureExport(RadGrid1);
        RadGrid1.ExportSettings.FileName = "title";
        RadGrid1.MasterTableView.Caption = "title";
        RadGrid1.MasterTableView.ExportToExcel();
        ScriptManager.GetCurrent(Page).RegisterPostBackControl(btnExportToExcel);
    }
Kostadin
Telerik team
 answered on 14 Jan 2014
1 answer
117 views

Hi,

I've created a simple application which usesz RadGrid to connectt o my Windows Azure SQL Database. When I run the site localy all the editing features of RadGrid work great.



But when I deploy to WA Web Sites when I click on the edit buton i.e. the loading panel just shows for a second and disappears.



I've attached the debugger from VS 2013 and the error I'm getting is:



Unhandled exception at line 15, column 16485 in http://my_app_name.azurewebsites.net/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=;;System.Web.Extensions,+Version=4.0.0.0,+Culture=neutral,+PublicKeyToken=31bf3856ad364e35:en-US:c9cbdec3-c810-4e87-846c-fb25a7c08002:ea597d4b:b25378d2;Telerik.Web.UI:en-US:9d967110-0dc5-4d20-a086-c7556058bb3c:16e4e7cd:f7645509:22a6274a:ed16cbdc:88144a7a:58366029

0x800a139e - JavaScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500


Any suggestions how to fix it?

Maria Ilieva
Telerik team
 answered on 14 Jan 2014
1 answer
76 views
Hi , I'm using radtreeview width checkbox="true" style .
in button click I want to retrievechecked Items .
I try to do this is 2 ways, but both have zero item counts . please check my code
<asp:Button ID="Save" runat="server" Font-Names="Tahoma" Text="Save" OnClick="Save_Click" CssClass="savebutton"></asp:Button>
                      </div>
                      <telerik:RadTreeView ID="RadTreeView1" runat="server" DataTextField="SecNameFr" DataValueField="AccessId" DataFieldID="SecId" CheckBoxes="true" DataFieldParentID="SecIdRef" CheckChildNodes="true" Font-Names="tahoma" RenderMode="Classic" Skin="Office2010Blue">
                          <DataBindings>
                              <telerik:RadTreeNodeBinding Checkable="true" CheckedField="HasAccess" />
                          </DataBindings>
                      </telerik:RadTreeView>
protected void Save_Click(object sender, EventArgs e)
       {
           List<RadTreeNode> dss = RadTreeView1.CheckedNodes.ToList();
 
           Dictionary<int, bool> accessIdDic = new Dictionary<int, bool>();
           foreach (RadTreeNode item in RadTreeView1.Nodes)
           {
               if (item.Checked)
                   accessIdDic.Add(Convert.ToInt32(item.Value), item.Checked);
           }
          
       }
Shinu
Top achievements
Rank 2
 answered on 14 Jan 2014
1 answer
70 views
In my radgrid, I have a linkbutton column which opens up a radwindow.  The radwindow shows some details and has some editable fields and a save button.  I have a requirement from the users that once they click the save button in the window, they want the window to save their changes then automatically load the next radgrid row's details.  How would I go about doing something like this?
Viktor Tachev
Telerik team
 answered on 14 Jan 2014
1 answer
62 views
Hi,

When i zoom out an orgchart at some point the connecting lines disappear. How do i make sure the connecting lines are always visible no matter how much i zoom out.

Thanks
-Sekhar
Plamen
Telerik team
 answered on 14 Jan 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Iron
Iron
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
Radek
Top achievements
Rank 2
Iron
Iron
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Richard
Top achievements
Rank 4
Bronze
Bronze
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?