R
Rainer Fuchsbichler
Hi there
I ve the following little Problem !
in my asp.net site i start an httpRequest to an asp Site, which is
responding XML Data
now I want to show this Data in a way there it is also possible to check
one of the displayed Data to get more information
till now I showed it in a Datagrid here !!!
the short Code sample :
httpClient http = new
httpClient("http://localhost/ruefaflugneu/KuoniXML/kuonisbb.asp
Dep="+Dep+"&Arr="+Arr+"&Start="+Start+"&End="+End+Dir+"&Cl="+Cl+"&One="+One+
"&Adl="+Adl+"&Chl="+Chl+"&Inf="+Inf+"&Trf="+Trf+"&Car="+Car+"&Deptime=&Arrti
me=");
// thats the call to the asp site
XmlDocument doc = new XmlDocument();
doc.Load(http.InputStream); // here i am getting my XML from the asp Site
//now i am Parsing my xml and filling colums from a Daatable , cause i need
only some special information in my Display
XmlNodeList Tariffliste = doc.GetElementsByTagName("TARIFF");
anztarife = new DataTable("anztarife");
trfverfuegbar = new DataColumn("Verfuegbar", typeof(string));
trfprice = new DataColumn("Preis", typeof(string));
trfclass = new DataColumn("Klasse", typeof(string));
trfcarrier = new DataColumn("Fluglinie", typeof(string));
trfbutton = new DataColumn(" ");
anztarife.Columns.Add(trfverfuegbar);
anztarife.Columns.Add(trfprice);
anztarife.Columns.Add(trfclass);
anztarife.Columns.Add(trfcarrier);
anztarife.Columns.Add(trfbutton);
if (Cl == "F")
Klasse = "First ( ";
if (Cl == "B")
Klasse = "Business ( ";
if (Cl == "Y")
Klasse = "Economy ( ";
foreach (XmlNode tarif in Tariffliste)
{
bool trfvrfO = true;
bool trfvrfI = true;
bool trfvrf = true;
string ID = "1";
string dir ="O";
row = anztarife.NewRow();
XmlNode Flightmask = tarif.SelectSingleNode("FLIGHTMASK");
XmlNodeList Flights = tarif.SelectNodes("FLIGHT");
row["Preis"] = tarif.ChildNodes.Item(3).InnerText.ToString();
row["Klasse"] = Klasse + Flightmask.ChildNodes.Item(5).InnerText.ToString()
+ " )";
row["Fluglinie"] = Flightmask.ChildNodes.Item(11).InnerText.ToString();
foreach (XmlNode flight in Flights)
{
string aktID = flight.ChildNodes.Item(5).InnerText.ToString();
string aktDir = flight.ChildNodes.Item(6).InnerText.ToString();
bool akttrfvrf = flight.ChildNodes.Item(10).InnerText.StartsWith("verf");
if ( dir.Equals(aktDir))
{
if (ID.Equals(aktID))
trfvrfO = trfvrfO&&akttrfvrf;
else
{
if (!trfvrfO)
{
trfvrfO = trfvrfO || akttrfvrf;
ID = aktID;
}
}
}
else
{
if (ID.Equals(aktID))
trfvrfI = trfvrfI&&akttrfvrf;
else
{
if (!trfvrfI)
{
trfvrfI = trfvrfI || akttrfvrf;
ID = aktID;
}
}
}
}
trfvrf = trfvrfI&&trfvrfO;
if (trfvrf)
row["Verfuegbar"]= "ja";
else
row["Verfuegbar"]= "nein";
anztarife.Rows.Add(row);
}
dgTariffe.DataSource = anztarife;
dgTariffe.DataBind();
well and last but not least I am going to set the Datasource and Bind my
Data to the DataGrid
and I am seeing it
so but DataGrid seems to be no Control in Webforms where I could select
Clientside an Item and show further Details
so i thought that DataList would be a better Control but nethertheless if I
try to change the Datagrid to a DataList !
I think my Itemtemplates are wrong so any idea how my itemtemplate should
look like
I ve the following little Problem !
in my asp.net site i start an httpRequest to an asp Site, which is
responding XML Data
now I want to show this Data in a way there it is also possible to check
one of the displayed Data to get more information
till now I showed it in a Datagrid here !!!
the short Code sample :
httpClient http = new
httpClient("http://localhost/ruefaflugneu/KuoniXML/kuonisbb.asp
Dep="+Dep+"&Arr="+Arr+"&Start="+Start+"&End="+End+Dir+"&Cl="+Cl+"&One="+One+
"&Adl="+Adl+"&Chl="+Chl+"&Inf="+Inf+"&Trf="+Trf+"&Car="+Car+"&Deptime=&Arrti
me=");
// thats the call to the asp site
XmlDocument doc = new XmlDocument();
doc.Load(http.InputStream); // here i am getting my XML from the asp Site
//now i am Parsing my xml and filling colums from a Daatable , cause i need
only some special information in my Display
XmlNodeList Tariffliste = doc.GetElementsByTagName("TARIFF");
anztarife = new DataTable("anztarife");
trfverfuegbar = new DataColumn("Verfuegbar", typeof(string));
trfprice = new DataColumn("Preis", typeof(string));
trfclass = new DataColumn("Klasse", typeof(string));
trfcarrier = new DataColumn("Fluglinie", typeof(string));
trfbutton = new DataColumn(" ");
anztarife.Columns.Add(trfverfuegbar);
anztarife.Columns.Add(trfprice);
anztarife.Columns.Add(trfclass);
anztarife.Columns.Add(trfcarrier);
anztarife.Columns.Add(trfbutton);
if (Cl == "F")
Klasse = "First ( ";
if (Cl == "B")
Klasse = "Business ( ";
if (Cl == "Y")
Klasse = "Economy ( ";
foreach (XmlNode tarif in Tariffliste)
{
bool trfvrfO = true;
bool trfvrfI = true;
bool trfvrf = true;
string ID = "1";
string dir ="O";
row = anztarife.NewRow();
XmlNode Flightmask = tarif.SelectSingleNode("FLIGHTMASK");
XmlNodeList Flights = tarif.SelectNodes("FLIGHT");
row["Preis"] = tarif.ChildNodes.Item(3).InnerText.ToString();
row["Klasse"] = Klasse + Flightmask.ChildNodes.Item(5).InnerText.ToString()
+ " )";
row["Fluglinie"] = Flightmask.ChildNodes.Item(11).InnerText.ToString();
foreach (XmlNode flight in Flights)
{
string aktID = flight.ChildNodes.Item(5).InnerText.ToString();
string aktDir = flight.ChildNodes.Item(6).InnerText.ToString();
bool akttrfvrf = flight.ChildNodes.Item(10).InnerText.StartsWith("verf");
if ( dir.Equals(aktDir))
{
if (ID.Equals(aktID))
trfvrfO = trfvrfO&&akttrfvrf;
else
{
if (!trfvrfO)
{
trfvrfO = trfvrfO || akttrfvrf;
ID = aktID;
}
}
}
else
{
if (ID.Equals(aktID))
trfvrfI = trfvrfI&&akttrfvrf;
else
{
if (!trfvrfI)
{
trfvrfI = trfvrfI || akttrfvrf;
ID = aktID;
}
}
}
}
trfvrf = trfvrfI&&trfvrfO;
if (trfvrf)
row["Verfuegbar"]= "ja";
else
row["Verfuegbar"]= "nein";
anztarife.Rows.Add(row);
}
dgTariffe.DataSource = anztarife;
dgTariffe.DataBind();
well and last but not least I am going to set the Datasource and Bind my
Data to the DataGrid
and I am seeing it
so but DataGrid seems to be no Control in Webforms where I could select
Clientside an Item and show further Details
so i thought that DataList would be a better Control but nethertheless if I
try to change the Datagrid to a DataList !
I think my Itemtemplates are wrong so any idea how my itemtemplate should
look like