Telerik Forums
UI for ASP.NET AJAX Forum
0 answers
209 views
Hi,

I am trying to get monthly wise details from treeview.

1. I can able to bind the Treeview details, 
2. Once the user clicks the month , i need to show the monthly wise details on the Grid. 

I have tried to get the Grid from radtreenode, I failed. Please help me out from this

Please find the below code for your reference.

<telerik:RadTreeView ID="treeViewClientBudget" runat="server" OnNodeClick="treeViewClientBudget_NodeClick">
                        
                        
                        <Nodes>
                            
                            <telerik:RadTreeNode  Text="BudgetNode">
                                
                                <NodeTemplate>
                                    

                                    <telerik:RadGrid ID="grdBudgetDetail" Width="85%" BorderWidth="0" GridLines="None"
                                        runat="server"
                                        AutoGenerateColumns="False">
                                        <ClientSettings>
                                            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
                                        </ClientSettings>

                                        <MasterTableView DataKeyNames="Month,Year" HierarchyLoadMode="ServerOnDemand">



                                            <DetailTables>
                                                <telerik:GridTableView runat="server"
                                                    DataKeyNames="Month,Year,ClassificationId" Name="Classification">
                                                    <Columns>
                                                        <telerik:GridBoundColumn DataField="ClassificationName"
                                                            FilterControlAltText="Filter Division column" UniqueName="ClassificationName" HeaderText="Classification Name">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="ActualForecast"
                                                            HeaderText="Actual Forecast"
                                                            UniqueName="ActualForecast">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn DataField="BudgedForecast"
                                                            HeaderText="Budged Forecast"
                                                            UniqueName="BudgedForecast">
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                    <DetailTables>

                                                        <telerik:GridTableView runat="server" Name="Vendor"
                                                            DataKeyNames="Month,Year,ClassificationId,VendorId">

                                                            <Columns>

                                                                <telerik:GridBoundColumn DataField="VendorName"
                                                                    FilterControlAltText="Filter Division column" UniqueName="VendorName" HeaderText="Vendor Name">
                                                                </telerik:GridBoundColumn>

                                                                <telerik:GridBoundColumn DataField="ActualForecast"
                                                                    HeaderText="Actual Forecast"
                                                                    UniqueName="ActualForecast">
                                                                </telerik:GridBoundColumn>

                                                                <telerik:GridBoundColumn DataField="BudgedForecast"
                                                                    HeaderText="Budged Forecast"
                                                                    UniqueName="BudgedForecast">
                                                                </telerik:GridBoundColumn>

                                                            </Columns>
                                                        </telerik:GridTableView>
                                                    </DetailTables>
                                                </telerik:GridTableView>

                                            </DetailTables>

                                            <Columns>
                                                <telerik:GridBoundColumn DataField="Month" FilterControlAltText="Filter 

Division column"
                                                    HeaderText="Month">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="Year" FilterControlAltText="Filter 

Division column"
                                                    HeaderText="Year">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="ActualForecast" HeaderText="Actual($) "
                                                    UniqueName="ActualForecast">
                                                </telerik:GridBoundColumn>

                                                <telerik:GridBoundColumn DataField="BudgedForecast" HeaderText="Budged ($)"
                                                    UniqueName="BudgedForecast">
                                                </telerik:GridBoundColumn>

                                            </Columns>

                                        </MasterTableView>

                                    </telerik:RadGrid>

                                </NodeTemplate>
                            </telerik:RadTreeNode>
                        </Nodes>
                        
                    </telerik:RadTreeView>


