Click here to Skip to main content
15,897,187 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: How to sort all data use xslt? Pin
guiqul16320-Nov-07 20:14
guiqul16320-Nov-07 20:14 
QuestionProblem with binding XMl data into nested repeater control?? Pin
Vishnu Narayan Mishra18-Nov-07 20:43
Vishnu Narayan Mishra18-Nov-07 20:43 
QuestionProblem with displaying parent node and child node attribute in c#-- need urgent [modified] Pin
Vishnu Narayan Mishra15-Nov-07 17:35
Vishnu Narayan Mishra15-Nov-07 17:35 
AnswerRe: Problem with displaying parent node and child node attribute in c#-- need urgent Pin
George L. Jackson15-Nov-07 18:00
George L. Jackson15-Nov-07 18:00 
GeneralRe: Problem with displaying parent node and child node attribute in c#-- need urgent Pin
Vishnu Narayan Mishra15-Nov-07 19:13
Vishnu Narayan Mishra15-Nov-07 19:13 
AnswerRe: Problem with displaying parent node and child node attribute in c#-- need urgent Pin
George L. Jackson16-Nov-07 1:28
George L. Jackson16-Nov-07 1:28 
AnswerRe: Problem with displaying parent node and child node attribute in c#-- need urgent Pin
George L. Jackson16-Nov-07 1:58
George L. Jackson16-Nov-07 1:58 
QuestionHow to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure) Pin
Vishnu Narayan Mishra15-Nov-07 0:36
Vishnu Narayan Mishra15-Nov-07 0:36 
Hello every one I am facing a problem to display attribute of parent node and corresponding child

nodes.Suppose I have to display Label attributes of all <ScreenToSupport>. There can be multiple

<ScreenToSupport> inside parent node <ScreensToSupport>.
In this case I have to display Label 'rediffHomePage' and 'rediffHomePage1' of both

<ScreenToSupport> node. There is no issue to diplay these two Label. I done this by taking a

repeater control.
But problem arrises when I have to display corresponding Label of 'FieldsToSupport/FieldToSupport'

of <ScreenToSupport>..
For example on click an Item like rediffHomePage from a repeater It should display like 'HotJobs'

and 'Game'. How can I display Label of corresponding FieldsToSupport/FieldToSupport on click on

corresponding Label of <ScreenToSupport>.. Should I take Repeater inside Repeater or I Repeater

inside DataList.

following is the structure of XML file
--------------------------------------------------------------------
<ScreensToSupport>
<ScreenToSupport>
<ScreenUniqueId>199d1dfd-63ca-4271-b234-77da0f579e0e</ScreenUniqueId>
<SupportItems>
<ScreenSupportItem>
...
<RefId>1</RefId>
</ScreenSupportItem>
</SupportItems>
<FieldsToSupport>
<FieldToSupport>
...
<Label>HotJobs</Label>
...
<FieldSupportItems />
</FieldToSupport>
<FieldToSupport>
...
<Label>Game</Label>
...
<FieldSupportItems />
</FieldToSupport>
</FieldsToSupport>
<Label>rediffHomePage</Label>

</ScreenToSupport>
<ScreenToSupport>
<ScreenUniqueId>e62abc49-efc7-4a5d-908f-33f2f4df070b</ScreenUniqueId>
<SupportItems>
<ScreenSupportItem>
...
<RefId>2</RefId>
</ScreenSupportItem>
</SupportItems>
<FieldsToSupport>
<FieldToSupport>
..
<Label>Images</Label>
..
<FieldSupportItems />
</FieldToSupport>
<FieldToSupport>
...
<Label>Air Tickets</Label>
...
<FieldSupportItems />
</FieldToSupport>
</FieldsToSupport>
<Label>rediffHomePage1</Label>
</ScreenToSupport>
</ScreensToSupport>
--------------------------------------------------------------------
and following is my .cs file
--------------------------------------------------------------------
<%@ Page Language="C#" MasterPageFile="~/BaydonHeader.master" AutoEventWireup="true"

CodeFile="list_labels.aspx.cs" Inherits="list_labels" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="Baydon"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<asp:Content ID="Content2" ContentPlaceHolderID="cphDetail" runat="Server">
<script runat="server">

