Saturday, 26 October 2013

How to Integrate XML in ADO.NET applications

Extensible Markup Language (XML) is a markup laguage that defines a set of rules for encoding documents in a format that is both human readable and machine readable.

You can Make your own XML file and integrate with your Dataset or Datatable as per your Requirement. Here I am writing some steps, after follow this step you can integrate your XML file.

1. first create a test.xml file like this given code

<?xml version="1.0" encoding="utf-8" ?>
<HrSolution>
  <HrEmployee>
    <EmployeeID>123</EmployeeID>
    <EmployeeName>Nirja</EmployeeName>
    <EmployeeSalary>19000</EmployeeSalary>
    <EmployeeAddress>Address</EmployeeAddress>
  </HrEmployee>
  <HrEmployee>
    <EmployeeID>124</EmployeeID>
    <EmployeeName>Priya</EmployeeName>
    <EmployeeSalary>20000</EmployeeSalary>
    <EmployeeAddress>Address</EmployeeAddress>
  </HrEmployee>
  <HrEmployee>
    <EmployeeID>125</EmployeeID>
    <EmployeeName>Deepika</EmployeeName>
    <EmployeeSalary>12000</EmployeeSalary>
    <EmployeeAddress>Address</EmployeeAddress>
  </HrEmployee>
  <HrEmployee>
    <EmployeeID>126</EmployeeID>
    <EmployeeName>Gayatri</EmployeeName>
    <EmployeeSalary>22000</EmployeeSalary>
    <EmployeeAddress>Address</EmployeeAddress>
  </HrEmployee>
  <HrEmployee>
    <EmployeeID>127</EmployeeID>
    <EmployeeName>Ramesh</EmployeeName>
    <EmployeeSalary>18000</EmployeeSalary>
    <EmployeeAddress>Address</EmployeeAddress>
  </HrEmployee>
</HrSolution>


2. Now add your gridview and on Button click write this code

        DataSet ds = new DataSet();

         //XML read by Dataset
        ds.ReadXml(Request.MapPath("test.xml"));

        //Show xml contents to the GridView
        GridView1.DataSource = ds.Tables[0];
        GridView1.DataBind();


Monday, 7 October 2013

How to do Asp.Net textbox validation in javascript


In this Section we learn how to do client side validation through javascript
 First we add Textbox  in our Validation.aspx page like this



OnClientClick="return validate();" is used to call the JavaScript function on click of the Submit button

Now in the validate() function, we will get the value of textboxes and check textboxes are blank or not like below:


Now for email value we will create a parameter that finds if the email format is valid or not as well as Given Password is same or not.

When user enters wrong information or may the user leaves a textbox blank, then the client side validation will be work. This will reduce server traffic and page reload problem

Tuesday, 1 October 2013

How to do ccavenue payment gateway integration in asp.net

When you buy Payment gateway from CCAvenue, they send you Integration_kit which have some library under Libs folder, add those dll to your Gac  and also you will get three .aspx pages , Data.aspx, SubmitData.aspx and ResponseHandler.aspx. you dont need to change any value of these page.

Payment Gateway always integrate with your checkout button. In checkout button you have to pass four thing. Order Id, Merchant Id, RedirectUrl and Amount. Order id must be unique.




Now your all information send to your Data.aspx page, through querystring get it into your textbox like this


Goto your SubmitData.aspx page and write your working key which you get after login into your CCAvenue account.





Now by this step you can integrate your Avenue gateway in your Asp.net page, Enjoy.....


Monday, 30 September 2013

How to: Install an Assembly into the Global Assembly Cache

To install a strong-named assembly into the global assembly cache using the Global Assembly Cache tool (Gacutil.exe)

 1. Goto your Visual Studio Command Prompt, right click and Run as Administrator

 2. Now You can see your Command prompt Window will appear., go to your source path of Dll, like bin directory of your Project

3. Now type Gacutil /i <Dll Name>.dll



The following steps installs an assembly into the global assembly cache.


Saturday, 28 September 2013

How to configure mail Settings in asp.net through SMTP

public void sendmail()
    {
        MailMessage msg = new MailMessage();
//From Address
        msg.From = new MailAddress(“abc@abc.com”);
//To Address
        msg.To.Add(“xyz@xyz.com”);
// Your  message Subject
        msg.Subject = “Your Message Subject”;
//Your message Body
        msg.Body = “Your Message Body”;

        msg.IsBodyHtml = true;
        SmtpClient smtpClient = new SmtpClient();
//Please write your DNS name instead of abc.com

        smtpClient.Host = “smtp.abc.com”;
//either you select port 25 or 587 as per your requirement
       smtpClient.Port = 25;
        smtpClient.EnableSsl = false;
        smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;

        smtpClient.Credentials = new NetworkCredential(msg.From.ToString(), “your password”);
// For Maximum timeout
        smtpClient.Timeout = 20000;
        smtpClient.Send(msg);
    }