Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
153 views
Hello All,

I have created a tree dynamically. CreateTreeView() is called in createchildcontorls and I am populating the tree in PreRender.
When I click on any tree node, the page just postbacks but NodeClick event is not firing. \

private void CreateTreeView()
{
treeViewPane.ID = "TreeViewPane";
treeViewPane.Width = new Unit("150px");
treeView = new RadTreeView();
treeView.Nodes.Clear();
treeView.NodeClick += new RadTreeViewEventHandler(treeView_NodeClick);
treeViewPane.Controls.Add(treeView);
}

Could someone please help me.

Regards
Rajeev
Plamen
Telerik team
 answered on 22 Jul 2011
3 answers
101 views
HI I HAVE A RADDATECOLUMN ON MY GRID.I BIND IT WITH EF QUERY.BUT GRIDDATE COLUM CANT FILTERED IT CORRECTLY COLLACITON IS TURKISH_CI_AS
<telerik:RadGrid ID="grdSales" runat="server" AutoGenerateColumns="False" GridLines="None"
                    Height="350px" AllowPaging="True" EnableEmbeddedSkins="False"
                    Skin="customGrid" AllowFilteringByColumn="True">
                    <GroupingSettings CaseSensitive="False" />
                    <ClientSettings>
                        <Selecting AllowRowSelect="True" />
                    </ClientSettings>
                    <MasterTableView NoMasterRecordsText=""  AllowFilteringByColumn="True">
                        <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
                        <RowIndicatorColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </RowIndicatorColumn>
                        <ExpandCollapseColumn>
                            <HeaderStyle Width="20px"></HeaderStyle>
                        </ExpandCollapseColumn>
                        <Columns>
                            <telerik:GridDateTimeColumn AutoPostBackOnFilter="True" DataField="SALESDATE" SortExpression="SALESDATE"
                                DataFormatString="{0:dd/MM/yyyy}" UniqueName="SALESDATE" PickerType="None">
                            </telerik:GridDateTimeColumn>
                        </Columns>
                        <EditFormSettings>
                            <EditColumn InsertImageUrl="Update.gif" UpdateImageUrl="Update.gif" EditImageUrl="Edit.gif"
                                CancelImageUrl="Cancel.gif">
                            </EditColumn>
                        </EditFormSettings>
                    </MasterTableView>
                    <FilterMenu EnableEmbeddedSkins="False">
                    </FilterMenu>
                    <HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Default">
                    </HeaderContextMenu>
                </telerik:RadGrid>
Teoman
Top achievements
Rank 1
 answered on 22 Jul 2011
6 answers
283 views
I have a EditFormSettings FormTemplate inside a RadGrid that contains two comboboxes:
(Looks something like this):
<FormTemplate> 
                    <table> 
                        <tr> 
                            <td> 
                                Inventory Name: 
                            </td> 
                            <td> 
                                <telerik:RadComboBox SelectedValue='<%# Bind( "InventoryId") %>' ID="RadComboBoxInventoryName" runat="server" Height="300px" Width="300px" 
                                    Filter="Contains" MarkFirstMatch="true" ChangeTextOnKeyBoardNavigation="false" 
                                    DataSourceID="ObjectDataSourceInventoryName" DataTextField="Name" DataValueField="InventoryId" AutoPostBack="true"> 
                                    <Items> 
                                        <telerik:RadComboBoxItem Text="" Value="" Selected="true" /> 
                                    </Items> 
                                </telerik:RadComboBox> 
                            </td> 
                        </tr> 
                        </tr> 
                            <tr> 
                            <td> 
                                Attribute: 
                            </td> 
                            <td> 
                                <telerik:RadComboBox Text='<%# Bind( "Attribute") %>' ID="RadComboBoxAttribute" runat="server" Height="300px" Width="300px" 
                                    Filter="Contains" MarkFirstMatch="true" ChangeTextOnKeyBoardNavigation="false" 
                                    DataSourceID="ObjectDataSourceAttribute" DataTextField="Attribute" DataValueField="Attribute" AutoPostBack="true"> 
                                    <Items> 
                                        <telerik:RadComboBoxItem Text="" Value="" Selected="true" /> 
                                    </Items> 
                                    <ItemTemplate> 
                                        <%# DataBinder.Eval(Container.DataItem, "Type")%>.<%# DataBinder.Eval(Container.DataItem, "Attribute")%> 
                                    </ItemTemplate> 
                                </telerik:RadComboBox> 
                            </td> 
                        </tr> 
                        <tr> 
                            <td align="left" colspan="2"> 
                                <asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>' 
                                    runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'> 
                                </asp:Button>&nbsp; 
                                <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" 
                                CommandName="Cancel"></asp:Button></td> 
                        </tr> 
                    </table> 
                </FormTemplate> 
