Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
187 views
I've Two tabs, First tab where I've defined class = "k-state-active". In 2nd tab, i've few buttons & Grid. Based on button click I need Grid (in the 2nd tab) to be populated (server side) after the postback. I've below JQuery to show 2nd tab after postback which is not working.


$(function () {
   $('Button').click(function () {
       var tabstrip = $("#tabstrip").kendoTabStrip().data("kendoTabStrip");​​
       tabstrip.select(1);
    });
});

With above code, I'm getting first tab instead of 2nd tab after button click. Please help.
Alex Gyoshev
Telerik team
 answered on 09 Jun 2014
1 answer
65 views
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
 
 
           <telerik:RadGrid ID="radGridBooks" runat="server"
               AutoGenerateColumns="False"
               ShowFooter="True"
               CellSpacing="0"
               GridLines="None"
               Skin="Default"
               OnNeedDataSource="radGridBooks_NeedDataSource">
 
               <MasterTableView CommandItemDisplay="Top" EditMode="PopUp" GridLines="None" TableLayout="Fixed">
 
                   <CommandItemSettings AddNewRecordText="Add New Book" RefreshText="Refresh"></CommandItemSettings>
                   <Columns>
 
                       <telerik:GridEditCommandColumn></telerik:GridEditCommandColumn>
                       <telerik:GridBoundColumn DataField="ID" UniqueName="ID" HeaderText="Book ID"></telerik:GridBoundColumn>
                       <telerik:GridBoundColumn DataField="Name" HeaderText="Book Name">
                           <ColumnValidationSettings EnableRequiredFieldValidation="true" EnableModelErrorMessageValidation="true">
                               <RequiredFieldValidator ForeColor="Red" ErrorMessage="Required"></RequiredFieldValidator>
                           </ColumnValidationSettings>
                       </telerik:GridBoundColumn>
                       <telerik:GridButtonColumn Text="Del" CommandName="DeleteBook" CommandArgument="ID"></telerik:GridButtonColumn>
                   </Columns>
                   <EditFormSettings EditFormType="Template" CaptionDataField="ID" PopUpSettings-ScrollBars="Auto" PopUpSettings-Modal="True" PopUpSettings-ShowCaptionInEditForm="true">
                       <FormTemplate>
                           <table width="100%">
                               <tr>
                                   <td>Try</td>
                               </tr>
                           </table>
                       </FormTemplate>
                   </EditFormSettings>
               </MasterTableView>
               <ClientSettings EnableRowHoverStyle="true">
               </ClientSettings>
           </telerik:RadGrid>
 
       </telerik:RadAjaxPanel>



LOOK THIS PHOTO
Princy
Top achievements
Rank 2
 answered on 09 Jun 2014
1 answer
171 views
Hi Sir,

I put the Grid on the usercontrol, I have to set the usercontrol enabledviewstate="false", the problem is now the  OnItemCommand="MyGrid_ItemCommand" not fired or not triggered, that means when I click 'Edit' or other commandbutton ,nothing happen, If I set the enabledviewstate = 'true' for the usercontrol, everything works fine, but I need to disable the viewstate for whole usercontrol,  do you have some suggetions about this issue? how can I trigger/fire the OnItemCommand event when whole usercontrol  'EnableViewState'  is false.
Thanks

Regards

Princy
Top achievements
Rank 2
 answered on 09 Jun 2014
2 answers
228 views
I am in the process of changing from a GridView to a RadGrid and have been experiencing a few issues.

I am attempting to pull an "Active" token from my RadGrid that displays a lot of product information. I do not have the "Active" token being displayed to the user though. It is not set to a hidden value either. The token gets pulled when the user presses the Delete button inside a GridTemplateColumn on my RadGrid.

Before with the GridView, I could use System.Web.UI.DataBinder.Eval(e.Row.DataItem, "Active") and it would return whether or not the Active token was a 1 or a 0.

I currently have the following in VB.NET:

