GridAttachmentColumn with EditMode="InPlace"

15 posts, 0 answers
  1. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 28 Feb 2013 Link to this post

    Could you please point me to the working sample that provides using GridAttachmentColumn with RadGrid EditMode="InPlace"? I need that functionality but this demo http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx works with EditMode="EditForm", but when I change it to "InPlace" it gives me Microsoft JScript runtime error: Unable to get value of the property 'getElementsByTagName': object is null or undefined in the following JacaScript function:

    function uploadFileSelected(sender, args) {
        upload = sender;
        var uploadContainer = sender.get_element();
        var editTable = uploadContainer.parentNode.parentNode.parentNode;
        var fileNameTextBox = editTable.rows[0].cells[1].getElementsByTagName('input')[0];
        fileNameTextBox.value = args.get_fileInputField().title;
    }

    Any help?
  2. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 28 Feb 2013 Link to this post

    Anyone?
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 01 Mar 2013 Link to this post

    Still struggling with this. Help? Anyone?
  5. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 04 Mar 2013 Link to this post

    Guys, seriously... Anyone?
  6. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 05 Mar 2013 Link to this post

    Still no answer? Is this the way Telerik treats their customers?
  7. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 05 Mar 2013 Link to this post

    Hello Jasmin,

    It looks like editTable.rows[0].cells[1] is undefined and that is the reason for that exception. Try out the following code snippet in order to fix it.
    function uploadFileSelected(sender, args) {
        upload = sender;
        var uploadContainer = sender.get_element();
        var editTable = uploadContainer.parentNode.parentNode.parentNode;
        var fileNameTextBox = editTable.rows[1].cells[1].getElementsByTagName('input')[0];
        fileNameTextBox.value = args.get_fileInputField().title;
    }


    Kind regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 05 Mar 2013 Link to this post

    Nope. It fires Index was out of range. Must be non-negative and less than the size of the collection.

    if (e.CommandName == RadGrid.PerformInsertCommandName)
      {
          GridEditableItem item = e.Item as GridEditableItem;
     
          if (!(item is GridEditFormInsertItem))
          {
              fileId = (int)item.GetDataKeyValue("FileID"); <-error
          }


    The same error is fired if I use RadToolbar as a CommandItemTemplate. Could you, please, post me a quick solution with RadToolbar as a CommandItemTemplate and EditMode="InPlace"?
  9. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 08 Mar 2013 Link to this post

    Hello Jasmin,

    I suggest you to check out the following help topic where is described how to detect whether the item is in edit/insert mode with in-place editing.

    Kind regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  10. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 08 Mar 2013 Link to this post

    Thank you very much for your answer but can't make it work...
    Could you, please, post me a solution for GridAhatttachmentColumn with EditMode="InPlace" and, RadToolbar as CommandItemTemplate. I'm struggling with this for days...
  11. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 13 Mar 2013 Link to this post

    Hi Jasmin,

    I prepared a small sample where I used RadToolbar as CommandItemTemplate and GridAhatttachmentColumn with EditMode="InPlace". Give it a try and let me know about the result.

    Regards,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  12. asimptota
    asimptota avatar
    50 posts
    Member since:
    Apr 2011

    Posted 13 Mar 2013 Link to this post

    Thank you so much for this sample. But, when I try to download uploaded file it gives me the following error on this JS function
    function gridCommand(sender, args) {
        if (args.get_commandName() == "DownloadAttachment") {
           HERE -> var manager = $find('<%= RadAjaxManager.GetCurrent(Page).ClientID %>');
            manager.set_enableAJAX(false);
            setTimeout(function () {
                manager.set_enableAJAX(true);
            }, 0);
        }
    }
    Unable to get value of the property 'set_enableAJAX': object is null or undefined. It seems  it can't find RadAjaxManager which is strange.
  13. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 18 Mar 2013 Link to this post

    Hello Jasmin,

    You have to enable the AjaxManager. Check out the following code snippet:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" EnableAJAX="true" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
                <ClientEvents OnRequestStart="conditionalPostback"></ClientEvents>
                <AjaxSettings>
                    <telerik:AjaxSetting AjaxControlID="RadGrid1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid1"></telerik:AjaxUpdatedControl>
                        </UpdatedControls>
                    </telerik:AjaxSetting>
                </AjaxSettings>
            </telerik:RadAjaxManager>


    Greetings,
    Kostadin
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  14. ItalloSan
    ItalloSan avatar
    4 posts
    Member since:
    May 2013

    Posted 29 Aug 2013 Link to this post

    Hi

    I have downloaded the AttachmentColumn.zip and have it running locally (VS2012 sql server 2008R2). I works ok - allows me to upload files.
    but... they are corrupted - looks like truncated maybe.

    I have tried .pdf & .docx

    Any ideas please?

    edit: It does upload the files correctly on an insert but not on update....

  15. Kostadin
    Admin
    Kostadin avatar
    1711 posts

    Posted 03 Sep 2013 Link to this post

    Hello Stephen,

    I was not able to replicate the issue locally. Could you please let me know which version of Telerik controls you are using? I prepared a video were you could see that when updating a record the downloaded file is not corrupted.

    Regards,
    Kostadin
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  16. ItalloSan
    ItalloSan avatar
    4 posts
    Member since:
    May 2013

    Posted 04 Sep 2013 Link to this post

    Hi Kostadin

    Thanks for this. I have had to leave this for now but will come back when I can.

    Cheers!
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017