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

RadGrid not on first page of ASP Wizard control

6 Answers 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Toby
Top achievements
Rank 1
Toby asked on 10 Feb 2010, 10:41 AM
Hi,

I have a RadGrid binding to a datatable which works fine when the active page of the Wizard is set to the be page of the wizard where the RadGrid is, however if the RadGrid is a wizard page that is not displaying when the page first loads the grid will not display correctly.

<asp:Wizard ID="ConnectorWizard" runat="server" ActiveStepIndex="0"   
<WizardSteps> 
     <asp:WizardStep Title="Configuration"
     </asp:WizardStep>                              
     <asp:WizardStep Title="Devices Configuration">                             
          <telerik:RadGrid ID="CTIMonitorGrid" runat="server" AutoGenerateColumns="true"
          </telerik:RadGrid> 
</WizardSteps> 
</asp:Wizard> 

so if i set the ActiveStepIndex to 1 it will display the grid but not if set to 0

I am populating the grid on the page load by using

        DataTable dtCTIMonitors = webSess.MasterSystem.CTISystem.SelectCTIMonitorsView(3);       
        CTIMonitorGrid.DataSource = dtCTIMonitors

I have tried populating the grid each time the pageindex of the wizard control changes - but this does not seem to make any difference.

thanks
Toby


6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 10 Feb 2010, 11:10 AM
Hi,

Try using the AdvancedDataBinding technique to populate the RadGrid .

Thanks,
Shinu

0
Toby
Top achievements
Rank 1
answered on 10 Feb 2010, 11:20 AM
Hi that almost works, the first time you go the page where the grid is it is empty (infact its just a line of pixels!) if you go away from that page and then page again then it has bound to the data. If I put a break point on the CTIMonitorGrid_NeedDataSource event, it only seems to be fired the first time after moving away from the page with the grid on?

                           <telerik:RadGrid ID="CTIMonitorGrid" runat="server" AutoGenerateColumns="true" AllowMultiRowSelection="true"  OnNeedDataSource="CTIMonitorGrid_NeedDataSource"
                                <MasterTableView> 
                                    <Columns> 
                                        <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn" /> 
                                    </Columns> 
                                </MasterTableView> 
                            <ClientSettings EnableRowHoverStyle="true"
                                <Selecting AllowRowSelect="True" /> 
                            </ClientSettings> 
                        </telerik:RadGrid> 




    protected void CTIMonitorGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) 
    { 
        WebSession webSess = (WebSession)Session["WebSession"]; 
        DataTable dtCTIMonitors = webSess.MasterSystem.CTISystem.SelectCTIMonitorsView(3); 
        CTIMonitorGrid.DataSource = dtCTIMonitors
    } 

any ideas?

thanks
Toby
0
Toby
Top achievements
Rank 1
answered on 10 Feb 2010, 11:25 AM
I seem to have fixed it by telling the grid to rebind each time the wizard changes pages.

 protected void Wizard_ActiveStepChanged(object sender, EventArgs e) 
    { 
        CTIMonitorGrid.Rebind();         
    } 

thanks for your help.

Toby
0
Damin
Top achievements
Rank 1
answered on 30 Oct 2012, 11:30 AM
thanks for this result.
0
William
Top achievements
Rank 1
answered on 25 Jan 2016, 07:01 PM

Wouldn't this rebind that grid every time the wizard changed page whether that be the page with the radgrid or not? seems like it would slow down an application a bit I would imagine binding it to an event specific to that wizard page would be the better choice something like 

<p> protected void Wizard_ActiveStepChanged(object sender, EventArgs e) <br>    { </p><p>      if (e.SelectedPage == RadGridPage) </p><p>       {</p><p>CTIMonitorGrid.Rebind();</p><p>        }<br>    } </p>

0
Eyup
Telerik team
answered on 28 Jan 2016, 09:56 AM
Hello William,

Yes, your assumption is correct. Thank you for sharing it with our community.
You can check the recently added RadWizard control in the Telerik bundle:
http://demos.telerik.com/aspnet-ajax/wizard/overview/defaultcs.aspx

Also, I want to remind that calling simply DataBind() or Rebind() to bind the grid is not suggested. Performing complex grid operations such as Inserting, Deleting, Updating, Hierarchy relations, Grouping, Exporting, Paging, Sorting, Filtering, etc. require accommodating appropriate database operations.  Therefore, we suggest you to avoid Simple Databinding and strongly recommend the use of more advanced databinding methods, which automatically handle the aforementioned functions:
Declarative DataSource
Programmatic Data Binding


Regards,
Eyup
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
Grid
Asked by
Toby
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Toby
Top achievements
Rank 1
Damin
Top achievements
Rank 1
William
Top achievements
Rank 1
Eyup
Telerik team
Share this question
or