Protected Sub rgvMyGrid_RowCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgvMyGrid.ItemCommand
 
  If (e.CommandName = "DeleteMSDS") Then
    Dim myDelete As WinampButton = CType(e.Item.FindControl("btnDelete"), WinampButton)
    myDelete.CommandName = "DeleteMSDS"
    myDelete.CommandArgument = System.Web.UI.DataBinder.Eval(e.Item.DataItem, "MSDSID")
    If System.Web.UI.DataBinder.Eval(e.item.DataItem, "Active")
      myDelete.Attributes.Add("onClick", "javascript:return confirm('Are you sure you want to permanently delete this SDS / MSDS?');")
    End If
  End If


Before this worked like a charm, but I am having trouble. I have noticed that the System.Web.UI.DataBinder(e.Item.DataItem, "MSDSID") never returns anything. And in turn, it cannot find an instance of "Active" being used then.
Alexander
Top achievements
Rank 1
 answered on 06 Jun 2014
2 answers
233 views

Hi,


I am using RadGrid for an webapplication that runs on touch screen
monitor. It becomes very difficult for the users to scroll using the
standard sized scroll bars that come up in radgrid. Can someone please
advice on how to increase the scroll bar width.

image attach below

thanks
Marin
Telerik team
 answered on 06 Jun 2014
1 answer
87 views
I am using the "NeedDataSource" method to fill in a grid.  On the ItemDataBound I am setting the background colors for some values in a couple of column cells.  (Sub below)

This displays properly.  Dragging columns around works properly and the colors follow the cells.  However, when you do a grouping by dragging the column to the top of the grid the colors do not stay with the cells.

I have attached a before and after image...

Any ideas why this is moving?   I am setting the colors based on the FindByUniqueName identifier for the column.

Thanks,
Nathan


Protected Sub rgDispatch_ItemDataBound(sender As Object, e As Telerik.Web.UI.GridItemEventArgs) Handles rgDispatch.ItemDataBound
    '//Is it a GridDataItem
    If Not IsNothing(TryCast(e.Item, Telerik.Web.UI.GridDataItem)) Then
        'Get the instance of the right type
        Dim dataBoundItem As Telerik.Web.UI.GridDataItem = DirectCast(e.Item, Telerik.Web.UI.GridDataItem)
        'Set the desired color on the Status column based on the value
        Dim StatusColIndex As Integer = rgDispatch.Columns.FindByUniqueName("Status").OrderIndex
        Select Case dataBoundItem("Status").Text
            Case "Loading"
                dataBoundItem("Status").BackColor = System.Drawing.Color.Yellow
            Case "Loaded"
                dataBoundItem("Status").BackColor = System.Drawing.Color.DodgerBlue
            Case "Claimed"
                dataBoundItem("Status").BackColor = System.Drawing.Color.Orange
            Case "Started"
                dataBoundItem("Status").BackColor = System.Drawing.Color.FromArgb(19, 229, 19)  'Green color
            Case "Stopped"
                dataBoundItem("Status").BackColor = System.Drawing.Color.IndianRed
        End Select
        'Set the desired color on the Status column based on the value
        Dim MatReadyColIndex As Integer = rgDispatch.Columns.FindByUniqueName("MatReady").OrderIndex
        Select Case dataBoundItem("MatReady").Text
            Case "Yes"
                e.Item.Cells(MatReadyColIndex).BackColor = System.Drawing.Color.FromArgb(19, 229, 19)
            Case "No"
                e.Item.Cells(MatReadyColIndex).BackColor = System.Drawing.Color.IndianRed
        End Select
    End If
    If Not IsNothing(TryCast(e.Item, Telerik.Web.UI.GridPagerItem)) Then
        Dim pager As Telerik.Web.UI.GridPagerItem = DirectCast(e.Item, Telerik.Web.UI.GridPagerItem)
        Dim PagerLabel As Label = pager.FindControl("ChangePageSizeLabel")
        PagerLabel.Text = "Items per Page"
    End If
End Sub
Nathan
Top achievements
Rank 1
 answered on 06 Jun 2014
1 answer
190 views
I have a grid with a hyperlink to a network folder.  The location is constructed in a query based on some information that SHOULD be correct, but there are mistakes made by the end-users and the hyperlink on occasion will be correct.  

