Where is showimagecs.aspx - RadUpload in an Ajaxified Grid??

Thread is closed for posting
4 posts, 0 answers
  1. gc_0620
    gc_0620 avatar
    246 posts
    Member since:
    Feb 2008

    Posted 30 Jan 2010 Link to this post

    Folks,

    Environment: VS 2008 SP1, RadControls for ASP.NET AJAX Q3 2009, WIN XP SP3, IE7, SQL SERVER 2005.

    Based on below post, showimagecs.aspx will be in the same folder as RadUpload in an Ajaxified Grid. But I do not see it there. Only files I see under the folder RadUploadInAjaxifiedGrid are:

    a) Default.html b) DefaultCS.aspx c) DefaultCS.aspx.cs d) DefaultVB.aspx e) DefaultVB.aspx.vb .

    Am I missing some thing?

    http://www.telerik.com/community/forums/aspnet-ajax/upload/using-radupload-in-an-ajaxified-grid-showimagecs-aspx.aspx


    Is it possible to upload: a) .doc b) .xls c) .pdf d) .Jpg files from Radupload into SQL 2005 Table and allow users to preview the uploaded files (using double click) from Rad Grid?

    In my sql Table, I have a table name call AttachmentFiles with 3 columns:

    a) Id Int unique Primary Key
    b) File Description Nvarchar (255)
    c) Data  (Uploaded file Data).

    Any example or a prototype project will be highly appreciated.

    Thanks

    GC_0620

  2. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 04 Feb 2010 Link to this post

    Hi gc_0620,

    Since Q2 2009 we have a new control in the RadControls for ASP.NET AJAX toolkit. It is called binary image and can be used for displaying images either from a database or from the file system. The demo that you have look at, was rewritten to use that control. You can use it as well.

    I have attach sample project that demonstrates how to use RadGrid with RadUpload in order to upload images to SQL database. You can also take a look at this code library which demonstrates the same, but with text documents.

    Greetings,
    Genady Sergeev
    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.
  3. gc_0620
    gc_0620 avatar
    246 posts
    Member since:
    Feb 2008

    Posted 04 Feb 2010 Link to this post

    Hi Genady,

    Thanks for getting back. The only problem is that I can't access  additional column in the Table Filestorage from attached demo. My SQL Table has this structure.

    Id                                        int
    Filename                            Varchar (50)
    FileSize                              int
    ContentType                     Varchar (50)
    FileBinary                          Image
    FileDescription               Nvarchar(200)   

    -------------

    FileDescription
    , I added a new column in the Table so that users can enter the Description of the attachment. Please look at attached file the error I am getting.

    Also although I copied the entire Database FileUpload.mdf into my SQL Database in Network Server from App_Data Folder,  I would like to remove any reference  to that Folder in my Local Hard Drive.  If I remove that referrence I got this error message:

    This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

    Below is the connectionstring in my Web Config and Entire RadGrid. You can notice I added a new column FileDescription in the Radgrid. 

     

     

     

    <connectionStrings>   
     
    <add name="FileUploadDBStr" connectionString="Data Source=MyDataSource;Initial Catalog=MyDataSourceCatalog;Integrated Security=True;Integrated Security=True" />   
    </connectionStrings>   
     

     

     

     

     

    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" ClientEvents-OnRequestStart="conditionalPostback">  
     
                <telerik:RadGrid runat="server" ID="RadGrid1" AllowPaging="True" AllowSorting="True" 
                    AutoGenerateColumns="False" Width="97%" OnNeedDataSource="RadGrid1_NeedDataSource"  OnUpdateCommand="RadGrid1_UpdateCommand"   
                    OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand" Skin="Web20" OnItemDataBound="RadGrid1_ItemDataBound" 
                    ShowStatusBar="True" GridLines="None" AllowAutomaticDeletes="true" > 
                    <PagerStyle Mode="NextPrevAndNumeric" /> 
                    <MasterTableView Width="100%" CommandItemDisplay="Top" DataKeyNames="Id" AllowAutomaticDeletes="true" > 
                        <Columns>                         
                            <telerik:GridEditCommandColumn> 
                            </telerik:GridEditCommandColumn> 
                            <telerik:GridTemplateColumn HeaderText="Id" Display="false" UniqueName="FileId" SortExpression="Name">  
                                <ItemTemplate>                                
                                        <asp:Label runat="server" ID="lblFileId" Text='<%# Eval("Id") %>' />                  
                                </ItemTemplate>                           
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="File" UniqueName="FileName" SortExpression="FileName">  
                                <ItemTemplate> 
                                    <href="WordViewer.aspx?Id=<%# Eval("Id") %>">  
                                        <asp:Label runat="server" ID="lblFileName" Text='<%# Eval("FileName") %>' /> 
                                    </a> 
                                </ItemTemplate>   
                                <EditItemTemplate>                                
                                    <telerik:RadUpload ID="RadUpload1" runat="server" InitialFileInputsCount="1" MaxFileInputsCount="1" 
                                        ControlObjectsVisibility="None" MaxFileSize="6000000" InputSize="100" Width="500px" /> 
                                        <telerik:RadProgressManager ID="RadProgressManager2" runat="server"/>  
                                        <telerik:RadProgressArea ID="RadProgressArea2" runat="server" Skin="Vista"></telerik:RadProgressArea> 
            
                                </EditItemTemplate>                       
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="Size" UniqueName="FileSize" DataField="FileSize">  
                                <ItemTemplate> 
                                    <asp:Label ID="lblFileSize" runat="server" Text='<%# Eval("FileSize") %>' /> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn HeaderText="File Description" UniqueName="FileDescription" DataField="FileDescription">  
                                <ItemTemplate> 
                                    <asp:Label ID="lblFileDescription" runat="server" Text='<%# Eval("FileDescription") %>' /> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridButtonColumn CommandName="Delete" Text="Delete" ConfirmText="Are you sure you want to delete the selected row?" > 
                            </telerik:GridButtonColumn> 
                              
                        </Columns> 
                        <EditFormSettings> 
                            <EditColumn UniqueName="EditCommandColumn1">  
                            </EditColumn> 
                        </EditFormSettings> 
                        <ExpandCollapseColumn> 
                            <HeaderStyle Width="20px" /> 
                        </ExpandCollapseColumn> 
                        <RowIndicatorColumn> 
                            <HeaderStyle Width="20px" /> 
                        </RowIndicatorColumn> 
                    </MasterTableView> 
                    <FilterMenu EnableTheming="True" Skin="Web20">  
                        <CollapseAnimation Duration="200" Type="OutQuint" /> 
                    </FilterMenu> 
                </telerik:RadGrid> 
                  
            </telerik:RadAjaxPanel> 
     

    Thanks

    gc_0620


      

  4. Genady Sergeev
    Admin
    Genady Sergeev avatar
    1600 posts

    Posted 10 Feb 2010 Link to this post

    Hi gc_0620,

    Have you modified the BLL file that can be find in the attached project? It has been created to work with the attached database. Since you have changed the database, you will need to modify the BLL file as well. This is the current Insert method:

    static public void Insert(string imgDescription, RadUpload currentUpload)
        {
            byte[] imgBody = InitializeUpdateParameter(currentUpload);
     
            using(SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["TelerikConnectionString"].ConnectionString))
            {
                conn.Open();
                using (SqlCommand cmd =
                    new SqlCommand("INSERT INTO Images(ImgDescription, ImgBody) Values(@desc, @imgBody)", conn))
                {
     
                    cmd.Parameters.AddWithValue("desc", imgDescription);
                    cmd.Parameters.AddWithValue("imgBody", imgBody);
                    cmd.ExecuteNonQuery();
                }
            }
        }

    You will need to change the SqlCommand as well as the parameters passed in order to satisfy the new database. If you experience problems doing this, please open a support ticket and send us sample running project containing your database and we will try to fix this for you.

    As for the other problem that you experience, have you tried doing what is suggested in the error message:

    This application is currently offline. To enable the application, remove the app_offline.htm file from the application root directory.

    Does deleting that file changes the situation?

    Sincerely yours,
    Genady Sergeev
    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.
Back to Top