Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
692 views

Once again, i find your documentation and demos so convoluted that I have given up trying to make any sense out it.

I am again trying to accomplish a very simple thing: make a hierarchical grid out of a simple, 2-table relational dataset.

All I wish to do is to create a simple parent-child hierachy in a RadGrid, using an ADO DataSet object containing 2 tables, with a DataRelation already added to the DataSet, which should be enough to establish a parent-child relationship.

Here is dummy code that creates the DataSet:

 

 

 

DataTable dt1 = new DataTable();

 

 

 

DataTable dt2 = new DataTable();

 

 

 

DataSet ds = new DataSet();

 

 

 

DataRow myRow;

 

 

dt1.Columns.Add(

"Period");

 

 

dt1.Columns.Add(

"Period_Name");

 

 

dt2.Columns.Add(

"Period");

 

 

dt2.Columns.Add(

"File_Name");

 

 

dt2.Columns.Add(

"Size");

 

 

 

 

myRow = dt1.NewRow();

 

myRow[

"Period"] = "60";

 

 

myRow[

"Period_Name"] = "April 2011";

 

 

dt1.Rows.Add(myRow);

 

myRow = dt1.NewRow();

 

myRow[

"Period"] = "59";

 

 

myRow[

"Period_Name"] = "March 2011";

 

 

dt1.Rows.Add(myRow);

 

myRow = dt1.NewRow();

 

myRow[

"Period"] = "58";

 

 

myRow[

"Period_Name"] = "February 2011";

 

 

dt1.Rows.Add(myRow);

 

myRow = dt1.NewRow();

 

myRow[

"Period"] = "57";

 

 

myRow[

"Period_Name"] = "January 2011";

 

 

dt1.Rows.Add(myRow);

 

myRow = dt2.NewRow();

 

myRow[

"Period"] = "60";

 

 

myRow[

"File_Name"] = "User_60_123456_1.pdf";

 

 

myRow[

"Size"] = "923324";

 

 

dt2.Rows.Add(myRow);

 

myRow = dt2.NewRow();

 

myRow[

"Period"] = "60";

 

 

myRow[

"File_Name"] = "User_60_123456_2.pdf";

 

 

myRow[

"Size"] = "433324";

 

 

dt2.Rows.Add(myRow);

 

myRow = dt2.NewRow();

 

myRow[

"Period"] = "60";

 

 

myRow[

"File_Name"] = "User_60_123456_3.pdf";

 

 

myRow[

"Size"] = "693324";

 

 

dt2.Rows.Add(myRow);

 

ds.Tables.Add(dt1);

 

ds.Tables.Add(dt2);

 

 

DataRelation dRel = new DataRelation("Period_to_PDF", ds.Tables[0].Columns["Period"],

 

 

ds.Tables[1].Columns[

"Period"]);

 

 

ds.Relations.Add(dRel);


Table #1 (dt1) is the parent DataTable, containing "periods"
Table #2 (dt2) is the child DataTable containing "files relating to a period"

Only Period #60 has child rows in dt2 in this example.

HOW DO I USE THIS DATASET TO CREATE A HIERARCHICAL RADGRID???????????????????? IS IT EVEN POSSIBLE?

I would think that simply binding it to a grid would do it, but apprently RadGrid is not very smart, since it does not recognize the DataRelation object in the DataSet    

