Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
215 views
Hello Telerik Team,

Taking this and this into reference.
Please help me in reading this multilevel xml to a RadGrid.
1) I am planning not to use Aspx for this
2) The node named Item would eventually change as per app Requirements. So, I don't want to restrict my xpath to something like "//Product/Item"

<Products>
      <Product ProductID="1">
        <Item ItemID="1">
          <ProductNo>1234</ProductNo>
          <Description>
            <ManufacDate>20100526T12:00:01.012</ManufacDate>
            <ManufacID>72</ManufacID>
          </Description>
        </Item>
        <Item ItemID="2">
          <ProductNo>1235</ProductNo>
          <Description>
            <ManufacDate>20100527T12:00:01.012</ManufacDate>
            <ManufacID>72</ManufacID>
          </Description>
        </Item>
        <Item ItemID="3">
          <ProductNo>1236</ProductNo>
          <Description>
            <ManufacDate>20100528T12:00:01.012</ManufacDate>
            <ManufacID>66</ManufacID>
          </Description>
        </Item>
     </Product> 
       <Product ProductID="2">
        <Item ItemID="1">
          <ProductNo>1254</ProductNo>
          <Description>
            <ManufacDate>20101226T12:00:01.012</ManufacDate>
            <ManufacID>1232</ManufacID>
          </Description>
        </Item>
        <Item ItemID="2">
          <ProductNo>1T#2345</ProductNo>
          <Description>
            <ManufacDate>20100520T12:00:01.012</ManufacDate>
            <ManufacID>474#</ManufacID>
          </Description>
        </Item>
        <Item ItemID="3">
          <ProductNo>124576</ProductNo>
          <Description>
            <ManufacDate>20010518T12:00:01.012</ManufacDate>
            <ManufacID>T3455</ManufacID>
          </Description>
        </Item>
     </Product>    
 </Products>
I am reading this xml from codebehind and iterating through xmlnodes to display in the grid.
Please find my snippet below:

Private Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Init
        DefineGridStructure()
    End Sub
  
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        Dim Grid1 As RadGrid = CType(PlaceHolder1.FindControl("RadGrid1"), RadGrid)
        RadAjaxManager1.AjaxSettings.AddAjaxSetting(Grid1, Grid1)
        If Not IsPostBack Then
            Grid1.SelectedIndexes.Add(1, 0, 1)
            'Grid1.MasterTableView.Items(0).Expanded = True
            'Grid1.MasterTableView.Items(0).ChildItem.NestedTableViews(0).Items(0).Expanded = True
        End If
    End Sub
   

    Public Sub DefineGridStructure() 'Handles RadGrid1.NeedDataSource
        Dim RadGrid1 As RadGrid = New RadGrid

 

        Dim xmlDoc As New System.Xml.XmlDocument()
        xmlDoc.Load(Server.MapPath("OutTypeID6.xml"))

        Dim ndList As System.Xml.XmlNodeList = xmlDoc.SelectNodes("//Product/node()[descendant::node()]")
        Dim nd As System.Xml.XmlNode = xmlDoc.SelectSingleNode("//Product/node()[descendant::node()]")

        Dim ds As New DataSet()
        ds.ReadXml(New StringReader(nd.OuterXml))

        RadGrid1.ID = "RadGrid1"
        RadGrid1.DataSource = ds

        RadGrid1.Width = Unit.Percentage(98)
        RadGrid1.AllowPaging = True
        RadGrid1.AllowSorting = True
        RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
        RadGrid1.AutoGenerateColumns = False
        RadGrid1.ShowStatusBar = True

        RadGrid1.MasterTableView.DataKeyNames = New String() {nd.Name}

        Dim boundColumn As GridBoundColumn

        Dim tableView As New GridTableView(RadGrid1)
        Dim relationFields As GridRelationFields = New GridRelationFields()
        For Each xmlnode As System.Xml.XmlNode In ndList
            For Each XNode As System.Xml.XmlNode In xmlnode.ChildNodes
                boundColumn = New GridBoundColumn
                boundColumn.DataField = XNode.Name 'XNode.FirstChild.Value
                boundColumn.HeaderText = XNode.Name
                RadGrid1.MasterTableView.Columns.Add(boundColumn)

                If XNode.FirstChild.ChildNodes.Count > 0 Then
                    tableView.DataSource = ds.Tables(1)
                    For Each chNode As System.Xml.XmlNode In XNode.ChildNodes
                        tableView.DataKeyNames = New String() {chNode.Name}
                        tableView.Width = Unit.Percentage(100)
                        relationFields.MasterKeyField = XNode.ParentNode.Name 'chNode.ParentNode.Name
                        relationFields.DetailKeyField = XNode.ParentNode.Name 'chNode.ParentNode.Name
                        tableView.ParentTableRelation.Add(relationFields)
                        RadGrid1.MasterTableView.DetailTables.Add(tableView)

                        boundColumn = New GridBoundColumn
                        boundColumn.DataField = chNode.Name 'XNode.FirstChild.InnerText
                        boundColumn.HeaderText = chNode.Name
                        tableView.Columns.Add(boundColumn)

                    Next
                    tableView.Caption = XNode.Name
                    tableView.DataBind()
                End If
                tableView.Width = Unit.Percentage(100)
            Next
        Next
        RadGrid1.DataSource = ds
        RadGrid1.Rebind()

        Me.PlaceHolder1.Controls.Add(RadGrid1)

