We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Sample about Grid and operations CRUD with field Photo

Hi,

I have a BD with a table with a Photo field (byte [] or string [path image]). Ids there any example to perform CRUD (Add, Remove, Update, Delete) operations in my Grid ASP.net MVC CLASSIC?. I don't know which is the best option, in-line, external dialog, modal dialog template...?. I'd like to me to tell which is the best option. I want to be able to update the photo, is it convenient to use the syncfusion control Uploadbox to upload the Photo?. The bind to my Photo of my table field is better to do it to a byte [] or string?. If there isn't any example, could you build for me?.

Thank you

7 Replies

JS Jesus Sanchez June 8, 2014 06:13 PM UTC

Sorry,

Version ASP.net MVC (NO-CLASSIC) ....



MS Madhu Sudhanan P Syncfusion Team June 9, 2014 12:54 PM UTC

Hi Jesus,

Based on your requirement, we will create a custom sample and update you the response on June 12, 2014.

Please let us know if you have any queries.

Regards,
Madhu Sudhanan. P


MS Madhu Sudhanan P Syncfusion Team June 12, 2014 12:46 PM UTC

Hi Jesus,

 

Based on your request, we have created a custom sample in MVC Grid control which performs CRUD operation with photo field column and the same can be downloaded from the below location.

 

Sample Location: CRUD_in_Employees_Images.zip

 

In the above sample, the grid is populated with the data from the Web API 2 Controller and we have used column template to display employee image and used inlineformtemplate editing to perform CRUD operation in grid. The employee image name will be retrieved from the server.

 

The column template and the inlineformtemplate used in the above sample are as follows.

 

 

<!--Column Template-->

<script id="imagetemplate" type="text/x-jsrender">

    <img style="width: 150px; height: 130px" src="../ejThemes/Employees/{{:PhotoPath}}" />

</script>

 

<!--InlineFormEdit Template-->

<script id="editTemp" type="text/x-jsrender">

    <table>

        <tr>

            <td>EmployeeID</td>

            <td style="text-align: left">

                <input id="EmployeeID" name="EmployeeID" value="{{: EmployeeID}}" disabled="disabled" class="e-field e-disable e-ejinputtext valid" style="text-align: right; width: 116px; height: 28px" />

            </td>

        </tr>

        <tr>

            <td>Upload Photo</td>

            <td><input id="PhotoPath" name="PhotoPath" value="{{: PhotoPath}}" class="e-field e-disable e-ejinputtext valid" style="text-align: right; width: 116px; height: 28px" /></td>

            <td><span id="upload"></span></td> <!—UploadBox for Uploading photo-->

        </tr>

    </table>

</script>

 

 

In the edit actionBegin event, we have rendered the uploadbox control as follows.

 

 

function editBegin(args) {  //actionBegin Event

        if (args.requestType == "beginedit" || args.requestType == "add") {

 

            $("#upload").ejUploadbox({  //Rendering the uploadbox control

                browseButtonText: "Browse",

                saveUrl: "/Home/Save",

                fileFormatAllow: ".png",              

            });

       

            var uploadObj = $("#upload").data("ejUploadbox");

            $("#InlineEditForm_Grid_Save").click(function (e) {

                uploadObj._xhrOnUploadButtonClick(e); //Binding the upload event to inlineformedit template button

            });

 

        }

    }

 

 

 

The above sample has following issue:

 

•         While adding new record, the added record would not be reflected immediately in Grid until Grid refresh (or pagination). After grid is refreshed the newly added record is displayed in the corresponding page.

 

We have already logged “Update and Add New Record issue in CRUD operation” as defect and the fix for this issue will be estimated to available in our upcoming Volume 2, 2014 release.

 

Please let us know if you have any queries.

 

Regards,

Madhu Sudhanan. P



JS Jesus Sanchez June 12, 2014 03:37 PM UTC

Thank you... shall wait for volume 2-... This example does not work nothing good, the App crash...

On the other hand, you do not have a simple example in which operate the component UploadBox?
Thank you.


MS Madhu Sudhanan P Syncfusion Team June 16, 2014 12:54 PM UTC

Hi Jesus,

 

Sorry for the inconvenience caused.

 

We afraid that we are unable to reproduce the reported issue and could you provide us more information regarding the issue?. The information provided would be more information for us to analyze the issue and provide you the solution as early as possible.

 

And the solution we have provided in the last update, is the best method to use the UploadBox control for CRUD operation in grid.

 

Please let us know if you have any queries.

 

Regards,

Madhu Sudhanan. P



JS Jesus Sanchez June 17, 2014 03:59 PM UTC

We shall wait for the next versión.

Thanks


RU Ragavee U S Syncfusion Team June 18, 2014 07:19 AM UTC

Hi Jesus

 

Thanks for the update.

 

Yes. The fix for the issue “Update and Add New Record issue in CRUD operation” is estimated to be included in our Volume 2, 2014 release. We will get back to you once our Volume 2, 2014 is rolled out.

 

Please let us know if you need any further assistance.

 

Regards

Ragavee U S


Loader.
Live Chat Icon For mobile
Up arrow icon