Simple enough... There are two RadComboBoxes with two different ObjectDataSources applied. The ObjectDataSources look like this:
    <asp:ObjectDataSource ID="ObjectDataSourceInventoryName" runat="server"  
        TypeName="Ams.Web.BackOffice.InventoryAdapter"  
        DataObjectTypeName="Ams.Core.DomainObject.Inventory"  
        OldValuesParameterFormatString="original_{0}" 
        ConflictDetection="CompareAllValues" 
        SelectMethod="GetInventoryForComboBox"> 
     </asp:ObjectDataSource> 
 
    <asp:ObjectDataSource ID="ObjectDataSourceAttribute" runat="server"  
        TypeName="Ams.Web.BackOffice.InventoryTypeAttributesAdapter"  
        DataObjectTypeName="Ams.Core.DomainObject.InventoryAttribute_InventoryType"  
        OldValuesParameterFormatString="original_{0}" 
        ConflictDetection="CompareAllValues"  
        SelectMethod="GetAttributeByInventoryId"> 
<SELECTPARAMETERS> 
                <asp:ControlParameter Name="aInventoryId" PropertyName="SelectedValue" ControlID="RadComboBoxInventoryName" /> 
            </SELECTPARAMETERS> 
     </asp:ObjectDataSource> 
             

Note, the ObjectDataSource of interest is the second, as it has a dependency on the first for one of its SelectParameters. When the page loads, I get an error stating:

Could not find control 'RadComboBoxInventoryName' in ControlParameter 'aInventoryId'.

Basically, it reports that it cannot find the control for the aInventoryId parameter (as its not rendered on the page yet).
Is it possible to use ObjectDataSources with parameter dependencies inside an edit form? If not, is there a work around?
Thanks in advance,
Tim
PS. I've tried the $ sign trick some other have posted.. No dice. (Inspected the client "name" attribute for the input control of the RadComboBox --

ctl00$ContentPlaceHolderBody$mImportMappingGrids$RadGridOrigin$ctl00$ctl07$RadComboBoxInventoryName

Nope...
Dimitar Terziev
Telerik team
 answered on 22 Jul 2011
1 answer
93 views
I have a WCF services that expose a function List<MyDataDTO> FindPagedData(pageIndex, pageCount).

If I want to use Virtual scolling and page, I need to expose a function Int32 GetTotalItemCount()?

Which is the better strategy/solutions?

And about Filtering feature, how can I work using VirtualItemCount?

Thanks.

Genti
Telerik team
 answered on 22 Jul 2011
3 answers
458 views
Hi, I am new to this forum and new to rad controls. I have spent a little time on understanding the usage of these control and no trying to implement one.

I have a radgrid binded to a datatable(code behind). I would like to display dropdown for a column(say Prefix) with prefilled values from another datatable when in Edit Mode. I tried using GridDropDownColumn this does not display data for that column but does gives me a dropdown control in Edit mode.

