Hi all,
On my GridView in C# ASP.Net, I need to insert these conditions:
- Check that the email registered in the database is the same as that of the user authenticated by the master page
- Check the state_sign registered in the database
If the email registered in the database is the same as that of the user authenticated in master page the imgbtnEdit is Enabled else Disabled.
If the value of the state_sign registered in the database it's 2 then the imgbtnEdit is Disabled and the imgbtnEdit ImageUrl it's i_Button.gif
I have tried this code without success, because the only conditions that work are those of the email address check.
Any suggestion?
string strEmail = Mp.Container.Email.ToString();
string strDBEmail = DataBinder.Eval(e.Row.DataItem, "RegisteredEmail").ToString();
int state_sign = Convert.ToInt32(DataBinder.Eval(e.Row.DataItem, "state_sign").ToString());
ImageButton imgbtnEdit = (ImageButton)e.Row.FindControl("imgbtnEdit");
if (state_sign == 2)
{
imgbtnEdit.ImageUrl = "/aspnet/img/i_Button.gif";
imgbtnEdit.ToolTip = "state_sign";
imgbtnEdit.Enabled = false;
}
if (RegisteredEmail.ToString().ToLower() == strEmail.ToString().ToLower())
{
imgbtnEdit.ImageUrl = "/aspnet/img/m_Button.gif";
imgbtnEdit.ToolTip = "RegisteredEmail";
imgbtnEdit.Enabled = true;
}
else
{
imgbtnEdit.ImageUrl = "/aspnet/img/e_Button.gif";
imgbtnEdit.ToolTip = "NOT RegisteredEmail";
imgbtnEdit.Enabled = false;
}