Click here to Skip to main content
15,887,585 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.
Posted

1 solution

-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.

C#
<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.

C#
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>");
}
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900