3 Answers, 1 is accepted
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:
cs:
Thanks
Princy.
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
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:
CS:
Shinu
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