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

Refresh listbox on client-side without postback

Hi,

is this scenario possible?
To refresh the sqldatabound listbox without postback?

 <asp:HiddenField runat="server" ID="IDValue" Value="" />

 <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:_____ConnectionString %>" SelectCommand="_____Select" SelectCommandType="StoredProcedure">
                <SelectParameters>
                    <asp:ControlParameter ControlID="IDValue" Name="ID" PropertyName="Value" Type="Int32" />
                </SelectParameters>
        </asp:SqlDataSource>

  <ej:ListBox ID="listboxInfo" runat="server" DataTextField="Text" DataSourceID="SqlDataSource1"></ej:ListBox>

on the grid is
  <ClientSideEvents RowSelected="ShowAdditionalInfo" />

function ShowAdditionalInfo() {    
            var obj = $("#Grid1").ejGrid("instance");
            $("#IDValue").val(obj.getSelectedRecords()[0].ID);        
            $("#listboxInfo").ejListBox("refresh", true);
        }

After the row is selected in the grid the listbox would show additional info. 
This doesn't refresh the listbox.

It does however work if i do this 
function ShowAdditionalInfo() {    
            var obj = $("#Grid1").ejGrid("instance");
            $("#IDValue").val(obj.getSelectedRecords()[0].ID);        
            __doPostBack('UpdatePanel1',null);
        }
but it is very slow and lagging after each row click on the grid.

And i want to avoid server side.

1 Reply

SS Selvamani Sankarappan Syncfusion Team July 14, 2016 12:44 PM UTC

Hi Pratura,   
Thanks for Contacting Syncfusion Support.  
We have checked with your code example. In your sample you have selected the row in a grid that updated the hidden field, which update only with the ID from (obj.getSelectedRecords()[0].ID). So, this ID is passed to the ListBox dataSource. If you want to get the all the details of selected row in a grid with the <SelectParameters>, then you must do the post back process. Please refer the following link: 
   
We have prepared the sample based on particular field only updated to the ListBox. Please refer the following sample:   
 
If this is not your scenario, please revert the provided sample based on your application. This would be helpful for us to analyze and provide an exact solution at the earliest.    
    
Regards,   
Selvamani S 

Loader.
Live Chat Icon For mobile
Up arrow icon