<telerik:GridTemplateColumn ColumnGroupName="DLB" UniqueName="Location"  Display="True" HeaderText="Files" >
    <ItemTemplate>
        <a href="<%# Eval("Location")%>" target="_blank">Open folder</a>
    </ItemTemplate>
</telerik:GridTemplateColumn>

For each row, I would like to somehow handle that hyperlink if the network folder does not exist.  Either there will be no link to click or popup a message that informs the user the network folder does not exist.

I figure I would likely use System.IO.Directory.Exists, but I am clueless as to how to implement that.  I have made some attempts and searched for a solution, but have not come up with anything that works for me.

Thank you!
Eyup
Telerik team
 answered on 06 Jun 2014
2 answers
49 views
I have noticed a new behavior in the editor in IE while upgrading to the latest version (2014.1.403). If you add certain styles (width, height, float, maybe others) to a block element (div, p, h1, etc), you can no longer select text in that element with the mouse. You can select the element itself, which is displayed with a border and handles, but not the content inside it. The keyboard works fine, but the mouse does not.

You can see this on your demo site. Go to the html tab, modify the opening p tag to include 'width:300px;' in the style, and go back to the design tab. Try to use the mouse to select some text.

The previous version I was using was 2013.2.717. No problem there.

The problem happens in all versions of IE. It seems to work properly in Firefox and Chrome.
Dan Ehrmann
Top achievements
Rank 1
 answered on 06 Jun 2014
6 answers
135 views
I have a radGrid with a FilterTemplate containing a radComboBox with CheckBoxes=true.
I want to preselect a number of items in the radComboBox but that doesn't seem to work inside the filtertemplate (while it works just fine for the radComboBox outside a grid)
The grid columns and template are created in server side code, the data is loaded via a pagemethod.
I minimized my code down to this:

gridtest.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using System.Web.Services;
 
namespace SMTX.Common.Web {
    public partial class gridtest : System.Web.UI.Page {
        protected void Page_Load(object sender, EventArgs e) {
            if (!Page.IsPostBack)
                initGrid();
        }
 
        public void initGrid() {
            Forms.BL.EntityClasses.ViewEntity objView = Forms.BL.MyCode.ViewFactory.fetch(18);
            RadGrid1.AllowFilteringByColumn = true;
 
            GridBoundColumn objCol = new GridBoundColumn {
                AllowFiltering = true,
                DataField = "Field1",
                HeaderText = "Field1",
                DataType = Type.GetType("System.String"),
                FilterTemplate = new FilterTemplateCombo()
            };
            RadGrid1.Columns.Add(objCol);
 
            objCol = new GridBoundColumn {
                AllowFiltering = false,
                DataField = "Field2",
                HeaderText = "Field2",
                DataType = Type.GetType("System.String")
            };
            RadGrid1.Columns.Add(objCol);
 
            ScriptManager.RegisterStartupScript(this, this.GetType(), "CallGetView", @"setTimeout(function() {radGrid_Init();}  , 1000);", true);
        }
 
        [WebMethod]
        public static List<dataContainer> GetData(List<GridFilterExpression> p_lstFilterExpressions) {
            List<dataContainer> lstData = getDataForGrid(p_lstFilterExpressions);
            return lstData;
        }
 
 
        public static List<dataContainer> getDataForGrid(List<GridFilterExpression> p_lstFilterExpressions) {
            List<dataContainer> lstData = dataContainer.getTestData();
            List<String> lstFilterValues = null;
            if (p_lstFilterExpressions.Count > 0)
                lstFilterValues = p_lstFilterExpressions[0].FieldValue.Split(new []{"||"}, StringSplitOptions.RemoveEmptyEntries).ToList();
             
            if (lstFilterValues == null)
                return lstData;
            else
                return lstData.Where(r => lstFilterValues.Contains(r.Field1)).ToList();
        }
 
    }
 
    public class dataContainer {
        public Object Field1 { get; set; }
        public Object Field2 { get; set; }
 
