RadGrid not on first page of ASP Wizard control

7 posts, 0 answers
  1. Toby
    Toby avatar
    59 posts
    Member since:
    Jul 2009

    Posted 10 Feb 2010 Link to this post

    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


  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 10 Feb 2010 Link to this post

    Hi,

    Try using the AdvancedDataBinding technique to populate the RadGrid .

    Thanks,
    Shinu

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Toby
    Toby avatar
    59 posts
    Member since:
    Jul 2009

    Posted 10 Feb 2010 Link to this post

    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
  5. Toby
    Toby avatar
    59 posts
    Member since:
    Jul 2009

    Posted 10 Feb 2010 Link to this post

    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
  6. Damin
    Damin avatar
    1 posts
    Member since:
    Oct 2012

    Posted 30 Oct 2012 Link to this post

    thanks for this result.
  7. William
    William avatar
    2 posts
    Member since:
    Jan 2016

    Posted 25 Jan in reply to Toby Link to this post

    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>

  8. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 28 Jan Link to this post

    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
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017