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

[Solved] Rebind not causing NeedDataSource to fire

2 Answers 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wdudek
Top achievements
Rank 1
wdudek asked on 30 Jun 2008, 03:31 PM
I have a grid that implements the need data source event, which is experiencing problems where this event does nto always fire. Through 2 methods I am calling rebind on the grid, the first is when the index changes on a combo box and the second is when a button is clicked that adds data to the grid. When the index changes on the combobox, everything works as expected and the event is raised. When grid.Rebind() is called in the button click event the event is not raised. I do see it being called before the button click event handler is fired, but not after rebind is called inside of button click. I tried to put togather a sample site, but could not reproduce the behavior. I am not using ajax yet, so it isn't related to that. ViewState is enabled and I am running the Q1 2008 version of the controls. Below is the aspx I am using, but like I said I wasn't able to reproduce the problem in a sample app and the one this is from is tied to a database.

Any thoughts/suggestions would be greatly appreciated.

Thanks

Bill

                <rad:RadGrid ID="rgThresholds" runat="server" AutoGenerateColumns="False" GridLines="None" 
                    OnNeedDataSource="rgThresholds_NeedDataSource" AutoGenerateDeleteColumn="True" 
                    AutoGenerateEditColumn="True" OnItemDataBound="rgThresholds_ItemDataBound"   
                    oneditcommand="rgThresholds_EditCommand">  
                    <MasterTableView DataKeyNames="ThresholdID">  
                        <RowIndicatorColumn Visible="False">  
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </RowIndicatorColumn> 
                        <ExpandCollapseColumn Visible="False" Resizable="False">  
                            <HeaderStyle Width="20px"></HeaderStyle> 
                        </ExpandCollapseColumn> 
                        <Columns> 
                            <rad:GridBoundColumn DataField="MinimumValue" HeaderText="Min Value" UniqueName="MinimumValue">  
                            </rad:GridBoundColumn> 
                            <rad:GridBoundColumn DataField="MaximumValue" HeaderText="Max Value" UniqueName="MaximumValue">  
                            </rad:GridBoundColumn> 
                            <rad:GridBoundColumn DataField="MaximumRemainderUnits" HeaderText="Max Remainder Units" 
                                UniqueName="MaximumRemainderUnits">  
                            </rad:GridBoundColumn> 
                            <rad:GridButtonColumn CommandName="Delete" Text="Delete"   
                                UniqueName="AutoGeneratedDeleteColumn">  
                                <HeaderStyle Width="45px" /> 
                            </rad:GridButtonColumn> 
                            <rad:GridEditCommandColumn UniqueName="AutoGeneratedEditColumn">  
                                <HeaderStyle Width="30px" /> 
                            </rad:GridEditCommandColumn> 
                        </Columns> 
                    </MasterTableView> 
                </rad:RadGrid> 
 


2 Answers, 1 is accepted

Sort by
0
wdudek
Top achievements
Rank 1
answered on 30 Jun 2008, 03:35 PM
Ok, I just found out that if I set the datasource of the grid to null before calling rebind the event gets raised. Is this supposed to work this way?
0
Vlad
Telerik team
answered on 01 Jul 2008, 05:57 AM
Hello wdudek,

You can check this article for more info:
http://www.telerik.com/help/aspnet-ajax/grdrebindgridoncommandwithdatasourcepersistencemodenopersistence.html

Regards,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
wdudek
Top achievements
Rank 1
Answers by
wdudek
Top achievements
Rank 1
Vlad
Telerik team
Share this question
or