This is a migrated thread and some comments may be shown as answers.

De-select or rebind radgrid using javascript

3 Answers 193 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suj
Top achievements
Rank 1
Suj asked on 02 Mar 2012, 01:47 PM

I have a radgrid with <Selecting AllowRowSelect="True" />. the radgrid is inside a radwindow. The radwindow contain a two buttons ("Select" and "Cancel") other than this radgrid. What we do is select a row in the radgrid and either click "Select" or "Cancel" button. Am sharing my radwindow here...

 

<div class="RadModalMainDiv">
    <div>
          <p> Help text to go here....</p>
       </div>
        <div class="divStandardTextButtonList">
       <asp:Button ID="btnObservationsTextSelect" runat="server" Text="Select" CssClass="btnStandardText"
                                                            OnClientClick="return ObservationStandardText_Confirm()" />
        <asp:Button ID="btnObservationsTextCancel" runat="server" Text="Cancel" CssClass="btnStandardText" />
        </div>
         <asp:Panel ID="pnl1" runat="server">
              <div>
                    <telerik:RadGrid ID="radGdObservationsText" runat="server" AllowPaging="True" AllowSorting="False"
                                                                AutoGenerateColumns="False" EnableEmbeddedSkins="false" GridLines="None" PageSize="10" Width="100%">
                            <MasterTableView CommandItemDisplay="None" Name="ParentGrid">
                                 <Columns>
                                            <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                                              <HeaderStyle HorizontalAlign="Center" Width="23px" />
                                               </telerik:GridClientSelectColumn>
                                                <telerik:GridBoundColumn DataField="description" HeaderText="Observation description"
                                                   Visible="true">
                                                 </telerik:GridBoundColumn>
                                  </Columns>
                             </MasterTableView>
                             <PagerStyle Mode="NextPrevAndNumeric" />
                              <ClientSettings>
                                   <Selecting AllowRowSelect="True" />
                                    <ClientEvents OnRowSelected="SetObservationStandardText" OnRowDeselected="SetObservationStandardText" />
                                   </ClientSettings>
                </telerik:RadGrid>
    </div>
     </asp:Panel>
</div>

 

My issue is when i select a row from the radgrid, click 'select/cancel' the reopens the radwindow, the row in the radgrid remains selected. I need to de-select all the rows while reopening the radwindow. Binding of the grid is done in server side in the radGdObservationsText_NeedDataSource event. Can this be invoked using javascript? Or can you suggest any client side event of radgrid where i can de-select the rows?
Thanks for all help in prior.

 

 


3 Answers, 1 is accepted

Sort by
0
Casey
Top achievements
Rank 1
answered on 02 Mar 2012, 02:51 PM
Hi Suj,

Here is some javascript that can be used to rebind a RadGrid:

function rebindGrid() {
     var masterTable = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
     masterTable.rebind();
}

Here is a link demonstrating the javascript necessary to clear all of the RadGrid's selected items.

RadGrid Client Side - Clear Selected Items

I hope this helps!
Casey
0
Suj
Top achievements
Rank 1
answered on 03 Mar 2012, 05:38 AM
Thanks Casey for your response. In which client side event of radgrid can i call this javascript function?
0
Casey
Top achievements
Rank 1
answered on 05 Mar 2012, 02:15 PM
Hi Suj,

I would call this function in the button's OnClientClick event. 

I hope this helps!
Casey
Tags
Grid
Asked by
Suj
Top achievements
Rank 1
Answers by
Casey
Top achievements
Rank 1
Suj
Top achievements
Rank 1
Share this question
or