public void Page_Load(Object sender, EventArgs e){
string AlbumPath = Request.QueryString["AlbumPath"];
string AlbumName = Request.QueryString["AlbumName"];
string path=AlbumPath + "/" + AlbumName + ".linkinfo.xml";
XmlDataSource1.DataFile = path;
// XmlDataSource2.DataFile = path;

XmlDataSource2.Data = "<FieldsToSupport><FieldToSupport><Label>Just To Test

1</Label></FieldToSupport><FieldToSupport><Label>Just To Test

2</Label></FieldToSupport></FieldsToSupport>";

if (!IsPostBack) {
string xmlFilePath = @path;
UpdateXml();
//XmlDocument doc = new XmlDocument();
//doc.Load(xmlFilePath);
System.Data.DataSet objDataSet = new DataSet();
objDataSet.ReadXml(path);
}
}

public void UpdateXml()
{
try
{

string AlbumPath = Request.QueryString["AlbumPath"];
string AlbumName = Request.QueryString["AlbumName"];
string path = AlbumPath + "\\" + AlbumName + ".linkinfo.xml";
XmlDocument doc = new XmlDocument();
doc.Load(path);
System.Data.DataSet objDataSet = new DataSet();
objDataSet.ReadXml(path);

int intRefId = 1; //Request.QueryString["RefId"].ToString();

/*ls*/
string strXPathLS =

"/LinkInformation/ScreensToSupport/ScreenToSupport/SupportItems/ScreenSupportItem[RefId='" +

intRefId + "']";
XmlNode newParentLS = doc.SelectSingleNode(strXPathLS).ParentNode.NextSibling;

/*
Repeater repeaterLS = new Repeater();
repeaterLS=(Repeater)Repeater1.FindControl("Repeater2");
Repeater3.DataSource = newParentLS;
Repeater3.DataBind();
*/

/*
foreach (System.Xml.XmlNode node1LS in newParentLS)
{
Response.Write(node1LS["Label"].InnerText + "<br>");
}
*/
/*ls*/
}
catch (Exception err)
{
Response.Write(err);
//lblError.Text = "ERROR:" + err.Message.ToString();
//txtUrlTitle.Focus();
}

}

</script>

<script type="text/javascript">

function showCD(str)
{
// var strXML=document.getElementById("scid").value;
// alert(strXML);
var imgId=str;

function getURLParam(strParamName){

var strPath = "";
var strName = "";
var strHref = window.location.href;
if ( strHref.indexOf("?") > -1 ){
var strQueryString = strHref.substr(strHref.indexOf("?")).toLowerCase();
var aQueryString = strQueryString.split("&");
strPath = aQueryString[0];
strName = aQueryString[1];
var url="list_labels.aspx"+strPath+"&"+strName+"&ImgId="+imgId;
window.location=url;
}
}
getURLParam("AlbumPath");

}
</script>
<div align="center">
<fieldset class="fieldset1" style="border-bottom-color:#6699ff;

border-left-color:#6699ff;border-right-color:#6699ff; border-top-color:#6699ff;

border-style:groove;">

<table style="width: 100%; height: 100%">

<tr>
<td align="left" style="width: 19%; height: 100%" valign="top">

<table style="border-right: #6699ff thin solid; border-top: #6699ff thin solid;

padding-left: 4px;
border-left: #6699ff thin solid; width: 87%; border-bottom: #6699ff thin

solid;
height: 90%">
<tr>
<td align="left" style="width: 216px; height: 100px" valign="top">
<table style="height: 40%">
<tr>
<td style="height: 18px; background-color: #0099cc;"

valign="top">

<asp:Label ID="Label4" runat="server" ForeColor="Black"

Text="Labels" BackColor="Transparent" Font-Bold="True" Font-Size="Medium" Width="216px"></asp:Label>
</td>
</tr>

<tr>
<td style="height: 175px" valign="top">
<asp:XmlDataSource runat="server" id="XmlDataSource1"

XPath="LinkInformation/ScreensToSupport" />
<asp:XmlDataSource runat="server" id="XmlDataSource2"

XPath="FieldsToSupport" />

