HTML代码在.net中转换(无法正常工作) [英] Html code convert in .net (not working properly)
本文介绍了HTML代码在.net中转换(无法正常工作)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
HTML代码正在关注
HTML Code is following
<!-- start login box here -->
<div class="fr">
<div class="loginbox">
<div class="loginboxbg">
<div class="ltop">
<div class="bleft">
<div class="bright">
<div style="padding: 5px 10px; height: 20px;" class="arial15"> <strong>MEMBERS
LOGIN</strong> </div>
<div style="padding: 5px 10px;">
<form action="http://208.101.14.59/sms/php/pass.php?go=login"
method="post" name="form" id="form">
<div>
<div class="fl" style="width: 155px;">Login Email:</div>
<div class="fl" style="width: 20px;"> </div>
<div class="fl" style="width: 106px;">Password :</div>
<div class="clear"> </div>
</div>
<div>
<div class="fl" style="width: 155px;"><input class="box1" name="email"
type="text"></div>
<div class="fl" style="width: 20px;"> </div>
<div class="fl" style="width: 106px;"> <input class="box2" name="pwd"
type="password"></div>
<div class="fl"> <input src="images/loginbutt.jpg"
onclick="getElementById('form').submit()" type="image"> </div>
<div class="clear"> </div>
</div>
</form>
</div>
<div> </div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- End login box here -->
我想在.Net中转换此代码,但它给出了一些错误.
请帮助我.
I want to convert this code in .Net but it is giving some error.
Please help me.
推荐答案
嗨Vinodkumar,
我已根据您的要求修改了代码:
这是HTML代码
Hi Vinodkumar,
I have modified code as per your requirement:
This is HTML code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ZTest2.aspx.cs" Inherits="ZTest2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<script language="javascript" type="text/javascript">
alert('Invalid Email or Password!');
</script>
</head>
<body>
<form id="form1" runat="server">
<div class="fr">
<div class="loginbox">
<div class="loginboxbg">
<div class="ltop">
<div class="bleft">
<div class="bright">
<div style="padding: 5px 10px; height: 20px;" class="arial15">
<strong>MEMBERS LOGIN</strong>
</div>
<div style="padding: 5px 10px;">
<form action="http://208.101.14.59/sms/php/pass.php?go=login" method="post" name="form"
id="form">
<div>
<div class="fl" style="width: 155px;">
Login Email:</div>
<div class="fl" style="width: 20px;">
</div>
<div class="fl" style="width: 106px;">
Password :</div>
<div class="clear">
</div>
</div>
<div>
<div class="fl" style="width: 155px;">
<asp:TextBox runat="server" ID="txtEmail" CssClass="box1"></asp:TextBox>
</div>
<div class="fl" style="width: 20px;">
</div>
<div class="fl" style="width: 106px;">
<asp:TextBox runat="server" ID="txtPassword" CssClass="box2" TextMode="Password"></asp:TextBox>
</div>
<div class="fl">
<asp:ImageButton runat="server" ID="ibtnLogin" ImageUrl="mages/loginbutt.jpg"
AlternateText="Click to login" onclick="ibtnLogin_Click" />
</div>
<div class="clear">
</div>
</div>
</form>
</div>
<div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</form>
</body>
</html>
这是服务器端代码
This is server side code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class ZTest2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ibtnLogin_Click(object sender, ImageClickEventArgs e)
{
//Write your logic here...
//suppose in database would have
//Email=Imdadhusen.sunasara@gmail.com
//Password=Imdad
if (txtEmail.Text == "Imdadhusen.sunasara@gmail.com" && txtPassword.Text == "Imdad")
{
//Valid Email and Password
//You can write page name here instead of ProductHome.aspx
Response.Redirect("ProductHome.aspx");
}
else
{
//Invalid Email or Password
string strMessage = @" <script language='javascript' type='text/javascript'>
alert('Invalid Email or Password!');
</script>";
Response.Write(strMessage);
}
}
}
如有任何疑问,请让我知道.
如果对您有帮助,请提供投票.
谢谢,
Imdadhusen
Please do let me know, if you have any doubt.
Please provide Vote if this would be helpful to you.
Thanks,
Imdadhusen
这篇关于HTML代码在.net中转换(无法正常工作)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文