Displaying RadGrid

2 posts, 0 answers
  1. Vitaly
    Vitaly  avatar
    76 posts
    Member since:
    Aug 2011

    Posted 15 Oct 2013 Link to this post

    Good afternoon,
    In my Web Application I do have searching criteria with RadComboBox on it.RadComboBox consist of 2 values.Based on these value I am displaying RadGrid on the screen.
    If value 'A' - all 4 Grids are displaying
    if value 'P' - only 2 Grids are displaying.
    My question is:If user select  value 'A' I need to display only 2 Grids and these grids are described in aspx page two bottom grids.How to display these 2 grids on the top of the screen like overlayed first two.
    Because if I make first two visible=false then 2 other grids will display on the bottom of the page.

    Thanks so much for your help
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Oct 2013 Link to this post

    Hi,

    I have tried your described scenario,the grids were aligning perfectly,even when the grids above are hidden,the below grids are moved up.Below is the sample code snippet that I tried.

    ASPX:
    <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged">
        <Items>
            <telerik:RadComboBoxItem Text="A" Value="A" />
            <telerik:RadComboBoxItem Text="P" Value="P" />
        </Items>
    </telerik:RadComboBox>
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" Visible="false">
        <MasterTableView>
        </MasterTableView>
    </telerik:RadGrid>
    <br />
    <telerik:RadGrid ID="RadGrid2" runat="server" DataSourceID="SqlDataSource2" Visible="false">
        <MasterTableView>
        </MasterTableView>
    </telerik:RadGrid>
    <br />
    <telerik:RadGrid ID="RadGrid3" runat="server" DataSourceID="SqlDataSource3" Visible="false">
        <MasterTableView>
        </MasterTableView>
    </telerik:RadGrid>
    <br />
    <telerik:RadGrid ID="RadGrid4" runat="server" DataSourceID="SqlDataSource4" Visible="false">
        <MasterTableView>
        </MasterTableView>
    </telerik:RadGrid>

    C#:
    protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        string val=RadComboBox1.SelectedValue;
        if (val == "A")
        {
            RadGrid1.Visible = true;
            RadGrid2.Visible = true;
            RadGrid3.Visible = true;
            RadGrid4.Visible = true;
        }
        if(val=="P")
        {
            RadGrid1.Visible = false;
            RadGrid2.Visible = true;
            RadGrid3.Visible = false;
            RadGrid4.Visible = true;
        }
    }

    Thanks,
    Shinu
Back to Top