I am trying to make a button inside a webform visible if data available. I have a database with a column name NCID, then in a views I count the NCID's. and I a have btn1 till btn9 hidden. If NCID Count is 1 show button btn1, if NCID Count is 2 then show btn1 and btn2.
How can I target the Button ID to make it visible or hide it?
I tried the following but it is not working for me.
while (sr.Read())
{
string NCID = sr["NCID"].ToString();
int nc2 = Convert.ToInt32(NCID);
int x = 1;
do
{
string btnx = "btn" + x;
btnx.Visible = true;
x++;
} while (x <= nc2);
}
con.Close();