Question

I need to have datagrid(3 columns) to which the values will be added using 3 textboxes and a button(Add) on the same page. If click on Add button the value should append to datagrid without page refresh/reload?

Please guide me with your approaches to this problem? I ran out of search.

Was it helpful?

Solution 2

1) I have used iframe in my default aspx page. 2) Created a new aspx page "datagrid.aspx" and had my datagrid as the only control in that page and set the src attribute of iframe to "datagrid.aspx" 3) Datatable to be rendered in datagrid.aspx is stored in the session variable in page load of default.aspx. 4) In the pageload of datagrid.aspx datatable is retrieved and binded to the datagrid. 5) When an item to be added/updated/removed are sent through querystring parameters from default.aspx using onclick event (JS) of a html button by setting the iframe source attribute.

Hope this answer helps. If its not clear, Please comment.

OTHER TIPS

Have you considered using Ajax on the client-side? I presume that clicking the "Add" button is also supposed to update something on the back-end, which means you must do a round-trip of some kind. Either via a postback, but since you don't want this, then the only other option is Ajax whereby you'll make a separate asynchronous post to the back-end that will not cause a page refresh, and on the client script, inject the correct elements to "update" the grid on-screen. You could get that working as a prototype and then use knockout to simplfy the process.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top