(I yearn for the days of desktop grid control that handled all of that for you if you created a properly related dataset.




Pavlina
Telerik team
 answered on 22 Jun 2012
3 answers
133 views
Hi,
    I have an issue with radcombo. In my home page , i am using RadComo . The problem comes when i Used a Javascript in Page Load with  " document.forms[0].submit() " . After using this , combo will look like ReadOnly mode.
Pleas help...

Thanks in Advance
Jesmon Joseph
Kalina
Telerik team
 answered on 22 Jun 2012
1 answer
102 views
Hi.

I have a radwindow pop up where the user can add a new user.  

User is getting created & within my OnClientclose I am trying to rebind the dropdownlist of users & select the new one.  I have the id needed at this point but am having difficulty locating the control.  

Are there any examples of finding such objects within the EditItemTemplate?

Once I find the dropdownlist control I will need to rebind it & set the newly selected value.  


Thanks.
Marin
Telerik team
 answered on 22 Jun 2012
3 answers
115 views
Hello,

I am trying to set up a RadComboBox as follows:

<telerik:RadComboBox ID="rcbEntities" runat="server" Width="440px" Height="140px"

                                ShowToggleImage="False" EmptyMessage="Start Typing..." MinFilterLength="3" EnableLoadOnDemand="true"

                                ShowMoreResultsBox="True" EnableVirtualScrolling="True" HighlightTemplatedItems="True"

                                OnClientSelectedIndexChanged="rcbEntities_SelectedIndexChanged"

                                OnClientItemsRequested="rcbEntities_ClientItemsRequested">

                                <WebServiceSettings Method="GetEntities" Path="~/TestService.svc" />

                            </telerik:RadComboBox>


Everything works fine as long as the WCF service is in the same project as the aspx page containing the control. However, I'd like to be able to pull data from a service hosted on the same server, but under a different site in IIS, together with all the other data services in the company.

Do you have a detailed example of a simple service that is defined in a separate VS project / IIS site and is being called from a RadComboBox to perform autocomplete ?


Thanks!
Daniel
Genady Sergeev
Telerik team
 answered on 22 Jun 2012
3 answers
96 views
How to translate the "drop files here" message?

Thanks,
Martin
Plamen
Telerik team
 answered on 22 Jun 2012
3 answers
131 views
I want to access controls inside RadGrid's EditFormTemplate from page_load (not from RadGrid1_ItemDataBoundRadGrid1_UpdateCommand or any other "events" ), or something like this  ... is this possible?
Shinu
Top achievements
Rank 2
 answered on 22 Jun 2012
2 answers
147 views
Hi,

I open a RadWindow to display a Radgrid as a modal popup. The Radgrid has a GridDateTimeColumn which displays a calender picker in Insert and Edit modes. The Calender picker does not show up when the grid is placed in the RadWindow popup. It works fine when used in regular .aspx page.
Could you please help?

Thanks
Meera
Meera
Top achievements
Rank 1
 answered on 22 Jun 2012
3 answers
423 views
I am trying to add filters to a RadGrid and am encountering a bug when filtering numeric columns.

Only for columns which are numeric (Int32 for Plant and Demand in this case), the filter does not apply on the first try.  After page load, the first filter on a numeric column simply has no effect.  Any subsequent filter attempt works properly.

This bug does not occur on the date columns nor string columns, as they filter properly.

The data is being loaded by an data object during the NeedDataSource event.  This is the only code behind at the moment. 
I am using the most up to date Telerik with ASP.NET 3.5.

Please see code snippet below:

<telerik:RadGrid runat="server"
    ID="grdOrders" 
    AllowPaging="True"
    AllowSorting="True"
    Skin="Web20"
    onneeddatasource="grdOrders_NeedDataSource"
    GroupingSettings-CaseSensitive="false"
    AllowFilteringByColumn="true"
    >
 
    <MasterTableView AutoGenerateColumns="False"  >
        <Columns>
            <telerik:GridNumericColumn
                DataField="PlantID"
                HeaderText="Plant #"
                AutoPostBackOnFilter="true"
                CurrentFilterFunction="Contains"
                ShowFilterIcon="false"
                SortExpression="PlantID"
                UniqueName="PlantID"
                DataType="System.Int32"
                >
            </telerik:GridNumericColumn>
 
            <telerik:GridBoundColumn
                DataField="Demand"
                HeaderText="Demand"
                AutoPostBackOnFilter="true"
                CurrentFilterFunction="Contains"
                ShowFilterIcon="false"
                SortExpression="Demand"
                UniqueName="Demand"
                DataType="System.Int32"
                >
            </telerik:GridBoundColumn>
 
            <telerik:GridDateTimeColumn
                DataField="OrderEntryDate"
                HeaderText="Order Date"
                CurrentFilterFunction="EqualTo" ShowFilterIcon="false"
                DataFormatString="{0:MM/dd/yyyy}"
                PickerType="DatePicker"
                FilterControlWidth="95px"
                AutoPostBackOnFilter="true"
                SortExpression="OrderEntryDate"
                UniqueName="OrderEntryDate">
            </telerik:GridDateTimeColumn>
 
            <telerik:GridBoundColumn
                DataField="CreatedBy"
                HeaderText="Created By"
                AutoPostBackOnFilter="true"
                CurrentFilterFunction="Contains"
                ShowFilterIcon="false"
                UniqueName="CreatedBy">
            </telerik:GridBoundColumn>
        </Columns>
    </MasterTableView>
 
    <ClientSettings AllowColumnsReorder="True" ReorderColumnsOnClient="True">
    </ClientSettings>
</telerik:RadGrid>

Thanks,
Andy
Shinu
Top achievements
Rank 2
 answered on 22 Jun 2012
4 answers
232 views
Hello Telerik Team,

Being new to this tool, I hava requirement where by I have a Rad Grid and when I submit / click Add new Record button the text boxes to be filled automatically after some calculated values from the previous rows.

Please help in this this issues as ItemCommand is not allowing me to have access to the text boxes.

Regards
SS Bhogal
Sukhbinder
Top achievements
Rank 1
 answered on 22 Jun 2012
6 answers
483 views
Hi I am using the following code to display self referencing heirarchy and it is working fantastic. My problem is when I enable paging and go to the second page or any other page then I cannnot get the datakeyvalue for the row and it crashes.
This is the markup I am using  :
<telerik:RadTreeList runat="server" ID="tvwApp" AllowPaging="true" 
        DataKeyNames="AppID" OnItemCommand="RadTreeList1_ItemCommand" AutoGenerateColumns="false"
        OnPageSizeChanged="RadTreeList1_PageSizeChanged" OnPageIndexChanged="RadTreeList1_PageIndexChanged"
        ParentDataKeyNames="HistoricalappID" Skin="Windows7" EnableEmbeddedSkins="true"
        ItemStyle-Height="30px" AlternatingItemStyle-Height="30px" AllowSorting="true"
        HeaderStyle-Height="30px" AlternatingItemStyle-BackColor="WhiteSmoke" 
            GridLines="Horizontal">
<AlternatingItemStyle BackColor="WhiteSmoke" Height="30px"></AlternatingItemStyle>
  
<ItemStyle Height="30px"></ItemStyle>
        <Columns>
            <telerik:TreeListBoundColumn HeaderText="Reference No" DataField="AppRefNo" >
                <HeaderStyle Width="100px"></HeaderStyle>
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn HeaderText="Applicant" DataField="LOTRPNo" HeaderStyle-Width="35%" >
                  
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn HeaderText="UDA" DataField="ULDA">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn SortExpression="DatePropMade" HeaderText="Date Properly Made"
                DataField="DatePropMade" DataFormatString="{0:d}">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn SortExpression="DateDecision" HeaderText="Decisione Due"
                DataField="DateDecision" DataFormatString="{0:d}">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn SortExpression="StatusName" HeaderText="Status" DataField="StatusName" UniqueName="StatusName">
            </telerik:TreeListBoundColumn>
            <telerik:TreeListBoundColumn SortExpression="IsPNRequired" HeaderText=" " DataField="IsPNRequired" UniqueName="IsPNRequired" HeaderStyle-Width="0px" ItemStyle-Width="0px" ItemStyle-Font-Size="1px">
<HeaderStyle Width="0px"></HeaderStyle>
  
<ItemStyle Font-Size="1px" Width="0px"></ItemStyle>
            </telerik:TreeListBoundColumn>
            <telerik:TreeListTemplateColumn HeaderStyle-Width="60px" HeaderText="Edit">
                <ItemTemplate>
                    <telerik:RadButton ID="SelectButton" runat="server" CommandName="Edit" Text="Edit"
                        ItemStyle-CssClass="edit" Width="50px" />
                </ItemTemplate>
  
<HeaderStyle Width="60px"></HeaderStyle>
            </telerik:TreeListTemplateColumn>
            <telerik:TreeListTemplateColumn HeaderStyle-Width="60px" HeaderText="Copy">
                <ItemTemplate>
                    <telerik:RadButton ID="RadButton1" runat="server" CommandName="Copy" Text="Copy"
                        ItemStyle-CssClass="copy" Width="50px" />
                </ItemTemplate>
  
<HeaderStyle Width="60px"></HeaderStyle>
            </telerik:TreeListTemplateColumn>
        </Columns>
  
<HeaderStyle Height="30px"></HeaderStyle>
    </telerik:RadTreeList>

and the code behind is :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
  
        If Not IsPostBack Then
            tvwApp.DataSource = LoadData(txtSearch.Text)
            tvwApp.DataBind()
            tvwApp.ExpandToLevel(1)
            txtSearch.Focus()
            CreateMenu()
            btnAddNew.Text = "Add New Application"
  
            DisplayAppDetailsHeader()
        End If
  
    End Sub
  
    Public Sub RadTreeList1_ItemCommand(ByVal sender As Object, ByVal e As TreeListCommandEventArgs) Handles tvwApp.ItemCommand
  
        If e.CommandName = RadTreeList.ExpandCollapseCommandName Then
            tvwApp.DataSource = LoadData(txtSearch.Text)
            tvwApp.DataBind()
        End If
  
        If (e.Item.ItemType = TreeListItemType.Item Or e.Item.ItemType = TreeListItemType.AlternatingItem) Then
            Dim item As TreeListDataItem = DirectCast(e.Item, TreeListDataItem)
            Dim APPID As String = item.OwnerTreeList.DataKeyValues(item.DataItemIndex)("AppID").ToString()
  
            If e.CommandName = "Copy" Then
                Response.Redirect(_apppath + "copy.aspx?ID=" & APPID & "&tabId=tab1&Action=PREAPP")
            ElseIf e.CommandName = "Edit" Then
                Response.Redirect(_apppath + "process.aspx?ID=" & APPID & "&tabId=tab1&Action=PREAPP")
            End If
        End If
    End Sub
  
  
Protected Sub RadTreeList1_PageIndexChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.TreeListPageChangedEventArgs)
        tvwApp.CurrentPageIndex = e.NewPageIndex
        tvwApp.DataSource = LoadData(txtSearch.Text)
        tvwApp.DataBind()
    End Sub
    Protected Sub RadTreeList1_PageSizeChanged(ByVal source As Object, ByVal e As Telerik.Web.UI.TreeListPageSizeChangedEventArgs)
        tvwApp.DataSource = LoadData(txtSearch.Text)
        tvwApp.DataBind()
    End Sub

This is the error that get when I go to page 2 or any other page except page 1
Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index
  
'error occurs on  this line
  Dim APPID As String = item.OwnerTreeList.DataKeyValues(item.DataItemIndex)("AppID").ToString()

any help would be most appreciated.
many thanks
Princy
Top achievements
Rank 2
 answered on 22 Jun 2012
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?