Telerik Forums
UI for ASP.NET AJAX Forum
5 answers
57 views
I have found that, when you have only 2 items in the returned list, it will always select the second item. This happens both in text and token modes.
Kalina
Telerik team
 answered on 24 Dec 2012
1 answer
1.0K+ views
We're using RadGrid(with paging enabled) in a SharePoint site.
Our problem is that Grid takes too much time to load in the browser(7-8 seconds). I verified, that data fetching part is able to provide data to Grid within 1-2 seconds.

Here, We are not using the default template columns provided in RadGrid. 
We've created custom item templates(implementing the ITemplate interface) to create columns. e.g. to create a hyperlink column, We're using below template:
public class HyperlinkItemTemplate<TProperty, T> : ITemplate
    {
        public string PropertyName { get; set; }
        public string PropertyKey { get; set; }
        public string NavigateUrl { get; set; }
 
        public HyperlinkItemTemplate(string propertyName, string propertyKey, string navigateUrl)
        {
            PropertyName = propertyName;
            PropertyKey = propertyKey;
            NavigateUrl = navigateUrl;
        }
 
        public void InstantiateIn(Control c)
        {
            HyperLink hyperLink = new HyperLink();
            hyperLink.DataBinding += OnDisplayDataBinding;
            c.Controls.Add(hyperLink);
        }
 
        private void OnDisplayDataBinding(object sender, EventArgs e)
        {
            HyperLink hyperLink = (HyperLink) sender;
            hyperLink.Text = TemplateHelper.GetValue<String, T>((GridDataItem) hyperLink.NamingContainer, PropertyName);
            hyperLink.NavigateUrl = String.Format(NavigateUrl, TemplateHelper.GetValue<TProperty, T>((GridDataItem)hyperLink.NamingContainer, PropertyKey));
        }
    }
When we tried a RadGrid(with AutoGenerateColumns property set to true) with same amount of data set, it was much faster(almost 50% fast).
Is there any performance issue with RadGrid when using custom item templates?
Any suggestions, to improve the performance.

Thanks in advance.
Pavlina
Telerik team
 answered on 24 Dec 2012
1 answer
47 views
When I use the grid plainly without a NestedView, my ImageButtons (from a GridButtonColumn) clicks are processed perfectly without any problems. The instant I add a NestedViewTemplate, ONLY the first row's ImageButtons work, the others do not kick off the ItemCommand event.

Any ideas?

-Ben
Eyup
Telerik team
 answered on 24 Dec 2012
1 answer
87 views
I have a RadGrid with single row edit capability, and a button that acts as a "Submit" button.  I'm handling the grid's UpdateCommand event on the server, doing some processing, and trying to change the submit button's OnClientClick event.  Basically, depending on what happens when the server processes the update, I want the submit button to hit one of a few different js functions.  I'm having trouble reliably updating the button's event.  It seems as though it needs a full page postback to take effect.  What is the recommended approach for this?
Eyup
Telerik team
 answered on 24 Dec 2012
3 answers
146 views
I have problem in radgrid when biding data by List (not EntitiesDataSource or LinqDataSource or SqlDatasource).

<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
        CellSpacing="0" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True"
        ShowStatusBar="True" OnDeleteCommand="RadGrid1_DeleteCommand" OnInsertCommand="RadGrid1_InsertCommand"
        OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand"
        GridLines="None" Skin="Metro" OnItemDataBound="RadGrid1_ItemDataBound">
        <ExportSettings ExportOnlyData="True" IgnorePaging="True" OpenInNewWindow="True">
            <Excel Format="Biff" />
        </ExportSettings>
        <MasterTableView CommandItemDisplay="Top" EditMode="InPlace" InsertItemPageIndexAction="ShowItemOnCurrentPage"
            AutoGenerateColumns="False" DataKeyNames="ID" GridLines="Both">
            <CommandItemSettings ExportToPdfText="Export to PDF" AddNewRecordText="Thêm má»›i"
                ExportToExcelText="Xuất Excel" RefreshText="Làm má»›i" ShowExportToExcelButton="True">
            </CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridDropDownColumn DataField="ProviderId" DataType="System.Int64" FilterControlAltText="Filter ProviderId column"
                    HeaderText="Nhà cung cấp" SortExpression="ProviderId" ListTextField="ProviderName"
                    ListValueField="ProviderId" UniqueName="ProviderId" ColumnEditorID="GridDropDownColumnEditor1"
                    DropDownControlType="RadComboBox" runat="server">
                </telerik:GridDropDownColumn>
           <%--     <telerik:GridTemplateColumn HeaderText="Nhà cung cấp" UniqueName="ProviderID">
                     <ItemTemplate>
                         <asp:DropDownList ID="ddlProvider" runat="server"/>
                     </ItemTemplate>
                 </telerik:GridTemplateColumn>--%>
                <telerik:GridBoundColumn DataField="Buys" DataType="System.Decimal" FilterControlAltText="Filter Buys column"
                    HeaderText="Buys" SortExpression="Buys" UniqueName="Buys">
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn DataField="Date" DataType="System.DateTime" FilterControlAltText="Filter Date column"
                    HeaderText="Date" SortExpression="Date" UniqueName="Date">
                </telerik:GridDateTimeColumn>
                <telerik:GridBoundColumn DataField="Commen" FilterControlAltText="Filter Commen column"
                    HeaderText="Commen" SortExpression="Commen" UniqueName="Commen">
                </telerik:GridBoundColumn>
                <telerik:GridButtonColumn ConfirmText="Bạn muốn xóa hóa đơn này ?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
                <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
                    <ItemStyle CssClass="MyImageButton" Width="30px"></ItemStyle>
                </telerik:GridEditCommandColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
    </telerik:RadGrid>

