<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebInterface.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click"/>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebInterface
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
DropDownList1.Items.Add("MEDICAL");
TextBox1.Text = "1Jan2000";
TextBox2.Text = "2Jan2000";
TextBox3.Text = "FEVER";
}
protected void Button1_Click(object sender, EventArgs e)
{
ConcurrentDictionary<string, Leave> MyDictionary = new ConcurrentDictionary<string, Leave>();
Leave l = new Leave();
l.LeaveType = DropDownList1.SelectedValue.Trim();
l.FromDate = TextBox1.Text.Trim();
l.ToDate = TextBox2.Text.Trim();
l.Reason = TextBox3.Text.Trim();
MyDictionary.TryAdd(l.FromDate,l);
GridView1.DataSource = MyDictionary.Select(m => new { m.Value.LeaveType,m.Value.FromDate,m.Value.ToDate,m.Value.Reason });
GridView1.DataBind();
}
public class Leave
{
public string LeaveType;
public string FromDate;
public string ToDate;
public string Reason;
}
}
}