带有自动ID生成的反馈/投诉表格,并感谢您发送到电子邮件地址的邮件。 [英] Feedback/Complaint Form with automatic ID Generation and thank you mail sending to email address.
问题描述
我想设计一个ASP.Net表格用于反馈/投诉页面。
我的要求是:
* sholud是两个单选按钮位于顶部页面。(1代表旧投诉,另一则代表新投诉。)
*当用户点击旧投诉时,将显示一个文本框并询问您的投诉ID。当用户输入投诉ID并提交时,会显示投诉的详细信息。
* 当用户点击新投诉时,会显示名称,滚动号码和主题和电子邮件的字段消息显示。当用户提交表单时,它会显示一条确认信息,感谢您提供反馈,并且邮件应该发送给用户,您的反馈/投诉ID是抱怨。
*所有数据都应存储在数据库中并从数据库中检索。
请帮助我,我在提交和电子邮件部分时无法进行自动ID生成部分。
谢谢。
I want to design a ASP.Net form for feedback/Complaint page.
My requirement is:
* There sholud be two radio buttons on the top of the page.(1 is for old Complaints and another is for new complaint.)
* When user clicks on old complaints then a textbox will be displayed and asking for "Your Complaint ID". When user enters the complaint ID and submits then the details of the complaint is shown.
* When user clicks on new Complaint then fields for Name,Roll Number and email with Subject and message are shown. When user will submit the form it will show a confirmation that thank you for feedback and a mail should go to the user that your feedback/Complaint ID is "complaintid".
* All data should store in database and retrieve also from database.
Please help me out i am unable to do the automatic ID generation part while submitting and the email part.
Thank You.
推荐答案
- 在页面中有两个视图的多视图控件。根据Radiobutton的选定值更改视图。
- 当你选择NEW COMPLAINT时,你的第二个视图将显示如下。
-Have multiview control in your page with two views.Change the view according to selected value of the Radiobutton.
-When you select NEW COMPLAINT,then your second view will be displayed as below.
<asp:multiview id="MultiView1" runat="server" xmlns:asp="#unknown">
<asp:view id="View1" runat="server">
/*old complaint section*/
</asp:view>
<asp:view id="View2" runat="server">
<table>
<tr>
<td>
Name
</td>
<td>textbox</td>
</tr>
<tr>
<td>
Roll No.
</td>
<td>textbox</td>
</tr>
<tr>
<td>
Subject
</td>
<td>textbox</td>
</tr>
<tr>
<td>
Message
</td>
<td>textbox</td>
</tr>
<tr>
<td>button</td>
</tr>
</table></asp:view>
</asp:multiview>
点击按钮事件。
on click event of the button.
string code1 = Guid.NewGuid().ToString();/*you can generate random numbers with other methods also*/
using (MailMessage message = new MailMessage())
{
message.IsBodyHtml = true;
message.From = new MailAddress(from which you want to send mail);
message.To.Add(new MailAddress(to which you want to send mail));
message.Subject = subject here;
message.Body =body text here;
SmtpClient smtp = new SmtpClient();
smtp.Host = "host";
smtp.Credentials = new System.Net.NetworkCredential(username, password);/*you can also define this in web config file*/
smtp.EnableSsl = false;
smtp.Send(message);
Response.Write("<script type='text/javascript'>");
Response.Write("alert('Thanks for feedback.');");
Response.Write("</script>");
}
这篇关于带有自动ID生成的反馈/投诉表格,并感谢您发送到电子邮件地址的邮件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!