Showing posts with label Data Binding. Show all posts
Showing posts with label Data Binding. Show all posts

Friday, August 30, 2013

DataBinding in windows Forms in asp.net using C#.net

Title:Data binding for windows form using C#

Description:
Data Binding is the concept if providing address of memory location to a control for presenting data.This will reduce coding burden on developer and makes development faster.Below image can give the brief idea on it
Each window for will maintain binding context component.Binding context component will manage currency manager components,Currency manager will maintain record pointer to data-set table,it supports navigation and manipulations,It will place data into Bound Control.
Here the currency manager acts like mediator  between  bound control and memory block

There are two type of data binding con concepts,
1.Simple data binding
2.Complex data binding

Using Simple data binding,control can be bind to only single element.Complex data binding can be bind to more than single element

Monday, July 29, 2013

Bind data to Asp.net text box using jquery

Title: JQuery bind data to asp.net text box using Blur function

Description:
As per previous articles we have gone through different kind of data binding examples using jquery in asp.net.Now here we will learn about the usage of jquery functionality for web control.

Example:
Now i would like give an example to set the data to Text box in asp.net using jquery.This application will use to  set the food orders.As per requirement we need to assign the value to text box control based on food category Id.To accomplish this task  i have utilized  Jquery script function i:e Blur() which make the functionality what ever we used inside of it

$(document).ready(function() {
$("#<%= txtOrderList.ClientID %>").blur(function(){
var orderList = $(this).val();
$("#<%= txtOrderList1.ClientID %>".val(orderList); 
});

The above script will will bind the data to text box when the other text box focus has moved.You can use this functionality as per requirement very quickly.
This article may help you a lot..Keep visit my website

Sunday, May 12, 2013

how to export gridview to csv file in asp.net

Title: How to export grid view data to CSV or Text file in asp.net using c#.net

Description:
As per previous articles we have seen how to Bind CSV data to Grid view in asp.net,Export Grid view Data to Word Document,Export Grid view data to PDF document,Import XML data to GridView in Asp.net .Here i would like explain about how to export grid view data to CSV file in asp.net.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Export2CSV.aspx.cs" Inherits="Export2CSV" EnableEventValidation="false" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GvOrderDetails" runat="server" AutoGenerateColumns="False" >
</asp:GridView>
<asp:Button ID="btnExportCSV" runat="server" Text="Gridview To CSV" onclick="btnExportCSV_Click" />
<div>
</div>
</form>
</body>
</html>
Code behind:In the below Grid view data bind has done while page loading.when we fire click event the data colud be export to CSV file
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 System.Data.SqlClient;
using System.Data;
using System.Configuration;


public partial class Export2CSV : System.Web.UI.Page
{
SqlConnection Econ = new SqlConnection(ConfigurationManager.ConnectionStrings["Exportconn"].ToString());
DataSet ds = new DataSet();
  
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
SqlCommand cmd = new SqlCommand("select * from orders", Econ);
SqlDataAdapter Gda = new SqlDataAdapter(cmd);
Gda.Fill(ds);
GvOrderDetails.DataSource = ds;
GvOrderDetails.DataBind();
}
}

protected void btnExportCSV_Click(object sender, EventArgs e)
{
     
SqlDataAdapter Cda = new SqlDataAdapter("SELECT* FROM Orders",Econ);
DataTable Gdt = new DataTable();
Cda.Fill(ds);
    //Bind data to Data table
Gdt = ds.Tables[0];
StreamWriter Exportsw = new StreamWriter("E:\\OrderCSVReport.csv", false);
int CSVCount = Gdt.Columns.Count;
for (int i = 0; i < CSVCount; i++)
{
Exportsw.Write(Gdt.Columns[i]);
if (i < CSVCount - 1)
{
Exportsw.Write(",");
}
}
Exportsw.Write(Environment.NewLine);

foreach (DataRow Gdr in Gdt.Rows)
{
for (int i = 0; i < CSVCount; i++)
{
if (!Convert.IsDBNull(Gdr[i]))
{
Exportsw.Write(Gdr[i].ToString());
}
if (i < CSVCount - 1)
{
Exportsw.Write(",");
}
}
Exportsw.Write(Environment.NewLine);
}
Exportsw.Close();
}
}
}

Monday, April 29, 2013

Edit,delete,update records in gridview using sqldatasource in asp.net

Title: Edit Delete Update in Grid view in asp.net

