unctional Requirements Design a Windows Forms Application fo
Solution
Search Form
..................
<%@ Page Title=\"\" Language=\"C#\" MasterPageFile=\"~/User.master\" AutoEventWireup=\"true\" CodeFile=\"SearchDynamicQueryform.aspx.cs\" Inherits=\"SearchDynamicQueryform\" %>
<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"head\" Runat=\"Server\">
 <style type=\"text/css\">
 .class1
 {
 margin-left:400px;
 margin-top:-80px;
 }
 .class2
 {
 margin-left:100px;
 }
 td
 {
 width:500px;
 }
 .auto-style1 {
 
 width: 654px;
 }
 .class3
 {
 margin-left:400px;
 }
 </style>
 <script type=\"text/javascript\">
 function fun1()
 {
   
 }
 </script>
 </asp:Content>
 <asp:Content ID=\"Content2\" ContentPlaceHolderID=\"ContentPlaceHolder1\" Runat=\"Server\">
 
 <div>
 Search dynamic query form
 <table style=\"width: 700px;background-color:green\">
 <tr>
 <td class=\"auto-style1\">Display</td>
 <td>Condition</td>
 </tr>
 </table>
 <asp:CheckBoxList ID=\"CheckBoxList1\" runat=\"server\" CssClass=\"class2\">
 <asp:ListItem>userid</asp:ListItem>
 <asp:ListItem>name</asp:ListItem>
 <asp:ListItem>emailid</asp:ListItem>
 </asp:CheckBoxList>
 <asp:RadioButtonList ID=\"RadioButtonList1\" runat=\"server\" CssClass=\"class1\">
 <asp:ListItem>Male</asp:ListItem>
 <asp:ListItem>Female</asp:ListItem>
 </asp:RadioButtonList>
 <asp:Button ID=\"Button1\" runat=\"server\" Text=\"Submit\" CssClass=\"class3\" OnClick=\"Button1_Click\" />
 </div>
 <div style=\"margin-top:50px\">
 <asp:GridView ID=\"Gridview1\" runat=\"server\" AutoGenerateColumns=\"true\"></asp:GridView>
 </div>
 </asp:Content>
Registration
...................
<%@ Page Title=\"\" Language=\"C#\" MasterPageFile=\"~/Main.master\" AutoEventWireup=\"true\" CodeFile=\"Registration.aspx.cs\" Inherits=\"Registration\" %>
<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"head\" Runat=\"Server\">
 <style type=\"text/css\">
 .auto-style1 {
 width: 128px;
 }
 </style>
 </asp:Content>
 <asp:Content ID=\"Content2\" ContentPlaceHolderID=\"ContentPlaceHolder1\" Runat=\"Server\">
<table align=\"center\" style=\"margin-top:100px\">
 <tr align=\"center\">
 <td colspan=\"2\">User Registration</td>
 </tr>
 <tr>
 <td><asp:Label ID=\"Label1\" runat=\"server\" Text=\"UserName\"></asp:Label></td>
 <td class=\"auto-style1\"><asp:TextBox ID=\"txtname\" runat=\"server\"></asp:TextBox></td>
 </tr>
 <tr>
 <td><asp:Label ID=\"Label2\" runat=\"server\" Text=\"EmailAddres\"></asp:Label></td>
 <td class=\"auto-style1\"><asp:TextBox ID=\"txtemail\" runat=\"server\" ></asp:TextBox></td>
 </tr>
 <tr>
 <td><asp:Label ID=\"Label3\" runat=\"server\" Text=\"Password\"></asp:Label></td>
 <td class=\"auto-style1\"><asp:TextBox ID=\"txtpwd\" runat=\"server\" TextMode=\"Password\" ></asp:TextBox></td>
 </tr>
 <tr>
 <td><asp:Label ID=\"Label4\" runat=\"server\" Text=\"ConfirmPassword\"></asp:Label></td>
 <td class=\"auto-style1\"><asp:TextBox ID=\"conpwd\" runat=\"server\" TextMode=\"Password\" ></asp:TextBox></td>
 </tr>
 <tr>
 <td><asp:Label ID=\"Label5\" runat=\"server\" Text=\"Gender\"></asp:Label></td>
 <td class=\"auto-style1\"><asp:RadioButtonList ID=\"RadioButtonList1\" runat=\"server\" RepeatDirection=\"Horizontal\">
 <asp:ListItem>Male</asp:ListItem>
 <asp:ListItem>Female</asp:ListItem>
 </asp:RadioButtonList></td>
   
 </tr>
 <tr>
 <td><asp:Label ID=\"label6\" runat=\"server\" Text=\"DOB\"></asp:Label></td>
 <td><asp:TextBox ID=\"txtdate\" runat=\"server\" ></asp:TextBox></td>
 </tr>
 <tr align=\"center\">
 <td colspan=\"2\">
 <asp:Button ID=\"btn1\" runat=\"server\" Text=\"Register\" OnClick=\"btn1_Click\" />
 </td>
 
 </tr>
 </table>
 </asp:Content>
