Since you did not mention where your RadComboBox
is, I am assuming it is outside of the RadGrid
control. If that is the case, I suggest you implement a custom method to recursively search for your Placeholder
.
// search for a specified control in the given root control and all its children
public static Control FindControlRecursive(Control rootControl, string searchControlID)
{
if (rootControl.ID == searchControlID) return rootControl;
foreach (Control controlToSearch in rootControl.Controls)
{
Control controlToReturn = FindControlRecursive(controlToSearch, searchControlID);
if (controlToReturn != null) return controlToReturn;
}
return null;
}
Then, in your page's code-behind, you can search for plupload
and set its Visible
attribute.
protected void RadComboBox1_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e))
{
RadComboBox RadComboBox1 = (RadComboBox)sender;
// Get the placeholder control nested inside the RadGrid
Placeholder plupload = (Placeholder)FindControlRecursive(RadGrid1, "plupload");
if (plupload != null)
{
if (RadComboBox1.SelectedValue == "2")
plupload.Visible = false;
else plupload.Visible = true;
}
}