Description:In previous post i have given how to edit,delete,update in grid view using row events,Bind data to grid view using SQL data source(here you can see how to use it).For this we need to set the  properties for grid view to enable the columns for db transaction.Might be get where the DML commands are executed?.The answer is the sqldatasource has properties to executes those commands when user perform those action on grid view

Example:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OrderGrid.aspx.cs" Inherits="OrderGrid" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GvOrder" AllowSorting="True" Runat="server"
AutoGenerateEditButton="True" AutoGenerateDeleteButton="True" AutoGenerateColumns="False" DataSourceID="OrdrDb">
<Columns>
<asp:BoundField DataField="OrderID" HeaderText="OrderID"
SortExpression="OrderID" />
<asp:BoundField DataField="OrderName" HeaderText="OrderName"
SortExpression="OrderName" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Address" HeaderText="Address"
SortExpression="Address" />
<asp:BoundField DataField="Amount" HeaderText="Amount"
SortExpression="Amount" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="OrdrDb" runat="server"
ConnectionString="<%$ ConnectionStrings:TestConnectionString %>"
SelectCommand="SELECT * FROM [Orders]" UpdateCommand="UPDATE [Orders] SET [OrderName] = @OrderName, [Phone] = @Phone,
[Address] = @Address, [Amount] = @Amount WHERE [OrderID] = @OrderID" DeleteCommand="Delete [Orders] WHERE [OrderID] = @OrderID"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Result:
Display Order table table using Data source:
Bind data to gridview
Update Records using edit operation in grid view





Wednesday, November 28, 2012

String to DataTable in asp.net using C#.Net

Title:How to bind data table using string array in asp.net using c#

Description:
We have already learnt data binding to data source controls.Now i would like to show how would we use the array list to bind the data to grid view etc.

Examples:
Some  examples for JQuery Auto complete text boxhow to bind or Export CSV data to data table in asp.net.The below example describes the logic of iteration of array list to  data table.In the below i have used a string array to hold the string data and a grid view to display the resultant data of Data table.
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<asp:GridView ID="GvOrdr" runat="server"></asp:GridView>
</asp:Content>

DataTable dtOrdrName = new DataTable();
dtOrdrName.Columns.Add(new DataColumn("Name", typeof(string)));
string[] strSplitOp = new string[] { "bhaskar", "Siva", "Ram" };
for (int i = 0; i <= strSplitOp.Length - 1; i++)
{
DataRow NewDrow = dtOrdrName.NewRow();
NewDrow["Name"] = strSplitOp[i].ToString();
dtOrdrName.Rows.Add(NewDrow);
}
GvOrdr.DataSource = dtOrdrName;
GvOrdr.DataBind();

Monday, October 29, 2012

Dynamically add columns to GridView in asp.net using C#.net

Title:How to create dynamic columns in grid view in asp.net using c#.net

Description:
Up to now we have gone through the data binding concepts like bind data to drop down list in grid view and how to use the link button in grid view.Here i would like to explain how to do customized grid view using c#.net.t.For this the i have created a data table which has three columns and assign the list data to data table using iterations.The resultant grid view can see in the below image

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Add rows Dynamically to grdivew</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:gridview autogeneratecolumns="False" id="DynamicColAddGrid" runat="server">
</asp:gridview>
</div>
</form>
</body>
</html>


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 _DynamicCol : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
List<string> li = new List<string>();
li.Add("Bhaskar");
li.Add("Siva");
li.Add("Ram");
li.Add("Venky");
li.Add("Hari");
li.Add("Aru");
li.Add("Srinu");
li.Add("anil");
li.Add("sri");
li.Add("john");
DataTable ddt = new DataTable();
DataRow darow;
DataColumn dc = new DataColumn("Id", typeof(string));
DataColumn dc1 = new DataColumn("Name", typeof(string));
DataColumn dc2 = new DataColumn("FullName", typeof(string));
ddt.Columns.Add(dc);
ddt.Columns.Add(dc1);
ddt.Columns.Add(dc2);
int ditem = 0;
while (ditem < 8)
{
darow = ddt.NewRow();
ddt.Rows.Add(darow);
ddt.Rows[ditem][dc] = ditem.ToString();
ddt.Rows[ditem][dc1] = li[ditem].ToString();
ddt.Rows[ditem][dc2] = li[ditem].ToString();
ditem++;
}    
DynamicColAddGrid.DataSource = ddt;
DynamicColAddGrid.DataBind();  
}
}
Result:

Sunday, July 1, 2012

How to Bind data to gridview in asp.net

