How to Create Online Feedback Form in ASP.NET

Hello Developers, Here is Article to Create Feedback Form in C# ASP.NET. Here i am using Microsoft Visual Studio.Let’s Follow some important steps.

step 1 : Open Visual Studio.Go to File Tab –>Project –>Web –>ASP.NET Web Application–>Select Empty –>Check Web Forms and MVC–>OK.Right click on Project –>Add –>Web Forms –>Item name –> OK.Remove all Codes and Paste Following given codes.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Sony.WebForm4" %>

<!DOCTYPE html>
 <html >
<head runat="server">
    <title></title>
    <style type="text/css">
        .style1
        {
            color: #FF3300;
        }
        .auto-style1 {
            text-decoration: underline;
            font-size: large;
        }
        .auto-style2 {
            font-size: x-large;
        }
        .auto-style3 {
            background-color: #99FF66;
        }
        .auto-style4 {
            width: 664px;
        }
    </style>
</head>

<body style="background-color: #FFFFFF">
    <form id="form1" runat="server">
    <div>
        <fieldset style="width: 40%;">
            <legend class="auto-style2"><strong><span class="auto-style3">Online Feedback Form</span></strong></legend>
            <table cellpadding="2" cellspacing="5" class="auto-style4" >
                <tr>
                    <td width="80px">
                    </td>
                    <td>
                    </td>
                </tr>
                <tr>
                    <td width="80px">
                        <span class="auto-style1"><em><strong>Name</strong></em></span><span style="color: #CC3300" class="auto-style1"><em><strong> </strong></em></span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtName" runat="server" Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                            ErrorMessage="Name Required" ForeColor="#FF3300"
                            ControlToValidate="txtName"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong><em><span class="auto-style1">Subject </span></em></strong>&nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtSubject" runat="server" Width="200px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                            ErrorMessage="Subject Required" ForeColor="#FF3300"
                            ControlToValidate="txtSubject"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="auto-style1"><strong>E-Mail</strong></span><span style="color: #CC3300" class="auto-style1"><strong> </strong></span>&nbsp;</td>
                    <td>
                        <asp:TextBox ID="txtEmail" runat="server" Width="300px"></asp:TextBox>
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                            ErrorMessage="Email Required" ForeColor="#FF3300"
                            ControlToValidate="txtEmail"></asp:RequiredFieldValidator>
                        <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
                            ErrorMessage="Not a vailed email" ControlToValidate="txtEmail"
                            ForeColor="#FF3300"
                            ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                        <br />
                    </td>
                </tr>
                <tr>
                    <td>
                        <strong></strong>
                    </td>
                    <td>
                        <strong>How satisfied are you with our product</strong></td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal" Width="292px">
                            <asp:ListItem>Very Satified</asp:ListItem>
                            <asp:ListItem>Neutral</asp:ListItem>
                            <asp:ListItem>Unsatisfied</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <strong>How satisfied are you with our support</strong></td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:RadioButtonList ID="RadioButtonList2" runat="server" RepeatDirection="Horizontal" Width="337px">
                            <asp:ListItem>Very Satisfied</asp:ListItem>
                            <asp:ListItem>Neutral</asp:ListItem>
                            <asp:ListItem>Unsatified</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="auto-style1"><strong>Inquiry</strong></span><span style="color: #CC3300"> </span>
                    </td>
                    <td>
                        <asp:TextBox ID="txtInquiry" runat="server" Height="100px" TextMode="MultiLine" Width="400px"></asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        <asp:Button ID="btnSubmit" runat="server" Text="Submit Form" Width="100px" OnClick="btnSubmit_Click1" />
                    </td>
                </tr>
                <tr>
                    <td>
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        </fieldset>
    </div>
    </form>
</body>
</html>

Step 2 : Write Following Codes in WebForm.aspx.cs.

Output Screen:

Post Author: adama