c# - I Can not disable button due to error Cannot implicitly convert type string to bool -
i need disable search button after information displayed in grid view. when wrote "btnsearch.enabled="false";" in grid view button, cannot implicitly convert type 'string' 'bool' message raise may give me solution please ?
protected void gvemployeeleaves_selectedindexchanged(object sender, eventargs e) { btnsearch.enabled="false"; }
problem : "false"
not valid boolean value(it string)
so should change either string "false"
false
or convert string "false"
boolean.
you can directly assign false
enabled property without double quotes below:
btnsearch.enabled = false;
or
you can convert string false
boolean value using convert.toboolean()
method , assign
try this:
btnsearch.enabled=convert.toboolean("false");
Comments
Post a Comment