#.CS 

 protected void treeViewClientBudget_NodeClick(object sender, RadTreeNodeEventArgs e)
    {
        for (int i = 0; i < treeViewClientBudget.Nodes.Count; i++)
        {
            if (i==e.Node.Index)
            {
                RadTreeNode budgetNode = treeViewClientBudget.Nodes[i].TreeView.FindNodeByText("BudgetNode");
                   RadGrid grid = (RadGrid)treeViewClientBudget.Nodes[i].FindControl("grdBudgetDetail");
            }
         
          
        }


Regards,
Saravanan M
Saravanan
Top achievements
Rank 1
 asked on 26 Apr 2013
1 answer
648 views
Hi all,

I have the following simple grid.

<telerik:RadGrid ID="grdMyGrid" runat="server" 
   AutoGenerateColumns="false"
   OnNeedDataSource="grdNewEpidomaTheshs_NeedDataSource">
   <MasterTableView EditMode="InPlace"  CommandItemDisplay="Top" 
      CommandItemSettings-AddNewRecordText="Add new record">
       
      <
NoRecordsTemplate>No records available</NoRecordsTemplate>
      <Columns> ... some columns ...</Columns>
   </MasterTableView>
</telerik:RadGrid>

All I want to do is hide the row containing the "add new record" when another row is in edit mode, i.e. when the edit button has been 
clicked
Giorgos
Top achievements
Rank 1
 answered on 26 Apr 2013
2 answers
58 views
Hi;

We would like to swap out the standard menu and use the ribbon menu instead. Is there a way to do this?

thanks - dave
David Thielen
Top achievements
Rank 1
 answered on 26 Apr 2013
3 answers
144 views
Hello,

I am creating a RadGrid programmatically in the Page_Init. One of my columns I need to use the GridTemplateColumn to show a text box. The text box will initially come up with a numeric value. The user has the ability to change the value in the text box. The value is required and needs to be an integer. Once they have typed their new value and focus is lost from the text box, I would like to gather some other information on the same row, run some javascript to show a message with not only the new value they typed in but some of the other information on the row. I cannot seem to figure out how to do this. I have it where the grid shows with the correct information and text box in the column. The user can change the value. Here is where I need help. Once the textbox loses focus I would like to do some javascript on the new value and other values associated to the row the textbox is on. Below is my code to create the columns.

Page_Init
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
    'CODEGEN: This method call is required by the Web Form Designer
    'Do not modify it using the code editor.
    InitializeComponent()
    defineGridStructure()
End Sub

defineGridStructure
Private Sub defineGridStructure()
    RadGrid1.ID = "RadGrid1"
    RadGrid1.Width = Unit.Pixel(1500)
    RadGrid1.MasterTableView.EditMode = GridEditMode.InPlace
    RadGrid1.AllowPaging = True
    RadGrid1.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric
    RadGrid1.AutoGenerateColumns = False
    RadGrid1.ShowStatusBar = True
    RadGrid1.AllowSorting = True
    RadGrid1.AllowFilteringByColumn = True
    RadGrid1.Skin = "WebBlue"
    RadGrid1.ClientSettings.ClientEvents.OnGridCreated = "GetGridObject"
    RadGrid1.ClientSettings.Scrolling.FrozenColumnsCount = 2
    RadGrid1.ClientSettings.AllowColumnsReorder = True
    RadGrid1.ClientSettings.ColumnsReorderMethod = GridClientSettings.GridColumnsReorderMethod.Swap
    RadGrid1.ClientSettings.Selecting.AllowRowSelect = True
    RadGrid1.ClientSettings.Resizing.AllowColumnResize = True
    RadGrid1.ClientSettings.Scrolling.AllowScroll = True
    RadGrid1.ClientSettings.Scrolling.UseStaticHeaders = True
    RadGrid1.ClientSettings.Scrolling.SaveScrollPosition = True
    RadGrid1.ClientSettings.Selecting.AllowRowSelect = True
    RadGrid1.ClientSettings.ClientEvents.OnRowSelected = "rowSelected"
    RadGrid1.MasterTableView.PageSize = 100
    RadGrid1.MasterTableView.AllowMultiColumnSorting = True
    RadGrid1.MasterTableView.DataKeyNames = New String() {"VendorListID"}
    columnCreation("Geography", "Geography", RadGrid1)
    columnCreation("Circ Type", "CirculationTypeDescription", RadGrid1)
    columnCreation("Household", "HouseHold_Count", RadGrid1)
    columnCreation("Total Cov", "TotalCoverage", RadGrid1)
    columnCreation("Day", "Day", RadGrid1)
    columnCreation("Selected", "Selected", RadGrid1)
    columnCreation("Circ", "Circ", RadGrid1)
    columnCreation("Coverage", "Coverage", RadGrid1)
    Me.PlaceHolder1.Controls.Add(RadGrid1)
End Sub

columnCreation
Private Sub columnCreation(ByVal colName As String, ByVal fieldName As String, ByVal oRadGrid As RadGrid)
    If colName = "Circ" Then
        Dim numericColumn = New GridTemplateColumn
        numericColumn.ItemTemplate = New MyEditTemplate(fieldName)
        numericColumn.DataField = fieldName
        numericColumn.HeaderText = colName
        numericColumn.UniqueName = fieldName
        numericColumn.FilterControlWidth = Unit.Pixel(60)
        oRadGrid.MasterTableView.Columns.Add(numericColumn)
   End If
End Sub

MyEditTemplate
Public Class MyEditTemplate
    Implements ITemplate
    Protected textBox As TextBox
    Private colname As String
    Public Sub New(ByVal cName As String)
        colname = cName
    End Sub
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
        textBox = New TextBox()
        textBox.ID = colname
        AddHandler textBox.DataBinding, _
                   AddressOf textBox_DataBinding
  
        container.Controls.Add(textBox)
    End Sub
    Sub textBox_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
        Dim cTextBox As TextBox = DirectCast(sender, TextBox)
        Dim container As GridDataItem = DirectCast(cTextBox.NamingContainer, GridDataItem)
        cTextBox.Text = (DirectCast(container.DataItem, DataRowView))(colname).ToString()
    End Sub
End Class

I use the RadGrid1_NeedDataSource to acquire the information from the database, and then use the RadGrid1_ItemDataBound to set the information up correctly.

RadGrid1_ItemDataBound
Public Sub RadGrid1_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound
    If (TypeOf (e.Item) Is GridDataItem) Then
        Dim dataBoundItem As GridDataItem = e.Item
        Dim dataRow As DataRowView = dataBoundItem.DataItem
        Dim index As Integer = dataBoundItem.ItemIndex
        dataBoundItem("Geography").Text = dataBoundItem("Geography").Text.Trim
    End If
End Sub

So, again, what I would like to do is have the user be able to change the value in my textbox. Validate that it is filled in and an integer. Then display an alert() to the user that the information has changed and give them the Geography, Circ Type and Day on the message.

I kind of do something like it with a checkbox template column.

MyTemplate
Public Class MyTemplate
    Implements ITemplate
    Protected boolValue As CheckBox
    Private colname As String
    Public Sub New(ByVal cName As String)
        colname = cName
    End Sub
    Public Sub InstantiateIn(ByVal container As System.Web.UI.Control) Implements ITemplate.InstantiateIn
        boolValue = New CheckBox()
        boolValue.ID = colname
        AddHandler boolValue.DataBinding, _
                   AddressOf boolValue_DataBinding
        boolValue.Enabled = True
        container.Controls.Add(boolValue)
    End Sub
    Sub boolValue_DataBinding(ByVal sender As Object, ByVal e As EventArgs)
        Dim cBox As CheckBox = DirectCast(sender, CheckBox)
        Dim container As GridDataItem = DirectCast(cBox.NamingContainer, GridDataItem)
        If ((DirectCast(container.DataItem, DataRowView))(colname)) = 1 Or ((DirectCast(container.DataItem, DataRowView))(colname)) = True Then
            cBox.Checked = True
        Else
            cBox.Checked = False
        End If
    End Sub
End Class
 and then in the RadGrid1_ItemDataBound
dataBoundItem("Selected").Attributes.Add("onClick", "javascript:return fnSelectDayForTelerik(" & index & "," & mode & "," & mintEventID & "," & circType & "," & day & "," & ddlCircSet.SelectedItem.Value & ",'" & mstrSessionID & "'," & Request("PARID") & ",'" & Trim(UCase(Request("TargetGeo"))) & "',0);")
dataBoundItem("Forced").Attributes.Add("onClick", "javascript:return fnSelectDayForTelerik(" & index & "," & mode & "," & mintEventID & "," & circType & "," & day & "," & ddlCircSet.SelectedItem.Value & ",'" & mstrSessionID & "'," & Request("PARID") & ",'" & Trim(UCase(Request("TargetGeo"))) & "',1);")

But if I try the same logic on my Circ dataBoundItem with a onChange or onBlur, nothing fires.
David Kucharski
Top achievements
Rank 1
 answered on 26 Apr 2013
1 answer
56 views
Does the TreeViewList support the ability to drag and drop documents onto the treeviewlist?  I would like to capture the path of the document being dragged, and get the location of the node where it is being dropped.

Please let me know.

Thanks,
Pavlina
Telerik team
 answered on 26 Apr 2013
25 answers
2.8K+ views
The ContentType (aka MIME) is coming in as application/octet-stream, no matter what browser I'm using (IE8, FF, Chrome, etc).  I can't figure out why.  Any input is greatly appreciated.

Thanks,
Chris
p
Top achievements
Rank 1
 answered on 26 Apr 2013
2 answers
140 views
This is probally easy question for somebody but I am a little green to Telerik and Ajax.  I have a radlistbox bound to a datasource, it has 3 fields, id, desc and flag.  I have it populating just fine but what fires the automatic update event?  All the items that are flag are on or off as they should be but when I click the checkbox to turn an item on or off the listbox doesn't even appear to do anything.  Do I need some code behind other than automatic updates = true and post back = true to make the update to the checkbox save to the database? 

            <telerik:RadListBox ID="lbOrgLevels" runat="server" DataSourceID="sqlGetOrgLevels" DataKeyField="OrgLevelID" CheckBoxes ="true" style="top: 0px; left: 0px; width: 459px" OnItemDataBound="lbOrgLevels_ItemDataBound" AllowAutomaticUpdates="True" AutoPostBack="True" Skin="Sitefinity" DataSortField="OrgLevelDescription" DataTextField="OrgLevelDescription" DataValueField="Active">
            </telerik:RadListBox>

            <UpdateParameters>
                <asp:Parameter Direction="Input" Name="Active" Type="Boolean"></asp:Parameter>
                <asp:Parameter Direction="Input" Name="OrgLevelID" Type="Int32"></asp:Parameter>
            </UpdateParameters>

Protected Sub lbOrgLevels_ItemDataBound............
        e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelID").ToString().Trim() _
                 + "- " + (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelDescription").ToString().Trim()

        e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.Checked = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.DataBind()
End Sub


thanks for any help.
Nencho
Telerik team
 answered on 26 Apr 2013
1 answer
119 views
Is there any way to add a sliding label that follows the pointer on a linear gauge and be updated with the value of pointer?  If the functionality is not built into the control, are there any ideas on how to accomplish this? 

Thanks for any help offered.
Danail Vasilev
Telerik team
 answered on 26 Apr 2013
2 answers
349 views
Hi,

I have a RadTreeView inside a RadPane, I am setting the radtreeview height and width to that of radpane on radsplitters OnClientLoad and OnClientResized events (see code below). I have a search functionality to search a root node on the page and want to use the ScrollIntoView method of Radtreeview to scroll to the searched node but I am unable to see the scrollbar when I set the radtreeview height this way, Please let me know how can i use ScrollIntoView in this scenario.

<telerik:RadPane ID="LeftTreePane" runat="server" Width="300" Scrolling="Y" CssClass="treePaneStyle" BackColor="#93C9C3">
 <telerik:RadSplitter ID="LeftSplitter" runat="server" Orientation="Horizontal" OnClientLoad="ResizeTreeView" OnClientResized="ResizeTreeView">
    <telerik:RadPane ID="SearchPane" runat="server" Scrolling="Y" Height="70">
    <asp:Panel ID="EleSearchPanel" runat="server" CssClass="searchPanelStyle">
    <asp:Label ID="searchLabel" runat="server" Text="Search:" Width="40px"></asp:Label>
    <telerik:RadTextBox ID="SearchText" runat="server"></telerik:RadTextBox>
      
    <telerik:RadButton ID="SearchBtn" runat="server" AutoPostBack="true" Text="Search" Width="40px" OnClientClicking="selectNode"></telerik:RadButton>
      
    </asp:Panel>
    </telerik:RadPane>
    <telerik:RadSplitBar ID="leftSplitBar" runat="server" CollapseMode="None">
    </telerik:RadSplitBar>
    <telerik:RadPane ID="TreePane" runat="server" Scrolling="None">
     
    <telerik:RadTreeView runat="server" ID="ElementTreeView" OnNodeExpand="ElementTreeView_NodeExpand" OnNodeClick="ElementTreeView_NodeClick" OnContextMenuItemClick="ElementTreeView_ContextMenuItemClick" CssClass="radtreeStyle">
     
                 <ContextMenus>
                <telerik:RadTreeViewContextMenu ID="ElementCM" runat="server" >
                <Items>
                  
                </Items>
                </telerik:RadTreeViewContextMenu>
                 <telerik:RadTreeViewContextMenu ID="COCM" runat="server">
                <Items>
</Items>
                </telerik:RadTreeViewContextMenu>
 
                </ContextMenus>
    </telerik:RadTreeView>
     
    </telerik:RadPane>
    </telerik:RadSplitter>
</telerik:RadPane>
  
function ResizeTreeView(splitter, args) {
            var pane = $find("<%= LeftTreePane.ClientID %>");
            var width = pane.get_width();
            var treepane = $find("<%= TreePane.ClientID %>");
            var height = treepane.get_height();
            var treeview = $find("<%= ElementTreeView.ClientID %>");
            treeview.width = width + "px";
            treeview.height = height + "px";
        }
  
 function selectNode(sender, args) {
            var treeView = $find("<%= ElementTreeView.ClientID %>");
            var searchTBox = $find("<%= SearchText.ClientID %>");
 
            var searchtext = searchTBox._text;
            var node = treeView.findNodeByText(searchtext);
            if (node) {
                var menu = node.get_contextMenuID();
                if (menu == 'COCM') {
                    node.set_selected(true);
                    //node.expand();
                    scrollToNode(treeView, node);
                    args.set_cancel(true);
                }
                else {
                    alert(searchtext + "' could not be found.");
                }
            }
            else {
                alert(searchtext + "' could not be found.");
            }
        }



Not sure if it matters but I am using load on demand to load the nodes.

Thanks,
Arati
AratiS
Top achievements
Rank 1
 answered on 26 Apr 2013
3 answers
448 views
Hi,
We have a RadButton with Target property set to "_blank".  In the OnClick method we have Response.Redirect("www.google.com").

But the requested url is not opening in new window. Any suggestion is appreciated. Thanks in advance.
Danail Vasilev
Telerik team
 answered on 26 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?