Title: How to bind data to grid view in asp.net using c#.net

Description:
This is the basic concept of the data binding to data source controls in asp.net.Now i would like to explain and given example on bind data to drop down list in grid view,In this post i will explain how to bind the data to grid view example in asp.net.Here the stored procedure has been used to get the data from sql database.In the same way we can see how to call a stored procedure in this example

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Bind data to gridview in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="grvdoc" AllowSorting="True" Runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>

Code Behind:

protected void Page_Load(Object Sender, EventArgs E) 
{
SqlConnection con=new SqlConnection("Data Source=Test;Initial Catalog=binddata;Integrated Security=true")
SqlCommand cmd = new SqlCommand("fiilldocgridview", con);
cmd.CommandType = CommandType.StoredProcedure;con.Open();
SqlDataAdapter ad = new SqlDataAdapter(cmd);DataSet ds = new DataSet();
try
{
da = new SqlDataAdapter(cmd);
da.Fill(ds, "DoctorsTable");
grvdoc.DataSource = ds;
grvdoc.DataBind();
}
catch
{
throw;
}
finally
{
cmd.Dispose();
con.Close();
con.Dispose();
}
}
}
filldocgridview Stored Procedure:

CREATE PROCEDURE [dbo].[fiilldocgridview]
AS
SELECT * FROM  binddata

Friday, May 25, 2012

BInd data to dropdownlist in gridview in asp.net

Title: How to bind data to drop down list in asp.net using c#.net

Description:
In previous posts i explained Asp.net bind data to grid view,bind data to dropdownlist,Bind drop down in MVC4.Bind grid view using LINQ. Here i will show how to binding the data to Drop down List inside of Grid View.Here the dropdownlist has place inside of grid view template Field .You can observe here i will bind data to both drop down and grid view While loading page.

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Bind data to Dropdownlist in gridview in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GvSalesData" AllowSorting="True" Runat="server"
AllowPaging="true" AutoGenerateColumns="False" >
<Columns>
<asp:TemplateField HeaderText="SalesID">
 <ItemTemplate>
 <%#Eval("SID")  %>
 </ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SalesPName">
 <ItemTemplate>
<%#Eval("SalesPersonName")  %>
</ItemTemplate>
</asp:TemplateField>
 <asp:TemplateField HeaderText="Samount">
 <ItemTemplate>
<%#Eval("Samt")  %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="SalesCity">
<ItemTemplate>
<asp:DropDownList ID="ddl_city" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
 </form>
</body>
</html>
Code behind:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

public partial class Dropdowningridview : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection(ConfigurationManager.ConnectionStrings["bhaskarconnection"].Tostring());