I have the grid this way.
-----------------------------Control---------------------------------------------
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="true" OnNeedDataSource="RadGrid1_NeedDataSource"
                AllowSorting="true" GridLines="None" PageSize="5" Skin="Web20"
        Width="80%" onpageindexchanged="RadGrid1_PageIndexChanged"
        onpagesizechanged="RadGrid1_PageSizeChanged"
        OnUpdateCommand="RadGrid1_UpdateCommand"
        onitemdatabound="RadGrid1_ItemDataBound">
                <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
                    <Selecting AllowRowSelect="true" />
                    <Resizing AllowColumnResize="True" AllowRowResize="false" ResizeGridOnColumnResize="false"
                    ClipCellContentOnResize="true" EnableRealTimeResize="false" AllowResizeToFit="true" />
                </ClientSettings>
                <MasterTableView Width="100%" AutoGenerateColumns="false" >
                    <Columns>
                        <telerik:GridButtonColumn CommandName="Edit" Text="Edit" UniqueName="Edit">
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn CommandName="Replace" Text="Replace" UniqueName="Replace">
                        </telerik:GridButtonColumn>
                        <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="Delete">
                        </telerik:GridButtonColumn>
                        <telerik:GridBoundColumn DataField="P" HeaderText="Prefix">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="FN" HeaderText="FirstName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="MN" HeaderText="MiddleI">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="LN" HeaderText="LastName">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="SchoolName" HeaderText="LocatedAt">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn DataField="PersonID" HeaderText="PersonID" Visible="false" UniqueName="PersonID">
                        </telerik:GridBoundColumn>
                    </Columns>
                </MasterTableView>
                <PagerStyle Mode="NextPrevAndNumeric" />

            </telerik:RadGrid>
-----------------------------CodeBehind---------------------------------------------
Page Load :-
RadGrid1.DataSource = dsAdminInfo.Tables[0];<br>
RadGrid1.DataBind();


 protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = ((DataSet)Session["AdminInfo"]).Tables[0];
        }

protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
        {
            if ((e.Item is GridEditFormItem) && (e.Item.IsInEditMode))
            {
                GridEditFormItem editform = (GridEditFormItem)e.Item;
                editform["PersonID"].Parent.Visible = false;
        }
Marin
Telerik team
 answered on 22 Jul 2011
1 answer
74 views
Hi All,

      In my page i have radtreeview, radgrid and dropdown list above the radgrid.
      Please find the attached screen shot of my page. My scenario is when i select filter in dropdownlist i want to bind radgrid based on 2 different dates. Please provide any help or link how can i follow this scenario.


Thanks,
Nagendra.
   
Princy
Top achievements
Rank 2
 answered on 22 Jul 2011
2 answers
89 views
I have a set of hierarchical data I am binding to a Tree List control. The source data contains 900 total rows with 227 of the being roots resulting in a long original list plus each branch can have sometimes 6 levels.

The tree list is:
1) very slow to load initially
2) very slow to expand children when expand button clicked (postback to server is slow but grid/page painting is instant)
3) focus does not go to the node that was expanded

Here's some info from the trace log

aspx.page Begin Load 0.000159517480573648 0.000017
Start OnNeedDataSource 0.000180190499071809 0.000021
Start database call 0.00020058415245513 0.000020
Finish database call 6.53778594765536 6.537585
Start generation of parent ids 6.53783343972488 0.000047
Finish generation of parent ids 6.56655440845135 0.028721
Finish OnNeedDataSource 6.56660441480691 0.000050
aspx.page End Load 14.5043473402346 7.937743


Please advise how i can speed up the performance of the grid. I read posts about Tree View having load on demand features but couldn't find documentation for the same feature for Tree List.
Sebastian
Telerik team
 answered on 22 Jul 2011
0 answers
127 views
Hi,

I'm only posting this to help other users on the forum.

I was using the RadGrid and I had one page out of many where calling the DataBind() method would take 30 seconds to run on 192 records. Other pages with double that and more columns wheren't taken that much.

I solved the issue when I found that one of the datafield values was "Task Name" instead of "TaskName". The real datafield name was "TaskName"  so the incorrect field name  caused it to take more time. As soon as I corrected the datafield value, the grid ran normally and was binding within 2 seconds.

Hope this helps someone. I'm using version 2011.1.519.40
Gerry
Top achievements
Rank 1
 asked on 22 Jul 2011
2 answers
339 views
Hello, all

I'm trying to tie into the OnClientKeyPressed event of the RadCombobox (really wished you had an onclientkeyup event, but...). My RadCombobox is in a grid, which makes it difficult to assess its ClientID. I've been scouring through the Client-Side-API, which implies I could just reference the ClientID, or the ID, however both of these are returning "undefined". Since it is an OnKeyPressed event, I could just set a reference to the control, and then do some jquery to tie into the OnKeyUp event on client-side, but this seems "hacky". I wanted to know if there is a more "blessed" solution. My code is as follows:

 

<script language="javascript" type="text/javascript"> 
  
   
  