UserHome
.............
<%@ Page Title=\"\" Language=\"C#\" MasterPageFile=\"~/User.master\" AutoEventWireup=\"true\" CodeFile=\"userhome.aspx.cs\" Inherits=\"userhome\" %>
<asp:Content ID=\"Content1\" ContentPlaceHolderID=\"head\" Runat=\"Server\">
 </asp:Content>
 <asp:Content ID=\"Content2\" ContentPlaceHolderID=\"ContentPlaceHolder1\" Runat=\"Server\">
 <div style=\"text-align:center\">
 <b>Create Type of Dynamic Query Form</b>
 </div>
 <div style=\"margin-left:100px;margin-top:50px\">
 select type of query form:<asp:DropDownList ID=\"drop1\" runat=\"server\">
 <asp:ListItem>------select-------</asp:ListItem>
 <asp:ListItem>Create Dynamic Query Form</asp:ListItem>
 <asp:ListItem>Search Dynamic Query Result</asp:ListItem>
</asp:DropDownList><asp:Button ID=\"button1\" runat=\"server\" Text=\"Submit\" OnClick=\"button1_Click\" />
 </div>
 </asp:Content>
search
.............
using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Web;
 using System.Web.UI;
 using System.Web.UI.WebControls;
 using System.Data;
 using System.Configuration;
 using System.Data.SqlClient;
 public partial class SearchDynamicQueryform : System.Web.UI.Page
 {
 SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[\"con\"].ConnectionString);
 
 protected void Page_Load(object sender, EventArgs e)
 {
 if(con.State==ConnectionState.Closed)
 {
 con.Open();
 }
 if(!IsPostBack)
 {
 SqlCommand cmd = new SqlCommand(\"select * from reg\",con);
 SqlDataAdapter da = new SqlDataAdapter(cmd);
 DataSet ds = new DataSet();
 da.Fill(ds, \"reg\");
 Gridview1.DataSource = ds.Tables[\"reg\"].DefaultView;
 Gridview1.DataBind();
 }
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
 String str1 = RadioButtonList1.SelectedItem.ToString();
 String str2 = CheckBoxList1.SelectedItem.ToString();
 if(str1!=null)
 {
 display(str1);
 }
 if(str2!=null)
 {
 displayfields(str2);
 }
}
 public void display(String str1)
 {
 SqlCommand cmd1 = new SqlCommand(\"select name,emailid,dob from reg where gender=\'\"+str1+\"\'\",con);
 SqlDataAdapter da = new SqlDataAdapter(cmd1);
 DataSet ds = new DataSet();
 da.Fill(ds, \"reg\");
 Gridview1.DataSource = ds.Tables[\"reg\"].DefaultView;
 Gridview1.DataBind();
}
 public void displayfields(String str2)
 {
 int k=0;
 if(str2==\"userid\")
 {
 k = 0;
 }
 else if(str2==\"name\")
 {
 k = 1;
   
 }
 else if(str2==\"emailid\")
 {
 k = 2;
 }
 Response.Write(str2);
 SqlCommand cmd2 = new SqlCommand(\"select * from reg \", con);
 SqlDataAdapter da = new SqlDataAdapter(cmd2);
 DataSet ds = new DataSet();
 da.Fill(ds, \"reg\");
DataTable dt = new DataTable();
 dt.Columns.Add(str2);
 for (int i = 0; i < ds.Tables[\"reg\"].Rows.Count;i++ )
 {
 DataRow dr =dt.NewRow();
 dr[str2] = ds.Tables[\"reg\"].Rows[i][k];
 dt.Rows.Add(dr);
 }
Gridview1.DataSource = dt;
Gridview1.DataBind();
 Response.Write(ds.Tables[\"reg\"].Rows[0][0]);
 }
 }
change the fields as your requirements





