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

Hide the grid

3 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kenny
Top achievements
Rank 1
kenny asked on 17 Nov 2008, 10:55 AM
need help

how do i hide the grid, control by drop down combobox.
the example given by doc, is use the button. but i not useful for me.
i wan according the selection data to view the grid or hide it.

any help
thx

kenny

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Nov 2008, 11:05 AM
Hello Kenny,

According to my understanding, i suppose you would want to hide/show your grid according to the selected item in the combobox. If thats the case, check out the code below:
aspx:
<telerik:RadComboBox AutoPostBack="true" ID="RadComboBox1" runat="server" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
        <Items> 
        <telerik:RadComboBoxItem  Text="Show"/> 
        <telerik:RadComboBoxItem Text="Hide"/> 
        </Items> 
</telerik:RadComboBox> 

cs:
 
protected void RadComboBox1_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)  
    {  
       if (RadComboBox1.SelectedItem.Text == "Hide")  
        {  
            RadGrid1.Visible = false;  
        }  
        else  
        {  
            RadGrid1.Visible = true;  
        }  
    }  
 

Thanks
Princy.
0
kenny
Top achievements
Rank 1
answered on 17 Nov 2008, 01:16 PM
thx, ur help. this i can solve according the doc.
My another problem is i want the grid hide when first time onload. how i to make it.
i have try to hide it.. It can work, but when i select the selected item in combobox to show the grid. it cant function, coz cant find the grid ID.
Error:# window["RadGrid1.clientid"]= null


any idea


0
Shinu
Top achievements
Rank 2
answered on 18 Nov 2008, 04:52 AM
Hi Kenny,

Try rebinding the Gird after setting its visible property to true.

ASPX:
<telerik:RadGrid ID="RadGrid1" runat="server"  AllowPaging="True" PageSize="20" GridLines="None" OnNeedDataSource="RadGrid1_NeedDataSource" Visible="False"

 <telerik:RadComboBox ID="RadComboBox1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="RadComboBox1_SelectedIndexChanged"
         <Items> 
          <telerik:RadComboBoxItem  Text="Hide" runat="server" /> 
          <telerik:RadComboBoxItem  Text="Show" runat="server" /> 
         </Items> 
        </telerik:RadComboBox> 

CS:
  protected void RadComboBox1_SelectedIndexChanged(object o, Telerik.Web.UI.RadComboBoxSelectedIndexChangedEventArgs e) 
    { 
        if (RadComboBox1.SelectedItem.Text == "Hide") 
            RadGrid1.Visible = false
        else 
        { 
            RadGrid1.Visible = true
            RadGrid1.Rebind(); 
        } 
 
    } 

Shinu

Tags
Grid
Asked by
kenny
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
kenny
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or