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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Refresh Grid with new custom asp button

Thread ID:

Created:

Updated:

Platform:

Replies:

121541 Dec 28,2015 11:06 AM UTC Jan 4,2016 12:08 PM UTC ASP.NET Web Forms 6
loading
Tags: Grid
Omar
Asked On December 28, 2015 11:06 AM UTC

Hi i'm using grid in my application. due my project i bind grid with SqlDataSource1 so here i need to refresh grid with a custom asp button to refresh grid (rebind it) without postback

how it's possible to force refresh records and grid ?

thanks.

Saravanan Arunachalam [Syncfusion]
Replied On December 29, 2015 09:26 AM UTC

Hi Omar,

Thanks for contacting Syncfusion Support.

We analyzed your query and you can refresh the Grid control by using “refreshContent” method of Grid in “onClientclick” event of ASP.Net Button control.

If you want to prvent the postback to the server while clicking the button, we suggest you to use the return false statement. Please refer to the below code example and stack overflow link.

<ej:Grid ID="Grid" runat="server" AllowPaging="True" AllowSorting="True" DataSourceID="SqlData">

           

           <%--Binding sql datasource--%>

            . . .


        </ej:Grid>

        <asp:SqlDataSource ID="SqlData" runat="server" ConnectionString="<%$ ConnectionStrings:SQLConnectionString %>"

            SelectCommand="SELECT * FROM [Orders]"></asp:SqlDataSource>

   

    <asp:button id="Button1"

       . . .

       <%--Asp button with client click event and return false--%>

       onclientclick="onClick();return false;"

       />

    <script type="text/javascript">

        function onClick(e) {

           

            var gridObj = $("#MainContent_Grid").data("ejGrid");

            //Refresh the Grid control

            gridObj.refreshContent();

        }

    </script>


http://stackoverflow.com/questions/13016660/how-to-make-asp-net-button-call-client-side-javascript-and-not-do-postback

We have created a sample that can be download from the below link.

http://www.syncfusion.com/downloads/support/forum/121541/ze/sqlbinding956460427

If still you are facing the issue, could you please share the following details?

       View page code.

       If possible reproduce the issue in the above sample

Regards,

Saravanan A.


Omar
Replied On December 29, 2015 06:13 PM UTC

Thank you for your replay Saravanan
i ran your sample successfully even i had used refreshContent() method in my project before . but it doesn't work for me ,the only things i've changed in your sample was refrence to dlls in web.config

my version is 13.2451.0.29

i think with
refreshContent() method grid will be refreshed not rebinded datasource i want to refresh grid to show new records or updated records...


thanks


Saravanan Arunachalam [Syncfusion]
Replied On December 30, 2015 12:09 PM UTC

Hi Omar,

We analyzed your query and we suspect that you have added or modified the record externally from the Grid and update those changes on the database. So, if you need to refresh the changes on the Grid control, a post back is required to fetch the data from database again.

Note: When binding SqlDataSource to Grid, all Grid actions will be performed in client-side on the cached data. So we need to send a post-back to server to refresh the cached data.

If we misunderstood your query, please provide the following details regarding your requirement?

·         Did you update the changes on the database?

·         Confirm whether you need to add/update the record on the database or Grid (client side) itself.

·         Share your view page code.

·         Share the screenshot expected output.

·         Describe your requirement clearly.


Regards,

Saravanan A.


Omar
Replied On December 31, 2015 10:20 PM UTC

Hi Saravanan

yes exactly your right i need post back but my mean was
When I click the button the whole page should not  get postback
i used an update panel with grid.databind() but it doesnt work??but it works with asp grid ..maybe i'm wrong!!
is there any ajax method in syncfusion grid to do that or can you give an example of using update panel with grid.

thanks a lot




Omar
Replied On January 3, 2016 09:48 AM UTC

Hi Saravanan

my problem was sold by using __doPostBack('<%=UpdatePanel1.ClientID %>', ''); in page i can't understand why it didn't work before but now it works.
now there is a strange problem after postback the filter menu doesn't appear correctly!!


thanks



Attachment: img_2de7828f.zip

Saravanan Arunachalam [Syncfusion]
Replied On January 4, 2016 12:08 PM UTC

Hi Omar,

We are sorry for the inconvenience.

We are unable to reproduce the reported issue and we have created a sample using “Updatepanel” that can be downloaded from the below link.

http://www.syncfusion.com/downloads/support/forum/121541/ze/sqlbinding-339409993

If still you are facing an issue, please provide the following details regarding your query.

1.       Share your View page code

2.       Share the exception details with call trace, if any exception thrown.

3.       Confirm whether you have rendered the button and Grid control in same or different update panel.

4.       If possible please reproduce the issue in below sample.

Regards,

Saravanan A.


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;