.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="fgdsms1.index" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/StyleSheet2.css" rel="stylesheet" />
<script type="text/javascript">
window.history.forward(1);
</script>
<style type="text/css">
.auto-style21 {
background-color: #006666;
}
.auto-style23 {
height: 49px;
text-align: center;
}
.auto-style24 {
width: 38px;
}
.auto-style25 {
font-size: large;
text-align: center;
}
.auto-style26 {
font-size: xx-large;
}
</style>
<div id="page-wrap">
<body class="auto-style21">
<title>SMS</title>
</head>
<form id="form1" runat="server">
<div>
<table width="100%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<tr bgcolor="#3090C7">
<td class="auto-style24"><img src="img/m1.png" height="100"/>
</td>
<th colspan="5" class="auto-style3">
<font color="white" class="auto-style9"><strong class="auto-style12"><span class="auto-style26">MUNPL MESSAGE SYSTEM</span></strong></font><span class="auto-style26">
</span>
</th>
<th class="auto-style3">
<font color="white" class="auto-style9"> Date</th></font>
</tr>
</table>
<table width="40%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<tr>
<td class="auto-style23"><h4 class="auto-style17">Group-1
<asp:CheckBox ID="CheckBox1" runat="server" Text="" /></h4>
</td>
<td class="auto-style23"><h4 class="auto-style17">Group-2
<asp:CheckBox ID="CheckBox2" runat="server" Text="" /></h4>
</td>
<td class="auto-style23"><h4 class="auto-style17">Group-3
<asp:CheckBox ID="CheckBox3" runat="server" Text="" /></h4>
</td>
</tr>
<tr bgcolor="#3090C7">
<font color="#FFFF12" bgcolor="#99CCCC" >
<h3 align="left" >Logged By :
<strong>
<font color="white" >
Emp. Id:
<asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>  
Mob.No:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>  
</font>
</strong>
</h3>
</u></tr>
<table width="10%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<br />
<tr>
<td> <center><b>TYPE MESSAGE</b></center>
<asp:TextBox runat="server" ID="msg" TextMode="Multiline" Columns="20" Name="S1" Rows="2" CssClass="auto-style10" Height="200px" Width="755px"></asp:TextBox><br />
<center><asp:Button ID="Button1" runat="server" Text="SEND" OnClick="Button1_Click" CssClass="auto-style15" Height="26px" Width="83px"></asp:Button></center>
</td>
</tr>
</table><br /><br /><br />
<div class="auto-style25">
TH
<div id="dialog" style="display: none">
</div>
</div>
</div>
</form>
</html>
.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System;
using System.Data.SqlClient;
using System.Configuration;
namespace fgdsms1
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
group();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string cs = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("INSERT INTO emp (Id,Name,mob,grp) VALUES('" + Label1.Text + "','" + Label2.Text + "','" + msg.Text + "','" + CheckBox3.Text + "')", con);
cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string message = "details have been saved successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += Request.Url.AbsoluteUri;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
private void group()
{
string connStr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connStr))
{
string query = "SELECT Id, Name,mob,grp FROM emp";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
CheckBox3.DataSource = reader;
CheckBox3.DataTextField = "mob";
CheckBox3.DataValueField = "Id";
CheckBox3.DataBind();
}
}
}
}
.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System;
using System.Data.SqlClient;
using System.Configuration;
namespace fgdsms1
{
public partial class index : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
group();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string cs = System.Configuration.ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
SqlConnection con = new SqlConnection(cs);
SqlCommand cmd = new SqlCommand("INSERT INTO emp (Id,Name,mob,grp) VALUES('" + Label1.Text + "','" + Label2.Text + "','" + msg.Text + "','" + CheckBox3.Text + "')", con);
cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string message = "details have been saved successfully.";
string script = "window.onload = function(){ alert('";
script += message;
script += "');";
script += "window.location = '";
script += Request.Url.AbsoluteUri;
script += "'; }";
ClientScript.RegisterStartupScript(this.GetType(), "SuccessMessage", script, true);
}
private void group()
{
string connStr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
using (SqlConnection conn = new SqlConnection(connStr))
{
string query = "SELECT Id, Name,mob,grp FROM emp";
SqlCommand cmd = new SqlCommand(query, conn);
conn.Open();
SqlDataReader reader = cmd.ExecuteReader();
CheckBox3.DataSource = reader;
CheckBox3.DataTextField = "mob";
CheckBox3.DataValueField = "Id";
CheckBox3.DataBind();
}
}
}
}
.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="index.aspx.cs" Inherits="fgdsms1.index" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="css/StyleSheet2.css" rel="stylesheet" />
<script type="text/javascript">
window.history.forward(1);
</script>
<style type="text/css">
.auto-style21 {
background-color: #006666;
}
.auto-style23 {
height: 49px;
text-align: center;
}
.auto-style24 {
width: 38px;
}
.auto-style25 {
font-size: large;
text-align: center;
}
.auto-style26 {
font-size: xx-large;
}
</style>
<div id="page-wrap">
<body class="auto-style21">
<title>SMS</title>
</head>
<form id="form1" runat="server">
<div>
<table width="100%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<tr bgcolor="#3090C7">
<td class="auto-style24"><img src="img/.png" height="100"/>
</td>
<th colspan="5" class="auto-style3">
<font color="white" class="auto-style9"><strong class="auto-style12"><span class="auto-style26"> MESSAGE SYSTEM</span></strong></font><span class="auto-style26">
</span> </th>
<th class="auto-style3">
<font color="white" class="auto-style9"> Date</th></font>
</tr>
</table>
<table width="40%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<tr>
<td class="auto-style23"><h4 class="auto-style17">Group-1
<asp:CheckBox ID="CheckBox1" runat="server" Text="" /></h4>
</td>
<td class="auto-style23"><h4 class="auto-style17">Group-2
<asp:CheckBox ID="CheckBox2" runat="server" Text="" /></h4>
</td>
<td class="auto-style23"><h4 class="auto-style17">Group-3
<asp:CheckBox ID="CheckBox3" runat="server" Text="" /></h4>
</td>
</tr>
<tr bgcolor="#3090C7">
<font color="#FFFF12" bgcolor="#99CCCC" >
<h3 align="left" >Logged By :
<strong>
<font color="white" >
Emp. Id:
<asp:Label ID="lblName" runat="server" Text="Label"></asp:Label>  
Mob.No:
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>  
</font>
</strong>
</h3>
</u></tr>
<table width="10%" height="30" border="0" cellpadding="1" cellspacing="1" align="center" bgcolor="#99CCCC" bordercolor="#000000">
<br />
<tr>
<td> <center><b>TYPE MESSAGE</b></center>
<asp:TextBox runat="server" ID="msg" TextMode="Multiline" Columns="20" Name="S1" Rows="2" CssClass="auto-style10" Height="200px" Width="755px"></asp:TextBox><br />
<center><asp:Button ID="Button1" runat="server" Text="SEND" OnClick="Button1_Click" CssClass="auto-style15" Height="26px" Width="83px"></asp:Button></center>
</td>
</tr>
</table><br /><br /><br />
<div class="auto-style25">
TH
<div id="dialog" style="display: none">
</div>
</div>
</div>
</form>
</html>