And here is code behind


protected void Page_Load(object sender, EventArgs e)
{
    
}
 
protected void RadGrid1_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
    Int64 purchaseId = Convert.ToInt64((e.Item as GridDataItem).GetDataKeyValue("ID"));
    INPUTITEMDAO.Delete(purchaseId);
    RadGrid1.Rebind();
    //Reresh grid
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_InsertCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Hashtable values = new Hashtable();
    item.ExtractValues(values);
    INPUTITEM objInputItem=new INPUTITEM();
    item.UpdateValues(objInputItem);
 
    INPUTITEMDAO.InsertAndUpdate(objInputItem);
    RadGrid1.Rebind();
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_UpdateCommand(object sender, GridCommandEventArgs e)
{
    GridEditableItem item = e.Item as GridEditableItem;
    Int64 purchaseId =Convert.ToInt64(item.GetDataKeyValue("ID").ToString());
    INPUTITEM objInputItem = DataOut.GetAllINPUTITEMList().Where(i => i.ID == purchaseId).FirstOrDefault();
    item.UpdateValues(objInputItem);
    INPUTITEMDAO.InsertAndUpdate(objInputItem);
    RadGrid1.Rebind();
    RadGrid1.MasterTableView.ClearEditItems();
}
 
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    RadGrid1.DataSource = DataOut.GetAllINPUTITEMList();
}
 
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    GridEditableItem editedItem = e.Item as GridEditableItem;
    GridDataItem dataItem = e.Item as GridDataItem;
    if (e.Item is GridEditableItem&& (e.Item as GridEditableItem).IsInEditMode)
    {
        GridEditManager editMan = editedItem.EditManager;
        GridDropDownListColumnEditor editor = editMan.GetColumnEditor("ProviderId") as GridDropDownListColumnEditor;
        //in case you have RadComboBox editor for the GridDropDownColumn (this is the default editor),  
        //you will need to use ComboBoxControl below instead of DropDownListControl
        //Then you can modify the list control as per your custom conventions
        if (editor != null)
        {
            editor.DataSource = PROVIDERDAO.GetAllPROVIDERList();
            editor.DataBind();
        }
    }
}
i don't know what problem that i run project not show ProviderId column but when i click edit it is show
I Want grid show ProviderId column with ListTextField = "ProviderName" when page loading because eidt i had done ok.
Please help me ?
Daniel
Telerik team
 answered on 24 Dec 2012
1 answer
57 views

Hi,

I want to add a RadListBoxItem into a RadListBox from javascript.
 
Can anybody help me to achieve this scenario ASAP?


Thanks in advance

Princy
Top achievements
Rank 2
 answered on 24 Dec 2012
3 answers
855 views

Hi,
How do a RadGrid be in View mode or non editable mode?

Scenario:
Based on the user role, RadGrid should be in Disable mode(no Add/Update/Remove functionalities ) or Enable mode. This should happen dynamically.

Thanks,
Chaitanya
Eyup
Telerik team
 answered on 24 Dec 2012
5 answers
163 views
I am creating RadTreeNode as follows:

