Reputation: 53
I need to disable search button after some information is displayed in the grid view. when i wrote "btnSearch.Enabled="false";" in the grid view button, Cannot implicitly convert type 'string' to 'bool' message will raise may give me solution please ?
protected void gvEmployeeLeaves_SelectedIndexChanged(object sender, EventArgs e)
{
btnSearch.Enabled="false";
}
Upvotes: 0
Views: 241
Reputation:
protected void gvEmployeeLeaves_SelectedIndexChanged(object sender, EventArgs e)
{
btnSearch.Enabled=false; /*btnSearch.Enabled="false"; is wrong
}
Upvotes: 0
Reputation: 831
protected void gvEmployeeLeaves_SelectedIndexChanged(object sender, EventArgs e)
{
btnSearch.Enabled=Convert.ToBoolean("false");
}
Upvotes: 0
Reputation: 26209
Problem : "false"
is not a valid boolean value(it is a string)
so you should change either string "false"
to false
or convert string "false"
to boolean.
You can directly assign the false
to the Enabled property without double quotes as below:
btnSearch.Enabled = false;
OR
You can convert the string false
to boolean value using Convert.ToBoolean()
method and then assign
Try This:
btnSearch.Enabled=Convert.ToBoolean("false");
Upvotes: 1
Reputation: 5430
You are providing string instead of boolean value. Just remove the double quotes:
btnSearch.Enabled = false;
Upvotes: 0