        public static List<dataContainer> getTestData() {
            List<dataContainer> lstToRetrun = new List<dataContainer>();
            lstToRetrun.Add(new dataContainer { Field1 = "Name1", Field2 = "Name1field2" });
            lstToRetrun.Add(new dataContainer { Field1 = "Name2", Field2 = "Name2field2" });
            return lstToRetrun;
        }
 
    }
    public class FilterTemplateCombo : ITemplate {
        object m_objDataSource;
 
        public FilterTemplateCombo() {
            m_objDataSource = new[] { "Name1", "Name2" };
        }
 
        public void InstantiateIn(Control objContainer) {
            RadComboBox objCombobox = new RadComboBox();
            objContainer.Controls.Add(objCombobox);
            objCombobox.DataSource = m_objDataSource;
            objCombobox.DataBind();
            objCombobox.OnClientItemChecked = "RadGrid_ComboBoxMultiFilterCommand";
            objCombobox.CheckBoxes = true;
            foreach (RadComboBoxItem objItem in objCombobox.Items)
                objItem.Checked = true;
        }
    }
}

gridtest.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="gridtest.aspx.cs" Inherits="SMTX.Common.Web.gridtest" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<html>
<body>
    <form id="form1" runat="server">
        <ajax:ToolkitScriptManager ID="MyToolkitScriptManager" runat="server" EnablePageMethods="true" />
        <telerik:RadGrid ID="RadGrid1" runat="server">
            <ClientSettings>
                <ClientEvents OnCommand="RadGrid_Command" />
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadScriptBlock runat="server">
            <script type="text/javascript">
                function radGrid_Init() {
                    var tableView = $find("RadGrid1").get_masterTableView();
                    PageMethods.GetData(tableView.get_filterExpressions().toList(), RadGrid_Update);
                }
 
                function RadGrid_Command(sender, args) {
                    args.set_cancel(true);
                    var filterExpressions = sender.get_masterTableView().get_filterExpressions();
                    PageMethods.GetData(filterExpressions.toList(), RadGrid_Update);
                }
 
                function RadGrid_ComboBoxMultiFilterCommand(sender, args) {
                    var gridTableView = sender.get_parent().get_parent().get_masterTableView();
                    var arr_objItems = sender.get_checkedItems();
                    if (arr_objItems.length > 0) {
                        var strData = "";
                        for (var i = 0; i < arr_objItems.length; i++)
                            strData += "||" + arr_objItems[i].get_value();
                        gridTableView.filter("Field1", strData, Telerik.Web.UI.GridFilterFunction.Custom);
                    } else {
                        gridTableView.filter("Field1", "", Telerik.Web.UI.GridFilterFunction.NoFilter);
                    }
                }
 
                function RadGrid_Update(result) {
                    var tableView = $find("RadGrid1").get_masterTableView();
                    tableView.set_dataSource(result);
                    tableView.dataBind();
                }
            </script>
        </telerik:RadScriptBlock>
    </form>
</body>
</html>

I expect the radComboBox filter in Field1 to have it's 2 items checked, but that doesn't seem to be the case, although they were checked in the code.
Tim
Top achievements
Rank 1
 answered on 06 Jun 2014
6 answers
275 views
Hi,
In my radgrid when I no data the HTM table element of mastertableview don't take the whole width.
I try to force by CSS, javascript, but its size is overriden.

Could you give me an issue to force the width of the html table?
<NoRecordsTemplate>
    <div style="text-align: center; width: 100%;">
        <asp:Label Text="<%$Resources:RadGridLib,grid_client_master_no_records %>" ID="LabelNoDoc" runat="server" />
     </div>
</NoRecordsTemplate>

I also try to implemente the client events OnMasterTableViewCreating and OnMasterTableViewCreated, but no succes!

Bye.
Pavlina
Telerik team
 answered on 06 Jun 2014
Narrow your results
Selected tags
Tags
+? more
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Rob
Top achievements
Rank 3
Iron
Iron
Iron
Atul
Top achievements
Rank 1
Iron
Iron
Iron
Alexander
Top achievements
Rank 1
Veteran
Iron
Serkan
Top achievements
Rank 1
Iron
Shawn
Top achievements
Rank 1
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?