Asp.net和HTML表单 [英] Asp.net and html forms

查看:61
本文介绍了Asp.net和HTML表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我有一个名为form.html的html页面,在其中我需要从用户那里获取用户名和emailid之类的详细信息,然后插入数据库中.
因此,在插入数据库时​​将值发布到.aspx页并与数据库进行交互,在其中编写后端代码进行交互.到那时一切都工作正常.现在,我的问题是在将数据成功插入数据库后我要显示在aspx.cs页面上编写的代码的基础上,在form.html上向用户发送一条消息.可以解决此问题吗?
请给我建议一些解决方案...
在此先感谢....

解决方案

您可以从后面的代码重定向到html页面,并在查询字符串中向您发送消息.

是的,可以尝试以下操作:

  int  i = comm.ExecuteNonQuery();
如果(i> 0)
{
字符串脚本= " ;
       Page.ClientScript.RegisterClientScriptBlock( .GetType()," 警报" ,脚本);
} 



希望对您有所帮助:)

有关更多查询,请在此处评论!


Response.Write将起作用,或者您可以在页面上添加标签并设置其Text属性.我会选择后者-它使您可以更好地控制文本的位置.


hi everyone,,

I have a html page named form.html where in i need to get the details like username and emailid from the user and insert into database.
So while inserting into database am posting the values to .aspx page and interacting with the database wherein am writing the backend code for interaction.Till then Everything is working fine.Now,My question is after successfull insertion of data into database i want to display a message to the user on form.html on basis of code written in aspx.cs page.Can this be worked out???
Please suggest me some solution...
Thanks in advance.......

解决方案

You can redirect to the html page from your code behind and send you message in the query string.


Yes, it is possible, try this:

int i=comm.ExecuteNonQuery();
if(i>0)
{
string script = "<script type=\"text/javascript\">alert('Your have been registered successfully!');</script>";
       Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", script);
}



hope it helps :)

for further queries comment here!


Response.Write will work, or you could add a label to the page and set it''s Text property. I''d go with the later - it gives you better control over where the text will go.


这篇关于Asp.net和HTML表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