aspx. page :
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<meta name="viewport" content="width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no" />
<link href="Styles/footable.min.css" rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=GridView1]').footable();
$('[id*=GridView1] tr :last').closest('table').closest('tr').find('td').show();
$(window).resize(function () {
});
$('[id*=GridView1] tr :last').closest('table').closest('tr').on('click', function () {
$(this).next('tr').hide();
});
});
</script>
</asp:Content>
<div id ="container">
<asp:UpdatePanel runat="server" id="UpdatePanel1" updatemode="Conditional">
<ContentTemplate>
<div id="MainSchedule" style ="width: initial;font-size: 14px; font-family: 'Lato', sans-serif; font-weight: 400;padding-bottom:10%;margin:1% auto;">
<div class="row">
<div class="container">
<div id="Filter" class="box1" style ="height:auto;padding-bottom:6%;">
<div id="FilterDropDown" style ="margin: 40px auto; padding-left: 5px;">
<div class="col-md-3" style="width:22%;">
<asp:DropDownList ID="DropDownListCategory" runat="server" CssClass="dropFilter" AutoPostBack = "true" style="background-color: #fff;color: brown;border-color: #C8C9CB;height: 30px;width: 220px;padding-left: 5px;margin-bottom:5px;">
</asp:DropDownList>
</div>
<div class="col-md-3" style="width:22%;">
<asp:DropDownList ID="DropDownListCity" runat="server" CssClass="dropFilter" AutoPostBack = "true" style="background-color: #fff;color: brown;border-color: #C8C9CB;height: 30px;width: 220px;padding-left: 5px;margin-bottom:5px;" >
</asp:DropDownList>
</div>
<div class="col-md-3" style="width:22%;">
<asp:DropDownList ID="DropDownListField" runat="server" CssClass="dropFilter" AutoPostBack = "true" style="background-color: #fff;color: brown;border-color: #C8C9CB;height: 30px;width: 220px;padding-left: 5px;margin-bottom:5px;">
</asp:DropDownList>
</div>
<div class="col-md-3" style="width:22%;">
<asp:DropDownList ID="DropDownListMonths" runat="server" CssClass="dropFilter" AutoPostBack = "true" style="background-color: #fff;color: brown;border-color: #C8C9CB;height: 30px;width: 220px;padding-left: 5px;margin-bottom:15px;">
</asp:DropDownList>
</div>
<div class="col-md-3" style="width:10%;">
<div style="float: left;margin: 0px 0px 30px 10px;">
<asp:Button ID="btnGo" UseSubmitBehavior="false" runat="server" Text="Find" AutoPostBack = "true" class="btn btn-danger" Width ="75px" Height ="32px" ></asp:Button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="container">
<div style="text-align: center;margin-bottom: 10px;font-size: 20px;color: brown;"><asp:Label ID="lblmsg" runat ="server" ></asp:Label></div>
<div class="row">
<asp:GridView ID="GridView1" runat="server" GridLines="None" AutoGenerateColumns="false" OnSelectedIndexChanged = "OnSelectedIndexChanged" AllowPaging="true"
PageSize="8" CssClass="footable" OnPageIndexChanging = "OnPageIndexChanging" Style="width: 100%;text-align:center; direction: ltr;">
<Columns>
<asp:TemplateField HeaderText="Course Title" ItemStyle-Width="260" >
<ItemTemplate>
<div data-class="expand" style="float:left; padding-left: 10px;">
<asp:Label ID="CourseLogo" runat="server" Text='<%# Eval("CourseLogo")%>'></asp:Label>
<asp:Label ID="lblEnglishName" runat="server" Text='<%# Eval("EnglishName")%>' style="margin-top: 15px; float:left;"></asp:Label>
</div>
</ItemTemplate>
<ItemStyle Width="260px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="City-Country" ItemStyle-Width="150">
<ItemTemplate>
<asp:Label ID="lblCountry" data-class="hide" runat="server" Text='<%# Eval("CityCountry")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="150px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Start Course" ItemStyle-Width="180">
<ItemTemplate>
<asp:Label ID="lblStartCours" data-class="hide" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "StartCourse", "{0:MMM dd, yyyy}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="180px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="End Course" ItemStyle-Width="180">
<ItemTemplate>
<asp:Label ID="lblEndCourse" runat="server" data-class="hide" Text='<%# DataBinder.Eval(Container.DataItem, "EndCourse" , "{0:MMM dd, yyyy}")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="180px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Days" ItemStyle-Width="50">
<ItemTemplate>
<asp:Label ID="lblDays" runat="server" data-class="hide" Text='<%# Eval("Days")%>'></asp:Label>
</ItemTemplate>
<ItemStyle Width="50px" />
</asp:TemplateField>
<asp:ButtonField HeaderText="Register" Text="Select" ItemStyle-Width="100" CommandName="Select" >
<ItemStyle Width="100px" />
</asp:ButtonField>
</Columns>
<PagerSettings FirstPageText="First Page" LastPageText="Last Page" />
<PagerStyle Wrap="true" CssClass = "pagination-ys" />
</asp:GridView>
<asp:LinkButton Text="" ID="lnkFake" runat="server" />
<cc1:ModalPopupExtender ID="mpe" runat="server" PopupControlID="pnlPopup" TargetControlID="lnkFake"
CancelControlID="btnClose" BackgroundCssClass="modalBackground" >
</cc1:ModalPopupExtender>
<asp:Panel ID="pnlPopup" runat="server" Class="modalPopup" Style="display: none">
<div class="footer" align="right" style="float: right;">
<asp:Button ID="btnClose" runat="server" UseSubmitBehavior="false" Text="x" Style="margin: 2px;
font-size: 22px; color: white; background: none; border: none; border-color: none;
border-radius: 0px;" />
</div>
<div class="login">
<div class="login-header">
<p style="font-size: 30px; font-family: 'Lato', sans-serif; display: block; border-bottom: 1px solid rgba(255, 255, 255, 0.3);
margin: 0 0 0.1em 0; padding-bottom: 20px;">
CONTACT US
</p>
<p style="font-family: 'Lato', sans-serif; font-size: 1.25em; margin: 1em 0 0.4em 0;">
Fill out the form below to complete register!</p>
</div>
<div class="login-form">
<p class="left">
<asp:Label ID="Label1" runat="server" Text="Full Name" CssClass="login-label"></asp:Label>
<asp:TextBox ID="TextBoxName" runat="server" placeholder="Your Name" class="input"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="Register"
runat="server" ErrorMessage="*" ControlToValidate="TextBoxName"></asp:RequiredFieldValidator>
</p>
<p style="float: right;">
<asp:Label ID="Label2" runat="server" Text="Email" CssClass="login-label"></asp:Label>
<asp:TextBox ID="TextBoxEmail" runat="server" placeholder="Example@gmail.com" class="input"></asp:TextBox>
<asp:RegularExpressionValidator ID="valRegEx" ValidationGroup="Register" runat="server"
ControlToValidate="TextBoxEmail" ValidationExpression=".*@.*\..*" ErrorMessage="*Invalid Email address."
Display="dynamic">
</asp:RegularExpressionValidator>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ValidationGroup="Register"
ErrorMessage="*" ControlToValidate="TextBoxEmail"></asp:RequiredFieldValidator>
</p>
<p class="left">
<asp:Label ID="Label3" runat="server" Text="Country" CssClass="login-label"></asp:Label>
<asp:TextBox ID="TextBoxCityName" runat="server" placeholder="Your Country" class="input"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" ValidationGroup="Register"
runat="server" ErrorMessage="*" ControlToValidate="TextBoxCityName"></asp:RequiredFieldValidator>
</p>
<p style="float: right;">
<asp:Label ID="Label4" runat="server" Text="Phone Number" CssClass="login-label"></asp:Label>
<asp:TextBox ID="TextBoxPhone" runat="server" placeholder="Your Phone" class="input"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" ValidationGroup="Register"
runat="server" ErrorMessage="*" ControlToValidate="TextBoxPhone" ValidateEmptyText="true"
ValidationExpression="^([0-9\(\)\/\+ \-]*)$"></asp:RequiredFieldValidator>
</p>
<p class="left">
<asp:Label ID="Label5" runat="server" Text="Comment" CssClass="login-label"></asp:Label>
<asp:TextBox ID="TextBoxComment" runat="server" placeholder="Nots" TextMode="MultiLine"
Rows="4" class="login-textarea"></asp:TextBox><br />
</p>
<p>
<asp:Button ID="Button1" UseSubmitBehavior="false" ValidationGroup="Register" runat="server"
Text="Register" CommandName="Select" class="btn btn-primary" OnClick="SendEmail"
Style="cursor: pointer; border-radius: 5px; box-shadow: none; margin-left: auto;
margin-right: auto; display: inline-block; vertical-align: top;" />
</p>
</div>
</div>
</asp:Panel>
</div>
</div>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnGo" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="DropDownListCity" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDownListCategory" EventName="TextChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDownListField" EventName="SelectedIndexChanged" />
<asp:AsyncPostBackTrigger ControlID="DropDownListMonths" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</div>
VB Code :
Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.ComponentModel
Imports System.Web.Services.Description
Imports System.Net.Mail
Imports System.Collections
Imports System.Drawing
Imports System.IO
Imports System.Web
Imports System.Web.SessionState
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.HtmlControls
Imports System.Net.Mail.MailMessage
Partial Class Training_Schedule
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Me.IsPostBack Then
PopulateCategory()
PopulateCity()
PopulateField()
PopulateMonths()
getdata()
'Attribute to show the Plus Minus Button.
GridView1.HeaderRow.Cells(0).Attributes("data-class") = "expand"
'Attribute to hide column in Phone.
GridView1.HeaderRow.Cells(1).Attributes("data-hide") = "phone"
GridView1.HeaderRow.Cells(2).Attributes("data-hide") = "phone"
GridView1.HeaderRow.Cells(3).Attributes("data-hide") = "phone"
GridView1.HeaderRow.Cells(4).Attributes("data-hide") = "phone"
GridView1.HeaderRow.Cells(5).Attributes("data-hide") = "phone"
'Adds THEAD and TBODY to GridView.
GridView1.HeaderRow.TableSection = TableRowSection.TableHeader
End If
End Sub
Protected Sub Page_LoadComplete(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadComplete
Response.AppendHeader("Refresh", "5000; URL=ur URL")
End Sub
Public Sub getdata()
Dim objCourseFilter As New ScheduleNewDB
objCourseFilter.CategoryIDPro = DropDownListCategory.SelectedValue
objCourseFilter.CityIDPro = DropDownListCity.SelectedValue
objCourseFilter.FieldIDPro = DropDownListField.SelectedValue
objCourseFilter.MonthsIDPro = DropDownListMonths.SelectedValue
Dim dt As DataTable = objCourseFilter.FindCourse()
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
Public Sub PopulateCategory()
If Not IsPostBack Then
Dim ObjC As New Category
Dim dt As DataTable = ObjC.Find()
Dim dr As DataRow = dt.NewRow()
dr("CategoryID") = 0
dr("CategoryName") = "--- All Courses ---"
dt.Rows.InsertAt(dr, 0)
DropDownListCategory.DataSource = dt
DropDownListCategory.DataTextField = "CategoryName"
DropDownListCategory.DataValueField = "CategoryID"
DropDownListCategory.DataBind()
End If
End Sub
Public Sub PopulateCity()
If Not IsPostBack Then
Dim ObjC As New City
Dim dt As DataTable = ObjC.FindCityCountry()
Dim dr As DataRow = dt.NewRow()
dr("CityID") = 0
dr("CityCountry") = "--- All Cities ---"
dt.Rows.InsertAt(dr, 0)
'DropDownListCity.SelectedValue = Session("more")
DropDownListCity.DataSource = dt
DropDownListCity.DataTextField = "CityCountry"
DropDownListCity.DataValueField = "CityID"
DropDownListCity.DataBind()
End If
End Sub
Public Sub PopulateField()
If Not IsPostBack Then
Dim ObjC As New Field
Dim dt As DataTable = ObjC.Find()
Dim dr As DataRow = dt.NewRow()
dr("FieldID") = 0
dr("FieldName") = "--- All Centers ---"
dt.Rows.InsertAt(dr, 0)
DropDownListField.DataSource = dt
DropDownListField.DataTextField = "FieldName"
DropDownListField.DataValueField = "FieldID"
DropDownListField.DataBind()
End If
End Sub
Public Sub PopulateMonths()
If Not IsPostBack Then
Dim ObjC As New MonthsDB
Dim dt As DataTable = ObjC.FindMonth()
Dim dr As DataRow = dt.NewRow()
dr("MonthsID") = 0
dr("MonthsName") = "--- All Months ---"
dt.Rows.InsertAt(dr, 0)
DropDownListMonths.DataSource = dt
DropDownListMonths.DataTextField = "MonthsName"
DropDownListMonths.DataValueField = "MonthsID"
DropDownListMonths.DataBind()
End If
End Sub
Protected Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
getdata()
End Sub
Protected Sub OnSelectedIndexChanged(sender As Object, e As EventArgs) Handles GridView1.SelectedIndexChanged
mpe.Show()
End Sub
Protected Sub SendEmail(sender As Object, e As EventArgs)
Dim EnglishName As String = TryCast(GridView1.SelectedRow.FindControl("lblEnglishName"), Label).Text
Dim StartCours As String = TryCast(GridView1.SelectedRow.FindControl("lblStartCours"), Label).Text
Dim EndCourse As String = TryCast(GridView1.SelectedRow.FindControl("lblEndCourse"), Label).Text
Dim Days As String = TryCast(GridView1.SelectedRow.FindControl("lblDays"), Label).Text
Dim CityCountry As String = TryCast(GridView1.SelectedRow.FindControl("lblCountry"), Label).Text
Dim TextName As String = TextBoxName.Text
Dim TextEmail As String = TextBoxEmail.Text
Dim TextComment As String = TextBoxComment.Text
Dim TextCityName As String = TextBoxCityName.Text
Dim TextPhone As String = TextBoxPhone.Text
mpe.Hide()
Dim body As String = "Name :" + TextName + "<br>" + "Email :" + TextEmail + "<br/>" + "Msg :" + TextComment + "<br/>" + "Course :" + EnglishName + "<br>" + "Course Date :" + StartCours + "<br>" + "Country :" + TextCityName + "<br>" + "Phone :" + TextPhone + "<br>"
Dim mail As New MailMessage()
mail.[To].Add("...@gmail.com")
mail.Bcc.Add("...@gmail.com")
mail.From = New MailAddress("...@gmail.com")
mail.Subject = "New Register Member ...." + EnglishName
mail.Body = body
mail.IsBodyHtml = True
Dim smtp As New SmtpClient("relay-hosting.secureserver.net")
smtp.EnableSsl = False
smtp.UseDefaultCredentials = True
smtp.Send(mail)
lblmsg.Text = "registration successful"
End Sub
Protected Sub OnPageIndexChanging(sender As Object, e As GridViewPageEventArgs)
GridView1.PageIndex = e.NewPageIndex
getdata()
End Sub
End Class