Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

GridView

Status
Not open for further replies.

HrvojeVd

Programmer
Jun 22, 2008
36
HR
I've created gridview user control.
I fill it with data from xml.
Then I load it into default web form to panel, but I don't see it.
Why?
 
My code on user control:

namespace TxtWeb
{
public partial class DataGridES : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{

}

GridView gridData = new GridView ();
public DataSet ds = new DataSet();

public GridView Grid
{
get
{
return gridData;
}
}

public void FillGridWithHTML(string xmlFile)
{
XmlDataDocument xmlDatadoc = new
XmlDataDocument();
xmlDatadoc.DataSet.ReadXml(xmlFile);

ds = xmlDatadoc.DataSet;
}
}
}

My code on Web form:

namespace TxtWeb
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string xmlFile
="C:\\c#\\TestnaAplk\\TestnaAplk\\Podaci.xml";

DataGridES dg = new DataGridES();
dg.FillGridWithHTML(xmlFile);
dg.Grid.DataSource = dg.ds;

PanelGrid.Controls.Add(dg);

}
}
}
 
I didn't put this code in VS yet - Have you tried

Code:
DataGridES dg = new DataGridES();
            dg.FillGridWithHTML(xmlFile);
            dg.Grid.DataSource = dg.ds;
            dg.Grid.DataBind();

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

- The Complete IT Community
 
I tried all that, but I still can't see grid.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top