protected RadTreeNode BuildOption(Options option, string questionType)
    {
RadTreeNode nodeOption =
new RadTreeNode();
 
       nodeOption.Text = "(" + option.OrderID.ToString() + ") " + option.Name;
       nodeOption.Value = option.OptionsID.ToString();
       nodeOption.Attributes.Add(SurveyTreeNodeAttributes.SurveyTreeNodeType, ((int)EnumsBL.SurveyTreeNodeType.Option).ToString());      
       nodeOption.Attributes.Add(SurveyTreeNodeAttributes.QuestionType, questionType);
       nodeOption.ImageUrl = "~/images/ConstIcons/icon-question-option.png";
       return nodeOption;
}
I am also loading the tree nodes on demand as follows:   
Code Behind:
[WebMethod]
public static RadTreeNodeData[] LoadNodes(RadTreeNodeData node, object context)
{
    EnumsBL.SurveyTreeNodeType nodeType = (EnumsBL.SurveyTreeNodeType)Enum.Parse(typeof(EnumsBL.SurveyTreeNodeType), node.Attributes[SurveyTreeNodeAttributes.SurveyTreeNodeType].ToString());
    TreeNodeBuilder treeNodeBuilder = QuestionnaireTreeBuilderFactory.GetQuestionnaireTreeBuilder(nodeType);
    return treeNodeBuilder.BuildChildNodesData(node.Value);
}
ASCX:
<telerik:RadTreeView ID="radTree"
          Skin="Default"
          BackColor="White"
          BorderStyle="Solid"
          BorderColor="#CCCCCC"
          BorderWidth="1px"
          AllowNodeEditing="true"
          Style="cursor: hand;"
          Height="250px"
          EnableDragAndDrop="false"
          OnNodeClick="NodeClick"
           SingleExpandPath="true"
          runat="server">
         <WebServiceSettings  Path="../../Constructor/AdaptiveAnswerBuilder.aspx" Method="LoadNodes" />
      </telerik:RadTreeView>
I have debugged method "LoadNodes" and checked that RadTreeNodeData object array contains the two attributes added to the node at the top.

However when a node is selected I only get(after debugging) one node custom attributes, not two:
protected void TreeNodeClicked(object sender, RadTreeNodeEventArgs e)
   {
       RadTreeNode selectedNode = e.Node; //only one of the attributes, assigned during node creation, are present
       switch ((EnumsBL.SurveyTreeNodeType)Enum.Parse(typeof(EnumsBL.SurveyTreeNodeType), selectedNode.Attributes[SurveyTreeNodeAttributes.SurveyTreeNodeType]))
       {          
           case EnumsBL.SurveyTreeNodeType.Option:
               SetViewstateVariables(selectedNode);
               SetConditionValueHolder(int.Parse(selectedNode.Value));
               EnableSaveButton();
               break;
           default:
                pnlCondEqual.Visible = false;
                DisableSaveButton();
               break;
       }       
   }

How do I get the other attribute?

Regards,
--Fahmi
Dimitar Terziev
Telerik team
 answered on 24 Dec 2012
1 answer
193 views
Hi,

I am having an issue getting the RadGrid-MasterTableView on client-side. I have a RadGrid on the page which does not have static defined columns and I cannot get the mastertableview. Also I defined some static columns and still cannot get the MasterTableVIew.

My final goal is add columns to my RadGrid on the fly using client-side. I could defined to static columns there but other columns are going to be added on dynamically.

What I am missing in my code that I cannot get the MasterTable to add my data to the grid
Thank you in advance


This the code that I am using to get those intance and I can get the grid object but not the MasterTable
   var grid = $find("<%=RadGrid1.ClientID %>");
                       var MasterTable = grid.get_masterTableView();  
                       
//                       var tableView = $find("<%= RadGrid1.ClientID %>").get_masterTableView();

<telerik:RadGrid ID="RadGrid1" runat="server" autogeneratecolumns="false" allowsorting="true" allowpaging="true">
<PagerStyle AlwaysVisible="true" />
   <MasterTableView>
     <Columns>
       <telerik:GridBoundColumn DataField="automobile" UniqueName="automobile" HeaderText="automobile" ></telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="betrayal" UniqueName="betrayal" HeaderText="betrayal" ></telerik:GridBoundColumn>
       <telerik:GridBoundColumn DataField="DataSourceRecordID" UniqueName="DataSourceRecordID" HeaderText="DataSourceRecordID" ></telerik:GridBoundColumn>
     </Columns>
   </MasterTableView>
</telerik:RadGrid>
Jayesh Goyani
Top achievements
Rank 2
 answered on 24 Dec 2012
1 answer
57 views
Hi,

Would it be possible to implement selective drill down on RadChart?  Say, only certain chart items have sub-data behind it, while others don't.  I would like to "disable" the click event for those that don't.  Is this possible?

Thanks.


Evgenia
Telerik team
 answered on 24 Dec 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jay
Top achievements
Rank 3
Bronze
Iron
Iron
yw
Top achievements
Rank 2
Iron
Iron
Stefan
Top achievements
Rank 2
Iron
Iron
Iron
Kao Hung
Top achievements
Rank 1
Iron
Bohdan
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?