This is a migrated thread and some comments may be shown as answers.

GridAttachmentColumn with EditMode="InPlace"

14 Answers 184 Views
Grid
This is a migrated thread and some comments may be shown as answers.
asimptota
Top achievements
Rank 1
asimptota asked on 28 Feb 2013, 10:48 AM
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?

14 Answers, 1 is accepted

Sort by
0
asimptota
Top achievements
Rank 1
answered on 28 Feb 2013, 02:38 PM
Anyone?
0
asimptota
Top achievements
Rank 1
answered on 01 Mar 2013, 10:46 AM
Still struggling with this. Help? Anyone?
0
asimptota
Top achievements
Rank 1
answered on 04 Mar 2013, 07:22 AM
Guys, seriously... Anyone?
0
asimptota
Top achievements
Rank 1
answered on 05 Mar 2013, 07:21 AM
Still no answer? Is this the way Telerik treats their customers?
0
Kostadin
Telerik team
answered on 05 Mar 2013, 09:42 AM
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.
0
asimptota
Top achievements
Rank 1
answered on 05 Mar 2013, 10:01 AM
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"?
0
Kostadin
Telerik team
answered on 08 Mar 2013, 08:10 AM
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.
0
asimptota
Top achievements
Rank 1
answered on 08 Mar 2013, 09:47 AM
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...
0
Kostadin
Telerik team
answered on 13 Mar 2013, 09:45 AM
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.
0
asimptota
Top achievements
Rank 1
answered on 13 Mar 2013, 01:25 PM
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.
0
Kostadin
Telerik team
answered on 18 Mar 2013, 11:46 AM
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.
0
ItalloSan
Top achievements
Rank 1
answered on 29 Aug 2013, 03:31 PM
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....

0
Kostadin
Telerik team
answered on 03 Sep 2013, 09:05 AM
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.
0
ItalloSan
Top achievements
Rank 1
answered on 04 Sep 2013, 08:29 AM
Hi Kostadin

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

Cheers!
Tags
Grid
Asked by
asimptota
Top achievements
Rank 1
Answers by
asimptota
Top achievements
Rank 1
Kostadin
Telerik team
ItalloSan
Top achievements
Rank 1
Share this question
or