1

i am using jTable for my CRUD operation. But now i want to upload file using jTable create dialog form

How do i upload file using jTable create dialog?

<div id="PersonTable" style="width: 580px; margin: auto;"></div>

<script type="text/javascript">

    $(document).ready(function () {

        //Prepare jtable plugin
        $('#PersonTable').jtable({
            title: 'The Campus List',
            actions: {
                listAction: '/Home/CampusList',
                deleteAction: '/Home/DeletePerson',
                updateAction: '/Home/UpdatePerson',
                createAction: '/Home/CreatePerson'
            },
            paging: true,
            fields: {
                CampusId: {
                    key: true,
                    create: false,
                    edit: false,
                    list: true
                },
                CampusName: {
                    title: 'CampusName',
                    width: '15%'
                },
                CampusCode: {
                    title: 'CampusCode',
                    list: true
                },Image: { } // for uploading file
            }
        });

        //Load person list from server
        $('#PersonTable').jtable('load');
    });

</script>

1 Answer 1

0

By default Jquery-JTable do not have file Upload fields but you can use this way :

Use "input" attribute in fields scope of jtable with return "Div" or fileupload controls

such as this :

 fields: {
           ,
            Attach: {
               input : function (data){
                return "<input type='file' ...  >"; // OR----->
                return "<asp:FileUpload ....    >" ;// or----->   
               }
          },

But File upload need Full post back and all text areas on your page after File Upload post back was cleaned , so you need Jquery and Iframe for Ajax upload file or jquery plugin for upload them . you can use this address for complete it :

How to display an IFRAME inside a jQuery UI dialog

How to make Asynchronous(AJAX) File Upload using iframe?

Issue with jQuery / iframe File Uploading Solution

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.