is there any way to make the pageload or pagepostback to refresh and come back to the specific part of the page instead of refresh and come back from the top
in my case, when i add a new row to the table then i want the page come back to the specific area, instead of refresh and started it from the top again
sorry if my descriptio is not clear enough,, any help will be appreciated
mkpkform.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mkpkform.aspx.cs" Inherits="moe.mkpkform" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 123%;
height: 25px;
}
.auto-style2 {
width: 30px;
}
.auto-style3 {
width: 81px;
}
.auto-style4 {
width: 208px;
}
.auto-style5 {
width: 86px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label15" runat="server" style="text-align: left" Text="PERMOHONAN PENGIKTIRAFAN"></asp:Label>
<br />
<br />
<table class="auto-style1">
<tr>
<td class="auto-style2">1.</td>
<td class="auto-style3">
<asp:Label ID="Label1" runat="server" Text="TITLE: "></asp:Label>
</td>
<td class="auto-style5">
</td>
<td class="auto-style4">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Value="Awang">AWANG</asp:ListItem>
<asp:ListItem>AWANGKU</asp:ListItem>
<asp:ListItem>DAYANG</asp:ListItem>
<asp:ListItem>DAYANGKU</asp:ListItem>
<asp:ListItem Value="PENGIRAN"></asp:ListItem>
<asp:ListItem>PEHIN</asp:ListItem>
<asp:ListItem>DATO</asp:ListItem>
<asp:ListItem>DATIN</asp:ListItem>
</asp:DropDownList>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">2.</td>
<td class="auto-style3">
<asp:Label ID="Label2" runat="server" Text="NAME: "></asp:Label>
</td>
<td class="auto-style5">
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox1" runat="server" Width="300px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">3.</td>
<td class="auto-style3">
<asp:Label ID="Label3" runat="server" Text="I/C: "></asp:Label>
</td>
<td class="auto-style5">
NUMBER:</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox2" runat="server" MaxLength="9"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label4" runat="server" Text="COLOR: "></asp:Label>
</td>
<td class="auto-style4">
<asp:DropDownList ID="DropDownList2" runat="server">
<asp:ListItem>YELLOW</asp:ListItem>
<asp:ListItem>GREEN</asp:ListItem>
<asp:ListItem>RED</asp:ListItem>
</asp:DropDownList>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td class="auto-style5">
UPLOAD IC SCAN:</td>
<td class="auto-style4">
<asp:FileUpload ID="FileUpload1" runat="server" />
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">4.</td>
<td class="auto-style3">
<asp:Label ID="Label14" runat="server" Text="RELIGION: "></asp:Label>
</td>
<td class="auto-style5">
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox11" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">5.</td>
<td class="auto-style3">
<asp:Label ID="Label5" runat="server" Text="ADDRESS: "></asp:Label>
</td>
<td class="auto-style5">
NO</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox3" runat="server" Width="25px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
LOT</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox16" runat="server" Width="25px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label7" runat="server" Text="SPG"></asp:Label>
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox12" runat="server" Width="71px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label8" runat="server" Text="JALAN"></asp:Label>
</td>
<td class="auto-style4"><asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label9" runat="server" Text="KG"></asp:Label>
</td>
<td class="auto-style4"><asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label10" runat="server" Text="DAERAH"></asp:Label>
</td>
<td class="auto-style4"><asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
<asp:Label ID="Label11" runat="server" Text="POSTCODE"></asp:Label>
</td>
<td class="auto-style4"><asp:TextBox ID="TextBox8" runat="server" MaxLength="6"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td class="auto-style5"> </td>
<td class="auto-style4">BRUNEI DARUSSALAM</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">6.</td>
<td class="auto-style3">
<asp:Label ID="Label12" runat="server" Text="TEL NO."></asp:Label>
</td>
<td class="auto-style5">
MOBILE:</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td class="auto-style5">
HOME:</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox13" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td class="auto-style5">
OFFICE:</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox14" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3"> </td>
<td class="auto-style5">
EMERGENCY:</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox15" runat="server"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2">7.</td>
<td class="auto-style3">
<asp:Label ID="Label13" runat="server" Text="EMAIL: "></asp:Label>
</td>
<td class="auto-style5">
</td>
<td class="auto-style4">
<asp:TextBox ID="TextBox10" runat="server" Width="216px"></asp:TextBox>
</td>
<td> </td>
</tr>
<tr>
<td class="auto-style2"> </td>
<td class="auto-style3">
</td>
<td class="auto-style5">
</td>
<td class="auto-style4">
</td>
<td> </td>
</tr>
</table>
<br />
<br />
<br />
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Submit" />
</div>
<div>
<asp:Label ID="Label6" runat="server" style="text-align: left" Text="BUTIR MAKLUMAT PENDIDIKAN"></asp:Label>
<br />
<br />
<table>
<tr>
<td>1.</td>
<td>GCE O LEVEL</td>
</tr>
<tr>
<td></td>
<td>
<asp:gridview ID="Gridview1" runat="server" ShowFooter="true" AutoGenerateColumns="false" OnSelectedIndexChanged="Gridview1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="RowNumber" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Year">
<ItemTemplate>
<asp:DropDownList ID="TextBox1" runat="server">
<asp:ListItem>May/June 2010</asp:ListItem>
<asp:ListItem>August/September 2010</asp:ListItem>
<asp:ListItem>May/June 2011</asp:ListItem>
<asp:ListItem>August/September 2011</asp:ListItem>
<asp:ListItem>May/June 2012</asp:ListItem>
<asp:ListItem>August/September 2012</asp:ListItem>
<asp:ListItem>May/June 2013</asp:ListItem>
<asp:ListItem>August/September 2013</asp:ListItem>
<asp:ListItem>May/June 2014</asp:ListItem>
<asp:ListItem>August/September 2014</asp:ListItem>
<asp:ListItem>May/June 2015</asp:ListItem>
<asp:ListItem>August/September 2015</asp:ListItem>
<asp:ListItem>May/June 2016</asp:ListItem>
<asp:ListItem>August/September 2016</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Subject">
<ItemTemplate>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Grade">
<ItemTemplate>
<asp:DropDownList ID="TextBox3" runat="server">
<asp:ListItem>A1</asp:ListItem>
<asp:ListItem>A2</asp:ListItem>
<asp:ListItem>B3</asp:ListItem>
<asp:ListItem>C5</asp:ListItem>
<asp:ListItem>D7</asp:ListItem>
<asp:ListItem>D8</asp:ListItem>
<asp:ListItem>E9</asp:ListItem>
<asp:ListItem>F</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd" runat="server" Text="Add New Row" OnClick="Gridview1_SelectedIndexChanged"/>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
<tr>
<td>2.</td>
<td>GCE A LEVEL</td>
</tr>
<tr>
<td></td>
<td>
<asp:gridview ID="Gridview2" runat="server" ShowFooter="true" AutoGenerateColumns="false" OnSelectedIndexChanged="Gridview1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="RowNumber2" HeaderText="Row Number" />
<asp:TemplateField HeaderText="Year">
<ItemTemplate>
<asp:DropDownList ID="TextBox4" runat="server">
<asp:ListItem>May/June 2010</asp:ListItem>
<asp:ListItem>August/September 2010</asp:ListItem>
<asp:ListItem>May/June 2011</asp:ListItem>
<asp:ListItem>August/September 2011</asp:ListItem>
<asp:ListItem>May/June 2012</asp:ListItem>
<asp:ListItem>August/September 2012</asp:ListItem>
<asp:ListItem>May/June 2013</asp:ListItem>
<asp:ListItem>August/September 2013</asp:ListItem>
<asp:ListItem>May/June 2014</asp:ListItem>
<asp:ListItem>August/September 2014</asp:ListItem>
<asp:ListItem>May/June 2015</asp:ListItem>
<asp:ListItem>August/September 2015</asp:ListItem>
<asp:ListItem>May/June 2016</asp:ListItem>
<asp:ListItem>August/September 2016</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Subject">
<ItemTemplate>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Grade">
<ItemTemplate>
<asp:DropDownList ID="TextBox6" runat="server">
<asp:ListItem>A1</asp:ListItem>
<asp:ListItem>A2</asp:ListItem>
<asp:ListItem>B3</asp:ListItem>
<asp:ListItem>C5</asp:ListItem>
<asp:ListItem>D7</asp:ListItem>
<asp:ListItem>D8</asp:ListItem>
<asp:ListItem>E9</asp:ListItem>
<asp:ListItem>F</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd2" runat="server" Text="Add New Row" OnClick="ButtonAdd2_Click"/>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
<tr>
<td>3.</td>
<td>LAIN LAIN KEPUTUSAN</td>
</tr>
<tr>
<td></td>
<td>
<asp:gridview ID="Gridview3" runat="server" ShowFooter="true" AutoGenerateColumns="false" OnSelectedIndexChanged="Gridview1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="RowNumber3" HeaderText="Row Number" />
<asp:TemplateField HeaderText="KELULUSAN">
<ItemTemplate>
<asp:DropDownList ID="TextBox7" runat="server">
<asp:ListItem>HND</asp:ListItem>
<asp:ListItem>DEGREE</asp:ListItem>
<asp:ListItem>MASTER</asp:ListItem>
<asp:ListItem>PHD</asp:ListItem>
<asp:ListItem>OTHERS</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Nama">
<ItemTemplate>
<asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
</ItemTemplate>
<FooterStyle HorizontalAlign="Right" />
<FooterTemplate>
<asp:Button ID="ButtonAdd3" runat="server" Text="Add New Row" OnClick="ButtonAdd3_Click"/>
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:gridview>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
mkpkform.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
//using MySql.Data.MySqlClient;
using System.Net.Mail;
using System.Net.NetworkInformation;
using System.Data;
namespace moe
{
public partial class mkpkform : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
SetInitialRow();
SetInitialRow2();
SetInitialRow3();
}
}
private void SetInitialRow()
{
DataTable dt = new DataTable();
DataRow dr = null;
dt.Columns.Add(new DataColumn("RowNumber", typeof(string)));
dt.Columns.Add(new DataColumn("Column1", typeof(string)));
dt.Columns.Add(new DataColumn("Column2", typeof(string)));
dt.Columns.Add(new DataColumn("Column3", typeof(string)));
dr = dt.NewRow();
dr["RowNumber"] = 1;
dr["Column1"] = string.Empty;
dr["Column2"] = string.Empty;
dr["Column3"] = string.Empty;
dt.Rows.Add(dr);
//dr = dt.NewRow();
//Store the DataTable in ViewState
ViewState["CurrentTable"] = dt;
Gridview1.DataSource = dt;
Gridview1.DataBind();
}
private void AddNewRowToGrid()
{
int rowIndex = 0;
if (ViewState["CurrentTable"] != null)
{
DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable"];
DataRow drCurrentRow = null;
if (dtCurrentTable.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
{
//extract the TextBox values
DropDownList box1 = (DropDownList)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");
TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2");
DropDownList box3 = (DropDownList)Gridview1.Rows[rowIndex].Cells[3].FindControl("TextBox3");
drCurrentRow = dtCurrentTable.NewRow();
drCurrentRow["RowNumber"] = i + 1;
dtCurrentTable.Rows[i - 1]["Column1"] = box1.Text;
dtCurrentTable.Rows[i - 1]["Column2"] = box2.Text;
dtCurrentTable.Rows[i - 1]["Column3"] = box3.Text;
rowIndex++;
}
dtCurrentTable.Rows.Add(drCurrentRow);
ViewState["CurrentTable"] = dtCurrentTable;
Gridview1.DataSource = dtCurrentTable;
Gridview1.DataBind();
}
}
else
{
Response.Write("ViewState is null");
}
//Set Previous Data on Postbacks
SetPreviousData();
}
private void SetPreviousData()
{
int rowIndex = 0;
if (ViewState["CurrentTable"] != null)
{
DataTable dt = (DataTable)ViewState["CurrentTable"];
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
DropDownList box1 = (DropDownList)Gridview1.Rows[rowIndex].Cells[1].FindControl("TextBox1");
TextBox box2 = (TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox2");
DropDownList box3 = (DropDownList)Gridview1.Rows[rowIndex].Cells[3].FindControl("TextBox3");
box1.Text = dt.Rows[i]["Column1"].ToString();
box2.Text = dt.Rows[i]["Column2"].ToString();
box3.Text = dt.Rows[i]["Column3"].ToString();
rowIndex++;
}
}
}
}
protected void Gridview1_SelectedIndexChanged(object sender, EventArgs e)
{
/* if(btn_ID == ButtonAdd)
{ */
AddNewRowToGrid();
/* }
if(btn_ID == ButtonAdd2)
{
AddNewRowToGrid2();
} */
}
private void SetInitialRow2()
{
DataTable dt2 = new DataTable();
DataRow dr2 = null;
dt2.Columns.Add(new DataColumn("RowNumber2", typeof(string)));
dt2.Columns.Add(new DataColumn("Column4", typeof(string)));
dt2.Columns.Add(new DataColumn("Column5", typeof(string)));
dt2.Columns.Add(new DataColumn("Column6", typeof(string)));
dr2 = dt2.NewRow();
dr2["RowNumber2"] = 1;
dr2["Column4"] = string.Empty;
dr2["Column5"] = string.Empty;
dr2["Column6"] = string.Empty;
dt2.Rows.Add(dr2);
//dr = dt.NewRow();
//Store the DataTable in ViewState
ViewState["CurrentTable2"] = dt2;
Gridview2.DataSource = dt2;
Gridview2.DataBind();
}
private void AddNewRowToGrid2()
{
int rowIndex = 0;
if (ViewState["CurrentTable2"] != null)
{
DataTable dtCurrentTable2 = (DataTable)ViewState["CurrentTable2"];
DataRow drCurrentRow2 = null;
if (dtCurrentTable2.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable2.Rows.Count; i++)
{
//extract the TextBox values
DropDownList box4 = (DropDownList)Gridview2.Rows[rowIndex].Cells[1].FindControl("TextBox4");
TextBox box5 = (TextBox)Gridview2.Rows[rowIndex].Cells[2].FindControl("TextBox5");
DropDownList box6 = (DropDownList)Gridview2.Rows[rowIndex].Cells[3].FindControl("TextBox6");
drCurrentRow2 = dtCurrentTable2.NewRow();
drCurrentRow2["RowNumber2"] = i + 1;
dtCurrentTable2.Rows[i - 1]["Column4"] = box4.Text;
dtCurrentTable2.Rows[i - 1]["Column5"] = box5.Text;
dtCurrentTable2.Rows[i - 1]["Column6"] = box6.Text;
rowIndex++;
}
dtCurrentTable2.Rows.Add(drCurrentRow2);
ViewState["CurrentTable2"] = dtCurrentTable2;
Gridview2.DataSource = dtCurrentTable2;
Gridview2.DataBind();
}
}
else
{
Response.Write("ViewState is null");
}
//Set Previous Data on Postbacks
SetPreviousData2();
}
private void SetPreviousData2()
{
int rowIndex = 0;
if (ViewState["CurrentTable2"] != null)
{
DataTable dt2 = (DataTable)ViewState["CurrentTable2"];
if (dt2.Rows.Count > 0)
{
for (int i = 0; i < dt2.Rows.Count; i++)
{
DropDownList box4 = (DropDownList)Gridview2.Rows[rowIndex].Cells[1].FindControl("TextBox4");
TextBox box5 = (TextBox)Gridview2.Rows[rowIndex].Cells[2].FindControl("TextBox5");
DropDownList box6 = (DropDownList)Gridview2.Rows[rowIndex].Cells[3].FindControl("TextBox6");
box4.Text = dt2.Rows[i]["Column4"].ToString();
box5.Text = dt2.Rows[i]["Column5"].ToString();
box6.Text = dt2.Rows[i]["Column6"].ToString();
rowIndex++;
}
}
}
}
protected void ButtonAdd2_Click(object sender, EventArgs e)
{
AddNewRowToGrid2();
}
private void SetInitialRow3()
{
DataTable dt3 = new DataTable();
DataRow dr3 = null;
dt3.Columns.Add(new DataColumn("RowNumber3", typeof(string)));
dt3.Columns.Add(new DataColumn("Column7", typeof(string)));
dt3.Columns.Add(new DataColumn("Column8", typeof(string)));
dr3 = dt3.NewRow();
dr3["RowNumber3"] = 1;
dr3["Column7"] = string.Empty;
dr3["Column8"] = string.Empty;
dt3.Rows.Add(dr3);
//dr = dt.NewRow();
//Store the DataTable in ViewState
ViewState["CurrentTable3"] = dt3;
Gridview3.DataSource = dt3;
Gridview3.DataBind();
}
private void AddNewRowToGrid3()
{
int rowIndex = 0;
if (ViewState["CurrentTable3"] != null)
{
DataTable dtCurrentTable3 = (DataTable)ViewState["CurrentTable3"];
DataRow drCurrentRow3 = null;
if (dtCurrentTable3.Rows.Count > 0)
{
for (int i = 1; i <= dtCurrentTable3.Rows.Count; i++)
{
//extract the TextBox values
DropDownList box7 = (DropDownList)Gridview3.Rows[rowIndex].Cells[1].FindControl("TextBox7");
TextBox box8 = (TextBox)Gridview3.Rows[rowIndex].Cells[2].FindControl("TextBox8");
drCurrentRow3 = dtCurrentTable3.NewRow();
drCurrentRow3["RowNumber3"] = i + 1;
dtCurrentTable3.Rows[i - 1]["Column7"] = box7.Text;
dtCurrentTable3.Rows[i - 1]["Column8"] = box8.Text;
rowIndex++;
}
dtCurrentTable3.Rows.Add(drCurrentRow3);
ViewState["CurrentTable3"] = dtCurrentTable3;
Gridview3.DataSource = dtCurrentTable3;
Gridview3.DataBind();
}
}
else
{
Response.Write("ViewState is null");
}
//Set Previous Data on Postbacks
SetPreviousData3();
}
private void SetPreviousData3()
{
int rowIndex = 0;
if (ViewState["CurrentTable3"] != null)
{
DataTable dt3 = (DataTable)ViewState["CurrentTable3"];
if (dt3.Rows.Count > 0)
{
for (int i = 0; i < dt3.Rows.Count; i++)
{
DropDownList box7 = (DropDownList)Gridview3.Rows[rowIndex].Cells[1].FindControl("TextBox7");
TextBox box8 = (TextBox)Gridview3.Rows[rowIndex].Cells[2].FindControl("TextBox8");
box7.Text = dt3.Rows[i]["Column7"].ToString();
box8.Text = dt3.Rows[i]["Column8"].ToString();
rowIndex++;
}
}
}
}
protected void ButtonAdd3_Click(object sender, EventArgs e)
{
AddNewRowToGrid3();
}
protected void Button1_Click(object sender, EventArgs e)
{
MailMessage mail = new MailMessage();
mail.To.Add(TextBox10.Text);
mail.From = new MailAddress("wadtassignment@gmail.com");
mail.Subject = "Pemohonan Pengiktirafan";
mail.IsBodyHtml = true;
mail.Body = DropDownList1.Text + " " + TextBox1.Text + ","
;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.gmail.com";
smtp.Credentials = new System.Net.NetworkCredential
("wadtassignment@gmail.com", "wadt1234");
smtp.Port = 587;
smtp.EnableSsl = true;
smtp.Send(mail);
}
}
}