function getAutocompleteItems(sender, eventArgs) {
  
    alert(sender.ClientID)  // returns "undefined" 
  
   
  
    alert(sender.ID) // returns "undefined" 
  
    //var cboItem = new Telerik.Web.UI.RadComboBoxItem(); 
  
    //cboItem.set_text("Help... somebody!!!"); 
  
    sender.trackChanges();
  
   
  
    var items = sender.get_items()
  
    for (var i = 0; i < items.get_count(); i++) {
  
        if (!items.getItem(i).get_text().toLowerCase().indexOf(sender.get_text().toLowerCase()) == 0) {
  
        items.remove(items.getItem(i));
  
        }
  
    }
  
    //sender.get_items().add(cboItem); 
  
    sender.commitChanges();
  
}
  
</script>
<telerik:GridTemplateColumn DataField="LineItem" UniqueName="grdColHostIDDef"> 
  
<HeaderStyle Width="0%" HorizontalAlign="Center"/> 
  
<ItemStyle HorizontalAlign="Center" Width="0%" VerticalAlign="Top" /> 
  
<ItemTemplate> 
  
<span class="validatable"><telerik:RadComboBox runat="server" ID="ddlHostValue" 
  
 CollapseAnimation-Duration="1" 
  
ExpandAnimation-Duration="1" 
  
ExpandAnimation-Type="Linear" 
  
AllowCustomText="true" 
  
CausesValidation="false" 
  
DataSourceID="HostTypeDataSource" 
  
DataTextField="Value" 
  
DataValueField="Value" 
  
OnClientKeyPressing="getAutocompleteItems" 
  
/> 
  
</telerik:GridTemplateColumn> 
  
  
Shinu
Top achievements
Rank 2
 answered on 22 Jul 2011
1 answer
102 views
Hi all,

According your demo on usibng web services to load data on demand:

http://demos.telerik.com/aspnet-ajax/combobox/examples/populatingwithdata/autocompletesql/defaultcs.aspx


if I remove the 'static' code from the method in the code behind CS page I get the error :

"The server method has failed' as a popup box.

Here is my code behind:

public const int ItemsPerRequest = 10;
 
       [WebMethod]
       public  RadComboBoxData GetDealNumbers(RadComboBoxContext context)
       {
           DataTable data = GetData(context.Text);
            
           RadComboBoxData comboData = new RadComboBoxData();
           int itemOffset = context.NumberOfItems;
           int endOffset = Math.Min(itemOffset + ItemsPerRequest, data.Rows.Count);
           comboData.EndOfItems = endOffset == data.Rows.Count;
 
 
           List<RadComboBoxItemData> result = new List<RadComboBoxItemData>(endOffset - itemOffset);
 
 
           for (int i = itemOffset; i < endOffset; i++)
           {
               RadComboBoxItemData itemData = new RadComboBoxItemData();
               itemData.Text = data.Rows[i]["DealNo"].ToString();
               itemData.Value = data.Rows[i]["DealNo"].ToString();
               result.Add(itemData);
           }
                       
           comboData.Message = GetStatusMessage(endOffset, data.Rows.Count);
 
 
           comboData.Items = result.ToArray();
           return comboData;
 
 
       }
 
 
       public  DataTable GetData(string text)
       {
           
           SqlDataAdapter adapter = new SqlDataAdapter("SELECT new_name as 'DealNo' from new_dealtracking WHERE new_name  LIKE @text + '%'", Properties.Settings.Default.MSCRMConnectionString);
            
           
            
           adapter.SelectCommand.Parameters.AddWithValue("@text", text);
 
 
           DataTable data = new DataTable();
           adapter.Fill(data);
 
 
           return data;
       }
 
 
       private  string GetStatusMessage(int offset, int total)
       {
           if (total <= 0)
               return "No matches";
            
           return String.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", offset, total);
       }
:

My aspx code is:

<telerik:RadComboBox ID="RadComboBox4" runat="server" Width="157px" Height="150px"
               EmptyMessage="Select a Deal" EnableLoadOnDemand="true" ShowMoreResultsBox="true"
               EnableVirtualScrolling="true">
            
               <WebServiceSettings Method="GetDealNumbers" Path="Custom_DealUI.aspx" />
           </telerik:RadComboBox>

Why is this the case??
Kevin
Top achievements
Rank 2
 answered on 22 Jul 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?