<asp:Repeater ID="Repeater1" runat="server"

DataSourceID="XmlDataSource1">
<ItemTemplate>
<asp:Repeater ID="Repeater2"

DataSource='<%#XPathSelect("ScreenToSupport")%>' runat="server">


<ItemTemplate>
<%--<a href="#"

onclick="showCustomer(<%#XPath(SupportItems/ScreenSupportItem/RefId)%>)"><b><%#XPath("Label")%></b><

/a>--%>
<input type="button"

onclick="showCD(<%#XPath("SupportItems/ScreenSupportItem/RefId")%>)" value="<%#XPath("Label")%>"

style="border-right: #66ffff thin ridge; border-top: #66ffff thin ridge; font-weight: bold;

font-size: 12px; vertical-align: middle; text-transform: capitalize; border-left: #66ffff thin

ridge; cursor: hand; color: Black; border-bottom: #66ffff thin ridge; font-family: Verdana;

background-color: #E2EBED; text-align: left;width:100%" />
<asp:Repeater ID="Repeater3" runat="server"

DataSourceID="XmlDataSource2">
<ItemTemplate>
<asp:Repeater ID="Repeater9" DataSource='<%#XPathSelect("FieldToSupport")%>' runat="server">


<ItemTemplate>
<%#XPath("Label")%> <br />
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
</td>
</tr>
</table>
</td>
</tr>
</table>

<table style="border-right: #6699ff thin solid; padding-left: 4px; border-left:

#6699ff thin solid; width: 100%; border-bottom: #6699ff thin solid; height: 90%">
<tr>
<td style="width: 218px" valign="top">
<table style="height: 30%">
<tr>
<td valign="top" style="width: 264px">
<asp:Label ID="Label7" runat="server" ForeColor="Black"

Text="Actions"></asp:Label></td>
</tr>
<tr>
<td valign="top" style="width: 264px; height: 18px">
&nbsp; &nbsp;&nbsp;
</td>
</tr>
<tr>
<td align="left" valign="middle" style="width: 264px">
<asp:ImageButton ID="ImageButton2" runat="server"

ImageUrl="~/images/new.png"

OnClientClick="document.getElementById('helptypediv').style.visibility='visible';return false;"

/>&nbsp;<asp:ImageButton ID="ImageButton7" runat="server" ImageUrl="~/images/Edit.png"

/>&nbsp;<asp:ImageButton ID="ImageButton8" runat="server" ImageUrl="~/images/Delete.png" /></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td style="width: 75%" valign="top">
<table border="0" cellpadding="0" cellspacing="0" style="border-right: #6699ff

thin solid; border-top: #6699ff thin solid; padding-left: 4px; border-left: #6699ff thin solid;

width: 50%; border-bottom: #6699ff thin solid; height: 50%">
<tr>
<td colspan="2" style="height: 23px">
<asp:ImageButton ID="ImageButton1" runat="server"

ImageUrl="~/images/Page-View-hover.png" />
<asp:ImageButton ID="ImageButton6" runat="server"

ImageUrl="~/images/Browser-View.png" /></td>
</tr>

<tr style="color: #000000">
<td align="left" colspan="2" style="width: 50%; height: 40%;

background-color: #ffffff">

<div style="border-right: green 1px solid; border-top: green 1px

solid; z-index: 1; left: 400px; visibility: hidden; border-left: green 1px solid; width: 200px;

border-bottom: green 1px solid;position: absolute; top: 250px; background-color: #e2ebed"

id="helptypediv">
<table style="height: 100%; width: 100%;">
<tr style="background-color: #365f91">
<td align="center" colspan="3">
<asp:Label ID="Label1" runat="server"

ForeColor="White" Text="Select Action"></asp:Label>&nbsp;</td>

</tr>
<tr style="background-color: #95b3d7">
<td colspan="3">
Link&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input id="radLink" type="radio"

name="choosebox" /></td>
</tr>
<tr style="background-color: #c6d9f1">
<td colspan="3">
Popup&nbsp;&nbsp;
<input id="radPopup" type="radio"

