using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class AdminPanel_manageTuts : System.Web.UI.Page
{
Class_Tuts _objTutors = new Class_Tuts();
protected int _tutors;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
Drp_City.DataBind();
Drp_City.Items.Insert(0, "Select");
bindgrid();
txt_Subject.DataBind();
txt_Class.DataBind();
}
}
protected void btn_submit_Click(object sender, EventArgs e)
{
try
{
_objTutors.TutorID = Convert.ToInt32(lbl_blogId.Text);
_objTutors.TutorImagePath = "";
if (FileUpload1.HasFile)
{
string fileExt = System.IO.Path.GetExtension(FileUpload1.FileName);
if (fileExt == ".jpg" || fileExt == ".gif" || fileExt == ".png" || fileExt == ".jpeg")
{
_objTutors.TutorImagePath = "~/TutImages/" + _objTutors.TutorID + Class_Additionalresources.Getextention(FileUpload1.FileName);
FileUpload1.SaveAs(Server.MapPath(_objTutors.TutorImagePath));
}
else
{
lblMsg.Text = "Only jpg,gif and png file are allowed";
div_message.Visible = true;
img_right.Visible = false;
img_error.Visible = true;
lblMsg.ForeColor = System.Drawing.Color.Red;
Clear();
}
}
_objTutors.TutorName = txt_TutorName.Text.ToString();
_objTutors.City = Drp_City.SelectedItem.Text.ToString();
// _objTutors.Subject = txt_Subject.Text.ToString();
string _subject = "";
foreach (ListItem list in txt_Subject.Items)
{
if (list.Selected)
_subject += list.Text + ",";
}
if (_subject != "")
{
_subject = _subject.Substring(0, _subject.Length - 1);
_objTutors.Subject = txt_Subject.Text.ToString();
_objTutors.Subject = _subject;
}
else
{
_objTutors.Subject = _subject;
}
//_objTutors.Class = txt_Class.Text.ToString();
string _class = "";
foreach (ListItem list in txt_Class.Items)
{
if (list.Selected)
_class += list.Text + ",";
}
if (_class != "")
{
_class = _class.Substring(0, _class.Length - 1);
_objTutors.Class = _class;
}
else
{
_objTutors.Class = _class;
}
_objTutors.PhoneNo = txt_phoneNo.Text.ToString();
_objTutors.AlternatePhoneNo = txt_alternatephoneno.Text.ToString();
_objTutors.EmailID = txt_EmailID.Text.ToString();
_objTutors.Location = txt_Location.Text.ToString();
_objTutors.Description = txt_desc.Text.ToString();
_objTutors.UpdateTutorByID();
if (_objTutors.OperationStatus)
{
lblMsg.Text = "Tutor updated successfully.";
div_message.Visible = true;
img_right.Visible = true;
img_error.Visible = false;
lblMsg.ForeColor = System.Drawing.Color.Green;
}
else
{
lblMsg.Text = "Tutor not updated successfully.";
div_message.Visible = true;
img_right.Visible = false;
img_error.Visible = true;
lblMsg.ForeColor = System.Drawing.Color.Red;
Clear();
}
}
catch (Exception ex)
{
lblMsg.Text = "Error : " + ex;
div_message.Visible = true;
img_right.Visible = false;
img_error.Visible = true;
lblMsg.ForeColor = System.Drawing.Color.Red;
}
}
protected void btn_cancel_Click(object sender, EventArgs e)
{
Response.Redirect("~/AdminPanel/manageTutors.aspx");
}
private void Clear()
{
txt_TutorName.Text = "";
Drp_City.SelectedIndex = 0;
txt_Class.Text = "";
txt_Subject.Text = "";
txt_phoneNo.Text = "";
txt_EmailID.Text = "";
txt_Location.Text = "";
txt_desc.Text = "";
}
//Grid Section
private void bindgrid()
{
try
{
_objTutors.SearchText = txt_search.Text;
_objTutors.GetAllTutors();
if (_objTutors.OperationStatus)
{
DataTable dt = _objTutors.TutorTable;
grid_Tutor.DataSource = dt;
grid_Tutor.DataBind();
}
_objTutors.GetTutors();
if (_objTutors.OperationStatus)
{
_tutors = Convert.ToInt32(_objTutors.TutorTable.Rows.Count);
}
}
catch (Exception ex)
{
lblMsg.Text = "Error : " + ex.Message;
div_message.Visible = true;
img_error.Visible = true;
img_right.Visible = false;
lblMsg.ForeColor = System.Drawing.Color.Red;
}
}
protected void btn_search_Click(object sender, EventArgs e)
{
bindgrid();
}
// Get data on selected index
protected void grid_Tutor_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
lblMsg.Text = "";
Div_Image.Visible = false;
div_update.Visible = true;
div_message.Visible = false;
int rowindex = grid_Tutor.SelectedIndex;
GridViewRow gvr = grid_Tutor.Rows[rowindex];
HiddenField hdn_ID = (HiddenField)gvr.FindControl("hdn_TutorID");
_objTutors.TutorID = Convert.ToInt32(hdn_ID.Value);
_objTutors.GetTutorByID();
if (_objTutors.OperationStatus)
{
DataTable dt = _objTutors.TutorTable;
lbl_blogId.Text = dt.Rows[0]["TutorID"].ToString();
txt_TutorName.Text = dt.Rows[0]["TutorName"].ToString();
// Find by text in dropdown list and selected true
Drp_City.ClearSelection();
Drp_City.Items.FindByText(_objTutors.TutorTable.Rows[0]["City"].ToString()).Selected = true;
//txt_Class.Text = dt.Rows[0]["Class"].ToString();
//txt_Subject.Text = dt.Rows[0]["Subject"].ToString();
// Find subjects and set selected true in checkbox list.
string _subject = dt.Rows[0]["Subject"].ToString();
List<string> list = _subject.Split(',').ToList();
for (int i = 0; i < list.Count; i++)
{
for (int j = 0; j < txt_Subject.Items.Count; j++)
{
if (list[i] == txt_Subject.Items[j].ToString())
txt_Subject.Items[j].Selected = true;
}
}
// Find classes and set selected true in checkbox list.
string _class = dt.Rows[0]["Class"].ToString();
List<string> listclass = _class.Split(',').ToList();
for (int i = 0; i < listclass.Count; i++)
{
for (int j = 0; j < txt_Class.Items.Count; j++)
{
if (listclass[i] == txt_Class.Items[j].ToString())
txt_Class.Items[j].Selected = true;
}
}
txt_phoneNo.Text = dt.Rows[0]["PhoneNo"].ToString();
txt_alternatephoneno.Text = dt.Rows[0]["AlternatePhoneNo"].ToString();
txt_EmailID.Text = dt.Rows[0]["EmailID"].ToString();
txt_Location.Text = dt.Rows[0]["Location"].ToString();
txt_desc.Text = dt.Rows[0]["Description"].ToString();
}
else
{
// lbl_Gridmessage.Text = SubCategory.ErrorMessage;
}
}
catch (Exception ex)
{
lblMsg.Text = "Error : " + ex.Message;
div_message.Visible = true;
img_error.Visible = true;
img_right.Visible = false;
lblMsg.ForeColor = System.Drawing.Color.Red;
}
}
// Paging in gridview
protected void grid_Tutor_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
grid_Tutor.PageIndex = e.NewPageIndex;
bindgrid();
}
// Delete data in gridview
protected void grid_Tutor_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
try
{
int Delete_index = e.RowIndex;
GridViewRow gr = grid_Tutor.Rows[Delete_index];
string hdn = ((HiddenField)gr.FindControl("hdn_TutorID")).Value;
int _objTutorsID = Convert.ToInt32(hdn);
_objTutors.TutorID = _objTutorsID;
_objTutors.DeleteTutorByID();
if (_objTutors.OperationStatus)
{
lblMsg.Text = "Tutor Deleted Successfully.";
lblMsg.ForeColor = System.Drawing.Color.Green;
div_message.Visible = true;
img_right.Visible = true;
bindgrid();
}
else
{
div_message.Visible = true;
lblMsg.Text = _objTutors.ErrorMessage;
lblMsg.ForeColor = System.Drawing.Color.Red;
img_error.Visible = true;
img_right.Visible = false;
}
}
catch (Exception ex)
{
div_message.Visible = true;
lblMsg.Text = "Error : " + ex.Message;
lblMsg.ForeColor = System.Drawing.Color.Red;
img_error.Visible = true;
img_right.Visible = false;
}
}
// Delete confirmation alert message.
protected void grid_Tutor_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType != DataControlRowType.DataRow) return;
int lastCellIndex = e.Row.Cells.Count - 1;
ImageButton db = (ImageButton)e.Row.Cells[lastCellIndex].Controls[0];
db.OnClientClick = "if (!window.confirm('Are you sure you want to delete this record?')) return false;";
}
// Changing status of records on row command
protected void grid_Tutor_RowCommand(object sender, GridViewCommandEventArgs e)
{
try
{
if (e.CommandName == "Status")
{
ImageButton gv = (ImageButton)e.CommandSource;
GridViewRow gvr = (GridViewRow)gv.Parent.Parent;
HiddenField hdn_ID = (HiddenField)gvr.FindControl("hdn_TutorID");
int index = Convert.ToInt32(gvr.RowIndex);
int _tutorID = Convert.ToInt32(hdn_ID.Value);
Boolean status = Convert.ToBoolean(gv.ImageUrl == "images/green.png" ? true : false);
_objTutors.TutorID = _tutorID;
_objTutors.Status = !status;
_objTutors.UpdateTutorStatus();
bindgrid();
}
}
catch (Exception ex)
{
}
}
}
In design
<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
<script type="text/javascript">
$(function () {
$('#gallery a').lightBox();
});
function PopupCenter(pageURL, title, w, h) {
var left = (screen.width / 2) - (w / 2);
var top = (screen.height / 2) - (h / 2);
var targetWin = window.open(pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=' + w + ', height=' + h + ', top=' + top + ', left=' + left);
}
</script>
<style type="text/css">
#gallery {
padding: 10px;
width: 520px;
}
#gallery ul {
list-style: none;
}
#gallery ul li {
display: inline;
}
#gallery ul img {
border: 5px solid #3e3e3e;
border-width: 5px 5px 20px;
}
#gallery ul a:hover img {
border: 5px solid #fff;
border-width: 5px 5px 20px;
color: #fff;
}
#gallery ul a:hover {
color: #fff;
}
#gallery1 {
padding: 10px;
width: 520px;
}
#gallery1 ul {
list-style: none;
}
#gallery1 ul li {
display: inline;
}
#gallery1 ul img {
border: 5px solid #3e3e3e;
border-width: 5px 5px 20px;
}
#gallery1 ul a:hover img {
border: 5px solid #fff;
border-width: 5px 5px 20px;
color: #fff;
}
#gallery1 ul a:hover {
color: #fff;
}
</style>
// Validate Subject for atleast one selection
<script type="text/javascript">
function ValidateCheckBoxList(sender, args) {
var checkBoxList = document.getElementById("<%=txt_Subject.ClientID %>");
var checkboxes = checkBoxList.getElementsByTagName("input");
var isValid = false;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) {
isValid = true;
break;
}
}
args.IsValid = isValid;
}
// Validate Class for atleast one selection
function ValidateClassCheckBoxList(sender, args) {
var checkBoxList = document.getElementById("<%=txt_Class.ClientID %>");
var checkboxes = checkBoxList.getElementsByTagName("input");
var isValid = false;
for (var i = 0; i < checkboxes.length; i++) {
if (checkboxes[i].checked) {
isValid = true;
break;
}
}
args.IsValid = isValid;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div id="loading-header">
<div class="header-row">
<div class="span24">
<header>
<h1 class="header-main">Manage Tuts</h1>
</header>
<div style="padding: 7px 10px;">
<a href="addTuts.aspx" style="border: 1px solid; padding: 3px; text-decoration: none; color: #424A5D"> Add Tuts </a>
</div>
</div>
</div>
</div>
// Message section for success or error
<div style="margin-top: 30px; text-align: center; width: 100%;">
<div id="div_message" runat="server" visible="false" class="header-mainnew" style="height: 25px; width: 70%; text-align: left; padding: 0px 10px 10px 180px; margin-bottom: 10px; margin-top: 0px; vertical-align: text-top;">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td valign="middle" width="25px">
<asp:Image ID="img_right" ImageUrl="images/green.png" Height="30px" Width="30px"
runat="server" Visible="false" />
<asp:Image ID="img_error" ImageUrl="images/red.png" Height="30px" Width="30px" runat="server"
Visible="false" />
</td>
<td valign="middle"> <asp:Label ID="lblMsg" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
// Update Section
<div id="div_update" runat="server" visible="false" style="text-align: left;">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr id="Tr1" runat="server" visible="false">
<td style="width: 21%; text-align: left;" class="header-mainnew">ID <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<asp:Label ID="lbl_blogId" runat="server" class="header-mainnew"></asp:Label>
<br />
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">Name <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<asp:TextBox ID="txt_TutorName" runat="server" Width="250px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Required"
ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor" ControlToValidate="txt_TutorName"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">Tutor Image <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">City <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<asp:DropDownList ID="Drp_City" Width="255px" DataValueField="CityID" DataTextField="CityName"
DataSourceID="SqlDataSource1" runat="server">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SP_GetAllCity" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server" ErrorMessage="Required"
InitialValue="Select" ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor"
ControlToValidate="Drp_City"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">Class <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<%-- <asp:TextBox ID="txt_Class" runat="server" Width="250px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Required"
ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor" ControlToValidate="txt_Class"></asp:RequiredFieldValidator>--%>
<asp:CheckBoxList ID="txt_Class" runat="server" SelectionMode="Multiple" CssClass="RedesignFrom_Class033" placeholder="Subject" DataSourceID="SqlDataSource_TutorClass"
DataTextField="Class" DataValueField="Class" Height="56px" RepeatColumns="3">
</asp:CheckBoxList>
<asp:CustomValidator ID="CustomValidator2" ErrorMessage="Required" Display="Dynamic" ValidationGroup="Tutor"
ForeColor="Red" ClientValidationFunction="ValidateClassCheckBoxList" runat="server" Font-Size="Small" />
<asp:SqlDataSource ID="SqlDataSource_TutorClass" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SP_GetAllTutorClass" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
</td>
</tr>
<tr>
<td height="15px"></td>
</tr>
<tr>
<td style="width: 23%; text-align: left;" class="header-mainnew">Subject <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<%-- <asp:TextBox ID="txt_Subject" runat="server" Width="250px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="Required"
ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor" ControlToValidate="txt_Subject"></asp:RequiredFieldValidator>--%>
<asp:CheckBoxList ID="txt_Subject" runat="server" SelectionMode="Multiple" CssClass="RedesignFrom_Class033" placeholder="Subject" DataSourceID="SqlDataSource_GetAllSubjects"
DataTextField="Subject" DataValueField="Subject" Height="56px" RepeatColumns="3">
</asp:CheckBoxList>
<asp:CustomValidator ID="CustomValidator1" ErrorMessage="Required" Display="Dynamic" ValidationGroup="Tutor"
ForeColor="Red" ClientValidationFunction="ValidateCheckBoxList" runat="server" Font-Size="Small" />
<asp:SqlDataSource ID="SqlDataSource_GetAllSubjects" runat="server" ConnectionString="<%$ ConnectionStrings:connectionstring %>"
SelectCommand="SP_GetAllSubjects" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
<br />
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">Phone No
<br />
</td>
<td colspan="2" align="left">
<asp:TextBox ID="txt_phoneNo" runat="server" Width="250px"></asp:TextBox>
<br />
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 21%; text-align: left;" class="header-mainnew">Alternate Phone No
<br />
</td>
<td colspan="2" align="left">
<asp:TextBox ID="txt_alternatephoneno" runat="server" Width="250px"></asp:TextBox>
<br />
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 23%; text-align: left;" class="header-mainnew">Email ID <span style="color: Red;">*</span>
<br />
</td>
<td colspan="2" align="left">
<asp:TextBox ID="txt_EmailID" runat="server" Width="250px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="Required"
ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor" ControlToValidate="txt_EmailID"></asp:RequiredFieldValidator>
<br />
</td>
</tr>
<tr id="Tr22" runat="server">
<td height="5px" colspan="3">
</td>
</tr>
<tr id="Tr2" runat="server">
<td style="width: 30%; text-align: left;" class="header-mainnew">Location <%--<span style="color: Red;">*</span>--%>
</td>
<td colspan="2" align="left">
<asp:TextBox ID="txt_Location" runat="server" Width="250px"></asp:TextBox>
<%-- <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="Required"
ForeColor="Red" Display="Dynamic" ValidationGroup="Tutor" ControlToValidate="txt_Location"></asp:RequiredFieldValidator>--%>
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr id="Tr3" runat="server">
<td style="width: 30%; text-align: left;" class="header-mainnew">Description
</td>
<td colspan="2" align="left">
<FTB:FreeTextBox ID="txt_desc" runat="server" Width="340px" Height="200px">
</FTB:FreeTextBox>
</td>
</tr>
<tr>
<td height="5px" colspan="3">
</td>
</tr>
<tr>
<td style="width: 20%; text-align: left;" class="header-mainnew">
</td>
<td align="left">
<table cellspacing="0" cellpadding="0">
<tr>
<td style="width: 40%; text-align: left;">
<asp:Button ID="btn_submit" Width="100px" runat="server" Text="Update Tutor" ValidationGroup="Tutor"
OnClick="btn_submit_Click" />
</td>
<td></td>
<td style="width: 40%; text-align: left;">
<asp:Button ID="btn_cancel" runat="server" Text="Cancel" Width="90px" OnClick="btn_cancel_Click" />
</td>
</tr>
</table>
</td>
<td style="width: 40%; text-align: left; border: hidden;">
</td>
</tr>
</table>
</div>
// Gridview Section
<div id="Div_Image" runat="server" style="text-align: left; width: 100%; padding-left: 50px;">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td height="40px" style="padding-top: 5px; font-size: 15px; padding-left: 50px;">Total Tutors<span style="height: 40px; color: #000000;">(<%=grid_Tutor.Rows.Count%>)</span>
</td>
<td>
<asp:TextBox ID="txt_search" align="left" placeholder="Search By Tutors Name" Height="20px"
runat="server" Width="300px"></asp:TextBox>
<asp:Button ID="btn_search" runat="server" Text="Search" OnClick="btn_search_Click"></asp:Button>
</td>
</tr>
<tr>
<td height="4px"></td>
</tr>
<tr>
<td colspan="2" height="10px" align="left">
// Gridview
<asp:GridView ID="grid_Tutor" runat="server" Width="80%" AutoGenerateColumns="False"
DataKeyNames="TutorID" CellPadding="3" ForeColor="#333333" GridLines="None" AllowPaging="true" PageSize="30" OnPageIndexChanging="grid_Tutor_PageIndexChanging" OnRowDataBound="grid_Tutor_RowDataBound" OnRowDeleting = "grid_Tutor_RowDeleting" OnSelectedIndexChanged="grid_Tutor_SelectedIndexChanged" OnRowCommand = "grid_Tutor_RowCommand">
<RowStyle BackColor="#ffffff" HorizontalAlign="Center" />
<AlternatingRowStyle BackColor="#ffffff" HorizontalAlign="Center" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
Sr. No.
</HeaderTemplate>
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
<asp:HiddenField ID="hdn_TutorID" runat="server" Value='<%# Eval("TutorID") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tutor Image">
<ItemTemplate>
<asp:Image ID="TutorImage" runat="server" Width="100px" ImageUrl = '<%#Eval("TutorImagePath") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="TutorName" HeaderText="Tutor Name" SortExpression="TutorName"
HeaderStyle-ForeColor="White" />
<asp:BoundField DataField="EmailID" HeaderText="Email ID" SortExpression="EmailID" HeaderStyle-ForeColor="White" />
<asp:BoundField DataField="Class" HeaderText="Class" SortExpression="Class" HeaderStyle-ForeColor="White" />
<%--<asp:BoundField DataField="Subject" HeaderText="Subject" SortExpression="Subject" />--%>
<asp:TemplateField ShowHeader="True" HeaderText="Subject" HeaderStyle-ForeColor="White">
<ItemTemplate>
<%# Convert.ToString(Eval("Subject")).Replace(",", ", ") %>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" HeaderStyle-ForeColor="White" />
<asp:TemplateField ShowHeader="True" HeaderText="Status" HeaderStyle-ForeColor="White">
<ItemTemplate>
<asp:ImageButton ID="status" runat="server" CommandName="Status" ImageUrl='<%# Convert.ToBoolean(Eval("status"))?"images/green.png":"images/red.png" %>'
Height="15px" Width="15px"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ButtonType="Image" HeaderText="Manage" ShowSelectButton="True"
HeaderStyle-Font-Size="Small" SelectImageUrl="images/edit.png" />
<asp:CommandField ButtonType="Image" HeaderText="Delete" ControlStyle-Width="16px"
ControlStyle-Height="16px" DeleteImageUrl="images/delete.png" ShowDeleteButton="True" />
</Columns>
<EmptyDataTemplate>
Sorry, no data found as your search criteria.
</EmptyDataTemplate>
<EmptyDataRowStyle CssClass="header-mainnew2" HorizontalAlign="Left" ForeColor="Red"
VerticalAlign="Middle" />
<FooterStyle BackColor="#424A5D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#424A5D" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#424A5D" Font-Bold="True" ForeColor="white" HorizontalAlign="Center" />
<EditRowStyle BackColor="#2461BF" />
</asp:GridView>
</td>
</tr>
</table>
</div>
</div>
</asp:Content>