I have a WebCombo that will always have a DataTextField and DataValueField specified, but sometimes, its DataSource will be null or will not contain matching columns. In this case, I would like the combo to be visible but unusable.
What do you guys think the most elegant solution is?
Hello randrews,
I know it’s been a while since you’ve posted this but if you still need assistance with it I’d be glad to help.
One possible solution for this issue is the following:
Depending on the content of your DataSource you could disable the WebCombo on WebCombo1_Init event. For example:
protected void WebCombo1_Init(object sender, EventArgs e)
{
table = MakeTable(); //get content of data
if (table==null ) //check if it's nulll
WebCombo combo = (WebCombo)sender;
combo.Enabled = false; //disable combo
}
else
WebCombo1.DataValueField = "id";
WebCombo1.DataTextField = "Item";
WebCombo1.DataSource = table;
WebCombo1.DataBind();
This will disable the WebCombo if the data is null and databind it if it isn’t.
If you need further assistance with this don’t hesitate to ask.
Best Regards,
Maya Kirova
Developer Support Engineer
Infragistics, Inc.
http://ko.infragistics.com/support