name="choosebox" /></td>
</tr>
<tr>
<td colspan="3">
</td>
</tr>
<tr>
<td align="center" colspan="3">
<input id="Button2" type="button" value=" Ok "

/>
<input id="Button1"

onclick="document.getElementById('helptypediv').style.visibility='hidden'" type="button"

value="Cancel" />
</td>
</tr>
</table>
</div>
<div style="width: 700px; height: 400px; overflow: auto;

font-family: Verdana, Tahoma, Helvetica, sans-serif; font-size: 11px; color: #000000;">
<asp:Image ID="Image1" runat="server" /></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</fieldset>
</div>
</asp:Content>
--------------------------------------------------------------------
I am not very familiar with how displaying XML contents.. I tried this way..
But stuck on that point please help me ..
I will very thankful for that..

Vishnu


-- modified at 9:01 Thursday 15th November, 2007
AnswerRe: How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure) Pin
pmarfleet15-Nov-07 10:33
pmarfleet15-Nov-07 10:33 
GeneralRe: How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure) Pin
Vishnu Narayan Mishra15-Nov-07 19:16
Vishnu Narayan Mishra15-Nov-07 19:16 
GeneralRe: How to dispaly attributes of xml nested repeater..(if XML not followed hierarchical structure) Pin
pmarfleet15-Nov-07 19:41
pmarfleet15-Nov-07 19:41 
QuestionHow to give a unique id like that 15b85c2b-83ca-44ec-8741-22a4dc64f64d in using c# Pin
Vishnu Narayan Mishra14-Nov-07 20:19
Vishnu Narayan Mishra14-Nov-07 20:19 
AnswerRe: How to give a unique id like that 15b85c2b-83ca-44ec-8741-22a4dc64f64d in using c# Pin
Vishnu Narayan Mishra14-Nov-07 22:23
Vishnu Narayan Mishra14-Nov-07 22:23 
Questionhow to fetch child nodes of parent node in XML .. using c#... Pin
Vishnu Narayan Mishra14-Nov-07 2:03
Vishnu Narayan Mishra14-Nov-07 2:03 
AnswerRe: how to fetch child nodes of parent node in XML .. using c#... Pin
led mike14-Nov-07 5:02
led mike14-Nov-07 5:02 
GeneralRe: how to fetch child nodes of parent node in XML .. using c#... Pin
Vishnu Narayan Mishra19-Nov-07 20:03
Vishnu Narayan Mishra19-Nov-07 20:03 
GeneralRe: how to fetch child nodes of parent node in XML .. using c#... Pin
led mike20-Nov-07 5:39
led mike20-Nov-07 5:39 
Questionhow can we go through such kinds of tag in xml like <PopupHTML /> Pin
Vishnu Narayan Mishra13-Nov-07 23:17
Vishnu Narayan Mishra13-Nov-07 23:17 
AnswerRe: how can we go through such kinds of tag in xml like Pin
George L. Jackson14-Nov-07 1:53
George L. Jackson14-Nov-07 1:53 
QuestionHow to delete a xml node with all attributes and start, end tag of the xml node in c#-- urgent Pin
Vishnu Narayan Mishra13-Nov-07 2:17
Vishnu Narayan Mishra13-Nov-07 2:17 
AnswerRe: How to delete a xml node with all attributes and start, end tag of the xml node in c#-- urgent Pin
led mike13-Nov-07 6:18
led mike13-Nov-07 6:18 
GeneralRe: How to delete a xml node with all attributes and start, end tag of the xml node in c#-- urgent Pin
Vishnu Narayan Mishra13-Nov-07 22:24
Vishnu Narayan Mishra13-Nov-07 22:24 
QuestionHow can I go through all child nodes and attributes of child nodes of a parent node.. Pin
Vishnu Narayan Mishra12-Nov-07 22:22
Vishnu Narayan Mishra12-Nov-07 22:22 
QuestionHow can I go through all child nodes and attributes of child nodes of a parent node.. [modified] Pin
Vishnu Narayan Mishra12-Nov-07 21:14
Vishnu Narayan Mishra12-Nov-07 21:14 
QuestionEdititng the tag of XML Pin
SreejithAchutan8-Nov-07 17:04
SreejithAchutan8-Nov-07 17:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.