protected void Page_Load(object sender, EventArgs e)
{
If(!page.IsPostBack)
{
//Bind data to gridview
BindOrdrGrid();
//Bind data to Dropdown in gridview
BindDropdownGrid();
}
private void BindOrdrGrid()
{
 SqlDataAdapter Ordr_ad = new SqlDataAdapter("select * from Order_details", cn);
 DataSet Ordr_ds = new DataSet();
 Ordr_adp.Fill(Ordr_ds, "Order_details");
 GvSalesData.DataSource = Ordr_ds;
 GvSalesData.DataBind(); 
}
private void BindDropdownGrid()
{
cn.Open();
SqlDataAdapter Ddl_ad = new SqlDataAdapter("select * from order_city", cn);
DataSet Ddl_ds = new DataSet();
ad.Fill(Ddl_ds, "order_city");
foreach (GridViewRow row in GvSalesData.Rows)
{
DropDownList _ddlcity = (DropDownList)(GvSalesData.Rows[row.RowIndex].Cells[4].FindControl("ddl_city"));
_ddlcity.DataSource = Ddl_ds;
_ddlcity.DataValueField = "CID";
_ddlcity.DataTextField = "City_name";
_ddlcity.DataBind();
}
}

Thursday, May 3, 2012

How to binding the data to a chart in asp.net

Title:How to bind data to chart control in asp.net using c#.net

Description:
Binding data to a chart control is pretty simple in asp.net.The below example will show how to set the  student marks and exam types.For this two arrays String[],Double[] are used to get the count of class subject and exams which are given to chart x,y axis values
String[] sItems = new String[10];
Double[] iValue = new Double[10];
int j;
string s = "select count (*) as count from class_subject where classid='4'";
Con.Open();
cmd = new SqlCommand(s, Con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
count = int.Parse(dr["count"].ToString());
}
Con.Close();
string sql = "select count (*) as count from exams e, marks m
where m.examid=e.examid and m.admissionno='" +
Session["admissionnumber"] + "'";
Con.Open();
cmd = new SqlCommand(sql, Con);
dr = cmd.ExecuteReader();
while (dr.Read())
{
exams = int.Parse(dr["count"].ToString());
}
Con.Close();
string sql1 = "select e.examtype as examname,ms.marks as obtainedmarks,mm.maximumfrom  marks_subject ms,marks m,exams
e,maxmarks mm  where e.examid=m.examid and  m.marksid=ms.marksid and
e.examid=mm.examid and  m.admissionno='" + Session["admissionnumber"]
+ "' and ms.subjectid='17'";
Con.Open();
SqlDataAdapter da = new SqlDataAdapter(sql1, Con);
Con.Close();
ds.Tables.Clear();
da.Fill(ds);
for (j = 0; j < exams; j++)
{
sItems[j] = ds.Tables[0].Rows[j][0].ToString();
obt = int.Parse(ds.Tables[0].Rows[j][1].ToString());
max = int.Parse(ds.Tables[0].Rows[j][2].ToString());
totalmarks = count * max;
percentage = (double)obt / totalmarks * 100;
string rounded = percentage.ToString("#0.00");
iValue[j] = double.Parse(rounded.ToString());
}
sItems[j] = "maximum % ";
iValue[j] = 100;
// axis values
markschart.YAxisValues = iValue;
markschart.YAxisItems = sItems;
markschart.Visible = true;
markschart.ChartTitle = "Marks chart:";
markschart.XAxisTitle = "(units display percentage)";

Friday, December 9, 2011

GridView Sorting and Paging in Asp.net

Title : Paging and sorting in grid view in asp.net using c#

Description:
Recently While working with the grid view sorting ,i have noticed the the functionality and do the example on in grid view using c sharp.Here i will shown how sort the data and pagination in grid view.The below specified code will make sorting when clicking on  grid view header .So first we have to do some properties set up i:e
Allow sorting-->True:-column headings will be provided with hyperlinks[link button]
Code behind:
//pageload
if(page.ispostback==false)
{
//ordinary request information will be displayed sorted based on the empname
Sqlconnection con=New Sqlconnection("userid=sa";password=;databse=emp");

SqlDataadaptor da=New SqlDataadapator("select*from Employee Orderby empname",con);

//orderby is used to retrieve records in sorted order
Dataset ds=New Dataset();

da.fill(ds,"Employee");

Gvemp.Datasource=ds.Table["Employee"];
Gvemp.DataBind();
}
Providing Logic For Grid view Event:-
When user clicks on the column header of grid view post back takes place,sorting event procedure of grid view will be executed.This Event procedure will be provided column name
protected void Gridview-sorting(Object sender,Event Args e)
{
Response.Write{"colname:"+e.SortExpression);
//e.SortExpression will provide colomn name selected by user
SqlDataadaptor da=New SqlDataadapator("select*from Employee Orderby empname"+e.Sortexpression,con);

Dataset ds=New Dataset();

da.fill(ds,"Employee");

Gvemp.Datasource=ds.Table["Employee"];

Gvemp.DataBind();
}
Note:The similar code is required in page load and Grid view-sorting event Process .To avoid repetition using fallowing subprogram to fill grid view
void fillgrid(cname);

Title: How to highlight the Grid view row in asp.net
Here i will shown how to high lighting the name according to country.This requires Row data bound event of grid view control.Row data bound event will be executed towards each row construction with data from data source.This will provide access to row constructed
protected void Gridview-rowdataBound(..,..)
{
Response.Write(e.row.cells[4].Text+"");

if(e.Row.cells[4].Text=="Usa")

e.Row.Backcolor=system.drawing.color.Red;
}

Wednesday, November 30, 2011

Row edit,delete,update in grid view in asp.net using c#

Title: Edit,Delete,Update Data in Grid view in Asp.net using c#.net

Description:
As per previous articles we have seen how to export grid view data to excel in asp.net and how to bind data to drop down list in grid view.Now i would like to explain how to do edit,update in grid view using c#.Before going to start we have to set the grid view properties i:e(AutogenerateDeleteButton,AutogenerateEditButton,AutogenerateUpdateButton) to enable the auto generate Edit,Delete,Update buttons. The given example will show how to do the CRUD functionality on grid view data
Grid View properties:
<asp:GridView ID="GridView1" runat="server" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True" AutoGenerateSelectButton="True">
</asp:GridView>

Bind the data to grid view:
//page load event
if(page.isPostback==false)
{
dataset ds=null;
ds=(dataset)session["ds1"];
//session will contain dataset ds1 with data selected by user
if(ds!=null)
{
gvemp.datasource=ds.Tables["employee"];
gvemp.DataBind();
}
}      
Row Editing:
When user clicks on edit button post backtakes place,row editing event of grid view will be executed.This event will provide row index
protected void gremp_rowediting(object sender,EventArgs e)
{
dataset ds=(dstaset)session["ds1"];
gvemp.editindex=e.new editindex;
//e.newedit index:- will be provide index of row for which edit button is selected
gvemp.Datasource=Ds.Table["employee"];
gvemp.Databind();
}
Row Updating:
This will perform post back,row-updating event procedure of grid view will be executed
protected void gvemp-rowupdating(Object sender,EvenArgs e)
{
Textbox txt=(Textbox)gvemp.Rows[e.RowIndex].cells[3].controls[0];
//here i will update the third cell data in grid view
int avg=int.parse(txt.Text);
Dataset ds=(dataset)session["ds1"]; 
ds.Tables["employee"].rows[e.Rowindex]["Average"]=avg;
ds.Tables["employee"].AcceptChanges();
session["Ds1"]=ds;
//it will overwrite the session of Dataset
//Rearrange Gridview
gvemp.editIndex=-1;
gvemp.Datasource=Ds.Tables["employee"];
gvemp.DataBind();
}
Row Deleting:
This will perform post back,row-deleting event procedure of grid view will be executed
protected void gvemp-rowdeleting(Object sender,EvenArgs e)
{
Dataset ds=(dataset)session["ds1"]; 
ds.Tables["employee"].rows[e.Rowindex].Delete();
ds.Tables["employee"].AcceptChanges();
session["Ds1"]=ds;
gvemp.Datasource=Ds.Tables["employee"];
gvemp.DataBind();
}

Friday, November 25, 2011

XML data into Gridview in asp.net

Title:how to bind XML data in grid view in asp.net using C#.net

Description:
We have seen different examples on  how to bind data to Grid view in asp.net ,Import XML data to Grid View,bind data table to Grid view.Now i would like show how to bind the XML data to grid view.Before going to start  you may think we have to use XML classes to read the data,But we will not use any XML classes .In asp.net Data set has property to read the XML data which is Readxml().
XML Data:
<?xml version="1.0" encoding="utf-8" ?>
<Orders>
<Order>
<OrderId>1</OrderId>
<OrderName>Asp.net</OrderName>
<Phone>0000000000</Phone>
<Address>Hyd</Address>
<Amount>100</Amount>
</Order>
<Order>
<OrderId>2</OrderId>
<OrderName>Sharepoint</OrderName>
<Phone>1111111111</Phone>
<Address>USA</Address>
<Amount>200</Amount>
</Order>
<Order>
<OrderId>3</OrderId>
<OrderName>Jquery</OrderName>
<Phone>2222222222</Phone>
<Address>UK</Address>
<Amount>200</Amount>
</Order>
<Order>
<OrderId>4</OrderId>
<OrderName>Mvc</OrderName>
<Phone>4444444444</Phone>
<Address>AUS</Address>
<Amount>300</Amount>
</Order>
</Orders>

Aspx Page:

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Bind XML data to Gridview in asp.net</title>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GVdynamicXML" runat="server" AutoGenerateColumns="False"
>
<Columns>
<asp:BoundField DataField="OrderID" HeaderText="OrderID"
 SortExpression="OrderID" />
<asp:BoundField DataField="OrderName" HeaderText="OrderName"
 SortExpression="OrderName" />
<asp:BoundField DataField="Phone" HeaderText="Phone" SortExpression="Phone" />
<asp:BoundField DataField="Address" HeaderText="Address"
SortExpression="Address" />
<asp:BoundField DataField="Amount" HeaderText="Amount"
SortExpression="Amount" />
</Columns>
</asp:GridView>
</form>
</body>
</html>

Code behind:
using System;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;

public partial class _XMLbindGridviewDefault3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataSet myDataSet = new DataSet();
myDataSet.ReadXml(Server.MapPath("~/XMLFile.xml"));
GVdynamicXML.DataSource = myDataSet;
GVdynamicXML.DataBind();
}
}
}
We should give a specific path of XML file to read the data using Readxml().Then bind the data  to grid view "gd_view"

Bel