P
pbearne
Hi guys
I am trying to this function below
I have a web form with a load of inputs text boxs etc and i need to
disable them
So I have tried to write a function I can call and get the function to
work the type of the input so can disaable as needed
But this won't compile because the "inputObject" is not the right type!
Any ideas
Paul
private void DisableInput(Control inputObject,string tooltipString)
{
switch (inputObject.GetType().ToString())
{
case "TextBox":
(TextBox)inputObject.ReadOnly = true; // tried this
break;
case "DropDownList":
case "ListBox":
case "Button":
case "GridView":
inputObject.Enabled = false;
break;
case "HtmlInputFile":
case "HtmlInputHidden":
inputObject.Disabled = true;
break;
default:
Response.Write(inputObject.GetType().ToString());
}
inputObject.ToolTip += tooltipString;
uploadedThumbnail.Disabled = true;
}
I am trying to this function below
I have a web form with a load of inputs text boxs etc and i need to
disable them
So I have tried to write a function I can call and get the function to
work the type of the input so can disaable as needed
But this won't compile because the "inputObject" is not the right type!
Any ideas
Paul
private void DisableInput(Control inputObject,string tooltipString)
{
switch (inputObject.GetType().ToString())
{
case "TextBox":
(TextBox)inputObject.ReadOnly = true; // tried this
break;
case "DropDownList":
case "ListBox":
case "Button":
case "GridView":
inputObject.Enabled = false;
break;
case "HtmlInputFile":
case "HtmlInputHidden":
inputObject.Disabled = true;
break;
default:
Response.Write(inputObject.GetType().ToString());
}
inputObject.ToolTip += tooltipString;
uploadedThumbnail.Disabled = true;
}