Environment: RadControls for ASP.NET AJAX Q3 2009 / VS 2008 SP1/IE7/WINXP SP 2.
I was working in the below Link. After clicking the Edit Command, I got the attached error. This error I received with the Rad Controls installed in my local work station. Any help will be appreciated. Thanks
gc_0620
http://demos.telerik.com/aspnet-ajax/grid/examples/generalfeatures/gridattachmentcolumn/defaultcs.aspx
7 Answers, 1 is accepted
Thanks
Thanks for reporting this. I was able to reproduce the exception. Currently, I reproduce it on the online demos only, even though my local copy is identical to the online version.
I am going to need some more to research this issue. Let me get back to you whenever I find something.
Sincerely yours,
Veli
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
This problem originates from RadDateTimePicker that is loaded in RadGrid's edit form. Particularly, the TimeView control (used to pick time) has issues with AJAX being disabled to upload some attachment. The problem is reproduced after you insert or update an item with an attachment, and then open the edit form again. The issue is currently not reproducible locally, but on the live demos only, so I believe it is about some time-dependent issue that requires a longer response delay.
Currently, workarounds are to use DatePicker (without the time view), or, alternatively, not disable AJAX on postback.
All the best,
Veli
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
I really appreciate your attention to this matter and get back to me with your findings and recommendations. As per your suggestion, I am implementing to use DatePicker (without the time view). Hopefully the future releases of Telerik Product, this issue will be fixed.
I really do not need Time picker in Upload because in my RadGrid I have a column name "Last Update Date/Time". Any changes to Grid, I update that column with Current Date/Time.
One final question for your recommendation: 1) Is it advisable to upload the BinaryData into SQL 2005 database or 2) Just the path name of the uploaded file and make a referrence to uploaded file? I am thinking about the performance issue.
This project we are developing is for HR department, where other department heads will enter the potential employees data of their own departments into grid and attach documents such as resume, extracredentials etc.. and submit to HR. For each employee, the combined attachments might be as large as 5MB although the single attachment is limit to 1 MB. Any Telerik article that discusses the con and pro of both methods will be highly appreciated.
Sincerely,
gc_0620
Even though we do not have a ready article that discusses the two approaches, we can discuss them here right now :)
Generally, both of the approaches follow one and the same logic up to some point. For both types, you need to upload the file to the server first, so performance is the same up to the point the data is uploaded.
From here, you can either save the data to a physical file in a folder, or save them in a field in SQL Server. Thus, the performance difference is the difference between saving equally long binary data to SQL and to a file. I expect the SQL insertion to be slower than simple file write.
Still, keeping attachment in SQL server has a couple of advantages -> easier data backups and deployment, easier migration to another server (moving only the database vs moving files and folders), as well as an increased robustness - the data is kept as a consistent set of records containing both file data and meta data, vs keeping separate SQL records and physical files that may get deleted or moved accidentally.
Regards,
Veli
the Telerik team
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
Thanks again Veli.
We will go SQL Data insertion route. Although it may be little slower but will be easier to maintain and Transport in the event of Database Server failure. Also there will be no chances for accidental deletion of Physical attachment File.
We tried out the Grid Attachment Demo. Only question is we would like to hide this column while in edit/insert mode. In the demo, FileName and Upload File is the same in the Grid. We just need to show one column.
| <telerik:GridBoundColumn DataField="FileName" HeaderText="FileName" > |
| </telerik:GridBoundColumn> |
One choice we were thinking to convert that column into a Template column. So that in EditItemTemplate we can make it visible = "false". Below is what we did.
| <telerik:GridTemplateColumn DataField="FileName" HeaderText=" Template FileName" |
| UniqueName="FileName"> |
| <EditItemTemplate> |
| <asp:TextBox ID="FileNameTextBox" runat="server" Text='<%# Bind("FileName") %>' visible = "false"></asp:TextBox> |
| </EditItemTemplate> |
| <ItemTemplate> |
| <asp:Label ID="FileNameLabel" runat="server" Text='<%# Eval("FileName") %>'></asp:Label> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
By doing this we got this error message:
________________
Server Error in '/Live Demos' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
|
Source File: c:\Program Files\Telerik\RadControls for ASP.NET AJAX Q3 2009\Live Demos\Grid\Examples\GeneralFeatures\GridAttachmentColumn\DefaultCS.aspx.cs Line: 65
___________________
Below is our modifed RadGrid1_ItemCommand. It works if we use column FileName as GridBoundColumn, but by doing that how do we hide it in edit/insert mode?
| protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) |
| { |
| if (e.CommandName == RadGrid.UpdateCommandName || |
| e.CommandName == RadGrid.PerformInsertCommandName) |
| { |
| GridEditableItem item = e.Item as GridEditableItem; |
| if (!(item is GridEditFormInsertItem)) |
| { |
| fileId = (int)item.GetDataKeyValue("ID"); |
| } |
| string fileName = (item.EditManager.GetColumnEditor("FileName") as GridTextBoxColumnEditor).Text; |
| fileData = (item.EditManager.GetColumnEditor("AttachmentColumn") as GridAttachmentColumnEditor).UploadedFileContent; |
| if (fileData.Length == 0 || fileName.Trim() == string.Empty) |
| { |
| e.Canceled = true; |
| RadGrid1.Controls.Add(new LiteralControl("<b style='color:red;'>No file uploaded. Action canceled.</b>")); |
| } |
| } |
| } |
Appreciate for all your help.
Sincerely.
gc_0620