Hi nauna,
Check this sample. now take its reference.
HTML
<div>
<h4><strong>Account:</strong></h4>
<div>
<div>Routine Number</div>
<div><asp:TextBox ID="txtRoutinNumber" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Account Number</div>
<div><asp:TextBox ID="txtAccountNumber" runat="server"></asp:TextBox></div>
</div>
<div>Account Type</div>
<div><asp:TextBox ID="txtAccountType" runat="server"></asp:TextBox></div>
<h4><strong>Consumer:</strong></h4>
<div><div>First Name</div>
<div><asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Last Name</div>
<div><asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Address 1</div>
<div><asp:TextBox ID="txtAddress1" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Address 2</div>
<div><asp:TextBox ID="txtAddress2" runat="server"></asp:TextBox></div>
</div>
<div>
<div>City</div>
<div><asp:TextBox ID="txtCity" runat="server"></asp:TextBox></div>
</div>
<div>
<div>State</div>
<div><asp:TextBox ID="txtState" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Zip</div>
<div><asp:TextBox ID="txtZip" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Phone Number</div>
<div><asp:TextBox ID="txtPhoneNumber" runat="server"></asp:TextBox></div>
</div>
<div>
<div>DL State</div>
<div><asp:TextBox ID="txtDlState" runat="server"></asp:TextBox></div>
</div>
<div>
<div>DL Number</div>
<div><asp:TextBox ID="txtDlNumber" runat="server"></asp:TextBox></div>
</div>
<div>
<div>Courtesy Card ID</div>
<div><asp:TextBox ID="txtCourtesyCardID" runat="server"></asp:TextBox></div>
</div>
<h4><strong>Account:</strong></h4>
<div>
<div>Check Amount</div>
<div><asp:TextBox ID="txtCheckAmount" runat="server"></asp:TextBox></div>
</div>
<asp:Button ID="btnCertification" runat="server" Text="Process Single Certification Check"
OnClick="OnProcessSingleCertification" />
<asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="OnSubmit" />
</div>
Namespaces
C#
using System.Data;
VB.Net
Imports System.Data
Code
C#
protected void OnProcessSingleCertification(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/XMLFile.xml"));
txtRoutinNumber.Text = ds.Tables["ACCOUNT"].Rows[0]["ROUTING_NUMBER"].ToString();
txtAccountNumber.Text = ds.Tables["ACCOUNT"].Rows[0]["ACCOUNT_NUMBER"].ToString();
txtAccountType.Text = ds.Tables["ACCOUNT"].Rows[0]["ACCOUNT_TYPE"].ToString();
txtFirstName.Text = ds.Tables["CONSUMER"].Rows[0]["FIRST_NAME"].ToString();
txtLastName.Text = ds.Tables["CONSUMER"].Rows[0]["LAST_NAME"].ToString();
txtAddress1.Text = ds.Tables["CONSUMER"].Rows[0]["ADDRESS1"].ToString();
txtAddress2.Text = ds.Tables["CONSUMER"].Rows[0]["ADDRESS2"].ToString();
txtCity.Text = ds.Tables["CONSUMER"].Rows[0]["CITY"].ToString();
txtState.Text = ds.Tables["CONSUMER"].Rows[0]["STATE"].ToString();
txtZip.Text = ds.Tables["CONSUMER"].Rows[0]["ZIP"].ToString();
txtPhoneNumber.Text = ds.Tables["CONSUMER"].Rows[0]["PHONE_NUMBER"].ToString();
txtDlState.Text = ds.Tables["CONSUMER"].Rows[0]["DL_STATE"].ToString();
txtDlNumber.Text = ds.Tables["CONSUMER"].Rows[0]["DL_NUMBER"].ToString();
txtCourtesyCardID.Text = ds.Tables["CONSUMER"].Rows[0]["COURTESY_CARD_ID"].ToString();
txtCheckAmount.Text = ds.Tables["CHECK"].Rows[0]["CHECK_AMOUNT"].ToString();
}
protected void OnSubmit(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("~/XMLFile.xml"));
DataRow drAccount = ds.Tables["ACCOUNT"].Select("ROUTING_NUMBER='" + txtRoutinNumber.Text.Trim() + "' AND ACCOUNT_NUMBER='" + txtAccountNumber.Text.Trim() + "'")[0];
DataRow drConsumer = ds.Tables["CONSUMER"].Select("PACKET_Id='" + drAccount["PACKET_Id"] + "'")[0];
DataRow drCheck = ds.Tables["CHECK"].Select("PACKET_Id='" + drAccount["PACKET_Id"] + "'")[0];
drConsumer["FIRST_NAME"] = txtFirstName.Text.Trim();
drConsumer["LAST_NAME"] = txtLastName.Text.Trim();
drConsumer["ADDRESS1"] = txtAddress1.Text.Trim();
drConsumer["ADDRESS2"] = txtAddress2.Text.Trim();
drConsumer["CITY"] = txtCity.Text.Trim();
drConsumer["STATE"] = txtState.Text.Trim();
drConsumer["ZIP"] = txtZip.Text.Trim();
drConsumer["PHONE_NUMBER"] = txtPhoneNumber.Text.Trim();
drConsumer["DL_STATE"] = txtDlState.Text.Trim();
drConsumer["DL_NUMBER"] = txtDlNumber.Text.Trim();
drConsumer["COURTESY_CARD_ID"] = txtCourtesyCardID.Text.Trim();
drCheck["CHECK_AMOUNT"] = txtCheckAmount.Text.Trim();
ds.WriteXml(Server.MapPath("~/XMLFile.xml"));
}
VB.Net
Protected Sub OnProcessSingleCertification(ByVal sender As Object, ByVal e As EventArgs)
Dim ds As DataSet = New DataSet()
ds.ReadXml(Server.MapPath("~/XMLFile.xml"))
txtRoutinNumber.Text = ds.Tables("ACCOUNT").Rows(0)("ROUTING_NUMBER").ToString()
txtAccountNumber.Text = ds.Tables("ACCOUNT").Rows(0)("ACCOUNT_NUMBER").ToString()
txtAccountType.Text = ds.Tables("ACCOUNT").Rows(0)("ACCOUNT_TYPE").ToString()
txtFirstName.Text = ds.Tables("CONSUMER").Rows(0)("FIRST_NAME").ToString()
txtLastName.Text = ds.Tables("CONSUMER").Rows(0)("LAST_NAME").ToString()
txtAddress1.Text = ds.Tables("CONSUMER").Rows(0)("ADDRESS1").ToString()
txtAddress2.Text = ds.Tables("CONSUMER").Rows(0)("ADDRESS2").ToString()
txtCity.Text = ds.Tables("CONSUMER").Rows(0)("CITY").ToString()
txtState.Text = ds.Tables("CONSUMER").Rows(0)("STATE").ToString()
txtZip.Text = ds.Tables("CONSUMER").Rows(0)("ZIP").ToString()
txtPhoneNumber.Text = ds.Tables("CONSUMER").Rows(0)("PHONE_NUMBER").ToString()
txtDlState.Text = ds.Tables("CONSUMER").Rows(0)("DL_STATE").ToString()
txtDlNumber.Text = ds.Tables("CONSUMER").Rows(0)("DL_NUMBER").ToString()
txtCourtesyCardID.Text = ds.Tables("CONSUMER").Rows(0)("COURTESY_CARD_ID").ToString()
txtCheckAmount.Text = ds.Tables("CHECK").Rows(0)("CHECK_AMOUNT").ToString()
End Sub
Protected Sub OnSubmit(ByVal sender As Object, ByVal e As EventArgs)
Dim ds As DataSet = New DataSet()
ds.ReadXml(Server.MapPath("~/XMLFile.xml"))
Dim drAccount As DataRow = ds.Tables("ACCOUNT").[Select]("ROUTING_NUMBER='" & txtRoutinNumber.Text.Trim() & "' AND ACCOUNT_NUMBER='" + txtAccountNumber.Text.Trim() & "'")(0)
Dim drConsumer As DataRow = ds.Tables("CONSUMER").[Select]("PACKET_Id='" & drAccount("PACKET_Id") & "'")(0)
Dim drCheck As DataRow = ds.Tables("CHECK").[Select]("PACKET_Id='" & drAccount("PACKET_Id") & "'")(0)
drConsumer("FIRST_NAME") = txtFirstName.Text.Trim()
drConsumer("LAST_NAME") = txtLastName.Text.Trim()
drConsumer("ADDRESS1") = txtAddress1.Text.Trim()
drConsumer("ADDRESS2") = txtAddress2.Text.Trim()
drConsumer("CITY") = txtCity.Text.Trim()
drConsumer("STATE") = txtState.Text.Trim()
drConsumer("ZIP") = txtZip.Text.Trim()
drConsumer("PHONE_NUMBER") = txtPhoneNumber.Text.Trim()
drConsumer("DL_STATE") = txtDlState.Text.Trim()
drConsumer("DL_NUMBER") = txtDlNumber.Text.Trim()
drConsumer("COURTESY_CARD_ID") = txtCourtesyCardID.Text.Trim()
drCheck("CHECK_AMOUNT") = txtCheckAmount.Text.Trim()
ds.WriteXml(Server.MapPath("~/XMLFile.xml"))
End Sub