[Solved] how to open a message box [closed]


By message box I’m assuming you mean a javascript alert. I’m not a big fan of posting back with javascript functions. I think its messy, and that javascript should only be used when dealing with client-side actions.

I would actually recommend to use a placeholder and a literal control for this. You could have the following in your webform:

<asp:placeholder id="phLoginFailed" runat="server" visible="false">
     <div class="loginfailed">
        Login failed
     </div>
</asp:placeholder>

This placeholder could be styled like a popup, or displayed within your page using CSS.

Then change your C# to:

else
{
    phLoginFailed.Visible = true;
}

Also, its worth mentioning, your SQL query is prone to SQL Injection. You should use parameterised queries.

And you should encrypt passwords when storing them in the database for security purposes.

7

solved how to open a message box [closed]