It would be great if you can help me correct or provide a solution to this issue without converting to XSL.
I need the Columns: ItemID, ProductNo, indented Description with ManufacDate and ManufacID. I m not sure how to get this displayed.

Thanks,
Radoslav
Telerik team
 answered on 06 Aug 2010
5 answers
400 views
Hi,

is it possible to make a whole row in a grid a hyperlink?
So when the user moves the mouse over thr row, no matter in what field, he can click the whole row and is redirected?

Thanks in advance for your help

Best regards

Thomas
Veli
Telerik team
 answered on 06 Aug 2010
1 answer
69 views
Hi All,
I am trying to implement custom filtering. I want to use my own css styles, so used 'EnableEmbeddedSkins=false' and 'EnableEmbeddedBaseStylesheet=false'.
But filter menu options are not working properly i.e. the filter menu options are not been seen properly and i am not able to do filtering.

Can anybody help me on this.

I read a note on telerik website-
Important:
RadGrid may create other RadControls as part of its elements (slider pager, filtering menu, date pickers in GridDateTimeColumns, etc.) and you will need to perform the same steps for these controls as well!

Which steps to do for this???

Any response would be helpful.

Thanks in advance.
Veli
Telerik team
 answered on 06 Aug 2010
1 answer
134 views
HI there,

If I enter a non-numeric character in the column filter of a numeric column, the page crashes. My customer is getiing it crashed this way. I would have expected to have an inbuilt exception handling for this in RadGrid.

Is there something that you can suggest a fix for?

cheers
_Phani
Shinu
Top achievements
Rank 2
 answered on 06 Aug 2010
1 answer
92 views
Hi,
    when I use the radgrid client side rebind method the call back to the server is a new session and hence looses any previous session variables.

 

 

var masterTable = RadGridRPjs.get_masterTableView();

 

masterTable.rebind();


Is this a bug?
Veli
Telerik team
 answered on 06 Aug 2010
1 answer
121 views
Hello guys. I get data for tree from wcf by dto
[DataContract]
[Serializable]
 public class FileHandlerDTO
{
        [DataMember]
        public int Id { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Description { get; set; }
        [DataMember]
        public List<FileHandlerDTO> Children;
}
How can i bind this object to TreeView. At your samples I've seen only through parentId. Your SL analogue of treeview work with such domains well.
T. Tsonev
Telerik team
 answered on 06 Aug 2010
3 answers
181 views
I would like to have a panel bar and on item selected, I would like to show or hide a asp:panel control (ie panel1.visible = true).  Each item selected will show a separate panel, so when selecting a new item, the old panel will hide and the new panel will show.  Can someone help with this? 
Yana
Telerik team
 answered on 06 Aug 2010
3 answers
253 views
Hi,

I have recently opened a project I was working on that utilizes Rad Controls for ASP.NET AJAX. The upgrade wizard informed me there was a newer version of the DLL on my computer than the project was using, so I upgraded the project. I also allowed the wizard to upgrade the toolbox. However, the log informed me that the toolbox upgrade failed with the message:

"Upgrade Toolbox: Requested registry access is not allowed."

I am running Windows 7 Ultimate on a domain. My domain user has admin rights to my PC.

How can I get the wizard to upgrade my toolbox? Failing that, how do I upgrade the toolbox manually?

Thanks in advance,

Michael
Michael Fielding
Top achievements
Rank 1
 answered on 06 Aug 2010
3 answers
948 views
Hi,

I have a grid with a GridImageColumn, now I would like to make a change. It is sometimes possible that the image the column wants to show does not exist, and I cannot check this server side before or during databind.

I found some javascript code which allows to set a new "default" image src in case the url it is pointing to does not exist, but the problem is that I do not know how to access the html <img /> element inside the GridImageColumn.

My question: is there a way to set the javascript OnError function if the <img /> element inside a GridImageColumn row either server side or client side? So I would like to be able to edit the attributes of that <img /> element which is about to be rendered... How to do this?

Kind Regards,
Kristof
Kristof
Top achievements
Rank 1
 answered on 06 Aug 2010
1 answer
279 views
Hi ,
RadWindow is not showing the Behavior properly in both IE and Chrome  below is the code what i used and kindly see the is attached picture .

<telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Telerik"
    Behaviors="Resize, Move" Behavior="Default" InitialBehavior="None" >
    <Windows>
        <telerik:RadWindow ID="ImageWindow" runat="server" Title="Item record" Height="500px"
            OnClientClose="ListBoxLoad" Width="835px" Left="150px" ReloadOnShow="False" ShowContentDuringLoad="false"
            Modal="true"  Behavior="Default" KeepInScreenBounds="true" VisibleStatusbar="false">
        </telerik:RadWindow>
        <telerik:RadWindow ID="RadWindow1" runat="server" Title="Bill Of Materials" Height="700px"
        VisibleStatusbar="false" Width="1000px" Modal="true" Behaviors="Move, Resize,Close"
        VisibleTitlebar="true"  Behavior="Default" InitialBehavior="None" Left="" style="display:none;" Top="" >
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>
Georgi Tunev
Telerik team
 answered on 06 Aug 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?