Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
86 views
I'm trying to implement the radgrid keyboard navigation controls to a grid, but an unexpected error in firefox stopped releasing it.

i have a grid which is editable with keyboard controls.  When you hit enter you enter edit mode and focus gets put on the proper field.  If the user tabs over to the next field which is a combobox, it leaves that row in edit mode, and puts the row cursor on the row above the one you're on.

This does not happen in IE or Chrome.  In another browser, it just does not update, and stays in edit mode.

I would like to have the row update, if not, then do nothing.

Any Ideas?

<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="False" GridLines="None"
        AutoGenerateEditColumn="True" OnInsertCommand="RadGrid1_InsertCommand" OnUpdateCommand="RadGrid1_UpdateCommand"
        OnItemDataBound="RadGrid1_ItemDataBound" OnEditCommand="RadGrid1_EditCommand"
        ShowFooter="True"
        OnItemCommand="RadGrid1_ItemCommand" DataMember="DefaultView" >
        <ClientSettings AllowKeyboardNavigation="True">
            <KeyboardNavigationSettings AllowSubmitOnEnter="True" />
        </ClientSettings>
        <GroupPanel Enabled="False">
        </GroupPanel>
        <MasterTableView EditMode="InPlace" DataMember="DefaultView" ShowHeadersWhenNoRecords="true"
            CommandItemDisplay="TopAndBottom" DataKeyNames="ID" >
            <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="ItemID"
                    FilterControlAltText="Filter ItemID column" HeaderText="ItemID" ReadOnly="True"
                    UniqueName="ItemID">
                </telerik:GridBoundColumn>
                <telerik:GridTemplateColumn DataField="ItemDescription" FilterControlAltText="Filter ItemDescription column"
                    HeaderText="ItemDescription" SortExpression="ItemDescription" UniqueName="ItemDescription">
                    <EditItemTemplate>
                        <asp:Label runat="server" ID="lblItemDescription" Text='<%# Bind("ItemDescription") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblItemDescription" Text='<%# Bind("ItemDescription") %>'></asp:Label>
                    </ItemTemplate>
                    <InsertItemTemplate>
                        <telerik:RadComboBox ID="cboItem" runat="server" DataSourceID="ODSItems" DataTextField="Description"
                            DataValueField="InventoryItemID" SelectedValue='<%# Bind("ItemID") %>' OnSelectedIndexChanged="cboItem_SelectedIndexChanged" />
                    </InsertItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="Collection" FilterControlAltText="Filter Collection column"
                    HeaderText="Collection" SortExpression="Collection" UniqueName="Collection">
                    <EditItemTemplate>
                        <asp:Label runat="server" ID="lblCollection" Text='<%# Bind("Collection") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblCollection" Text='<%# Bind("Collection") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn DataField="Location" FilterControlAltText="Filter Location column"
                    HeaderText="Location" SortExpression="Location" UniqueName="Location">
                    <EditItemTemplate>
                        <asp:Label runat="server" ID="lblLocation" Text='<%# Bind("Location") %>'></asp:Label>
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblLocation" Text='<%# Bind("Location") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn FilterControlAltText="Filter Quantity column" HeaderText="Quantity"
                    UniqueName="Quantity" DataField="Quantity" DefaultInsertValue="0">
                    <EditItemTemplate>
                        <telerik:RadNumericTextBox runat="server" ID="txtQuantity" Text='<%# Bind("Quantity") %>' />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*"
                            ControlToValidate="txtQuantity" ForeColor="Red" />
                    </EditItemTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblQuantity" Text='<%# Bind("Quantity") %>'></asp:Label>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Unit" SortExpression="Unit" UniqueName="Unit">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblUnit" Text='<%# Bind("Unit") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <telerik:RadComboBox ID="cboUnit" runat="server" DataSourceID="ODSUnitList"
                            DataTextField="UnitDescription" DataValueField="UnitValue" SelectedValue='<%# Bind("UnitID") %>' />
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                            ControlToValidate="cboUnit" ForeColor="Red" SetFocusOnError="true" Display="Dynamic" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                         <telerik:RadComboBox ID="cboUnit" runat="server" DataSourceID="ODSUnitList"
                            DataTextField="UnitDescription" DataValueField="UnitValue" />
 
                    </InsertItemTemplate>
                </telerik:GridTemplateColumn>
                <telerik:GridTemplateColumn HeaderText="Total" SortExpression="Total" UniqueName="Total"
                    DefaultInsertValue="0">
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lblTotal" Text='<%# Bind("Total") %>'></asp:Label>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:Label runat="server" ID="lblTotal" Text='<%# Bind("Total") %>'></asp:Label>
                    </EditItemTemplate>
                    <FooterTemplate>
                        <asp:Label runat="server" ID="lblOverallTotal" Text='Total = <%= OverallTotal %>'></asp:Label>
                    </FooterTemplate>
                </telerik:GridTemplateColumn>
                <%--  <telerik:GridBoundColumn FilterControlAltText="Filter CollectionID column" HeaderText="CollectionID"
                    UniqueName="CollectionID" DataField="CollectionID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn FilterControlAltText="Filter LocationID column" HeaderText="LocationID"
                    UniqueName="LocationID" DataField="LocationID">
                </telerik:GridBoundColumn>--%>
                <%--<telerik:GridBoundColumn FilterControlAltText="Filter UnitID column" HeaderText="UnitID"
                    UniqueName="UnitID" DataField="UnitID">
                </telerik:GridBoundColumn>--%>
            </Columns>
            <SortExpressions>
                <telerik:GridSortExpression FieldName="ItemID" />
            </SortExpressions>
            <EditFormSettings>
                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <FilterMenu EnableImageSprites="False">
        </FilterMenu>
        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default">
        </HeaderContextMenu>
    </telerik:RadGrid>
Martin
Telerik team
 answered on 23 Sep 2011
2 answers
86 views
Hi, I had installed Teleric RAD Controls earlier with trial version and implemented in my project with trial version now I got lisence from client.
Can any one please guide me how to upgrade my system from Trial version to Lisenced Version and what changes needed in code.
Sanjeev
Top achievements
Rank 1
 answered on 23 Sep 2011
2 answers
50 views
Hi,
I am using Radgrid and using the facility of grouping grid header columns.
My requirement is to grouping for  single column only means there is no chance to  drag & drop  more than one column.in grouping panel.
I also want to display  pop up message for drag & drop for column.

AllowDragToGroup is working fine but How can I do the above  things.
 Please help me ...........




Thanks
Jaichand
Jaichand
Top achievements
Rank 1
 answered on 23 Sep 2011
3 answers
95 views
Currently, if you use the RadEditor to align an image to the left or right of content, the editor proceeds to add the following code to the image tag:

style="float: left;

We would like the default behavior for image alignment to instead add the following code to the image tag:

align="left"

I've tried turning off filters such as "ConvertToXhtml" but the float style still gets inserted.

Can anyone tell me if this change is possible?

Thanks in advance.
Dobromir
Telerik team
 answered on 23 Sep 2011
4 answers
103 views

Hi there,

Please help me.

I've tried the solution from a previous post(which is this):
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
    if (e.Item is  GridPagerItem)
        {
            GridPagerItem pager = (GridPagerItem)e.Item;
            RadComboBox PageSizeComboBox = (RadComboBox)pager.FindControl("PageSizeComboBox");
            RadComboBoxItem ComboItem = new RadComboBoxItem("All");
            PageSizeComboBox.Items.Insert(0, ComboItem);
            PageSizeComboBox.AutoPostBack = true;
            PageSizeComboBox.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(PageSizeComboBox_SelectedIndexChanged);
        }
    }
void PageSizeComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
   {
       //Handle the event
   }

The only problem i'm having is the line below. It keeps returning null:
PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true;

This is my code behind:

public partial class Admin : System.Web.UI.Page
  {
    FXGrid FXGrid1 = new FXGrid();
    protected void Page_Init(object sender, EventArgs e)
    {
      FXGrid1.DataBind();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
      System.Web.HttpBrowserCapabilities browser = Request.Browser;
      TextBox txt = (TextBox)toolbarMenu.FindControl("txtSearch");
     
 DataTable dt = new DataTable();
 dt.Columns.Add("Date");
      dt.Columns.Add("MessageNo");
      dt.Columns.Add("From");
      dt.Columns.Add("NoofPages");
      dt.Columns.Add("TrackingNo");
      dt.Columns.Add("Status");
      dt.Columns.Add("CallerID");

      DataRow messagesRow = dt.NewRow();
      messagesRow["Date"] = "ALFKI";
      messagesRow["MessageNo"] = "Alfreds Futterkiste";
      messagesRow["From"] = "Alfreds Futterkiste";
      messagesRow["NoofPages"] = "Alfreds Futterkiste";
      messagesRow["TrackingNo"] = "Alfreds Futterkiste";
      messagesRow["Status"] = "Alfreds Futterkiste";
      messagesRow["CallerID"] = "Alfreds Futterkiste";
      dt.Rows.Add(messagesRow);

      DataRow messagesRow2 = dt.NewRow();
      messagesRow2["Date"] = "ALFKI";
      messagesRow2["MessageNo"] = "Alfreds Futterkiste";
      messagesRow2["From"] = "Alfreds Futterkiste";
      messagesRow2["NoofPages"] = "Alfreds Futterkiste";
      messagesRow2["TrackingNo"] = "Alfreds Futterkiste";
      messagesRow2["Status"] = "Alfreds Futterkiste";
      messagesRow2["CallerID"] = "Alfreds Futterkiste";
      dt.Rows.Add(messagesRow2);
      dt.Columns.Add("<img id='edit' style='border:0px;cursor:pointer' src='../../Images/Outlook/Edit.gif'>").SetOrdinal(0);

      DataRow[] chkEdit = new DataRow[dt.Rows.Count];
      for (int row = 0; row < dt.Rows.Count; row++)
      {
        chkEdit[row] = dt.Rows[row];
        chkEdit[row]["<img id='edit' style='border:0px;cursor:pointer' src='../../Images/Outlook/Edit.gif'>"] = "<img style='cursor:pointer' src='../../Images/Outlook/Edit.gif' value='" + dt.Rows[row][1] + "' onclick='showWin(" + dt.Rows[row][1] + ", "+row+")'>";
      }
    
      GridClientSelectColumn gcsc = new GridClientSelectColumn();
      gcsc.Resizable = false;
      FXGrid1.rowCount = dt.Rows.Count;

      FXGrid1.MasterTableView.Width = Unit.Percentage(100);
      FXGrid1.MasterTableView.TableLayout = GridTableLayout.Fixed;

      /*RadGrid's common attributes*/
      FXGrid1.GridLines = GridLines.None;
      FXGrid1.ID = "RG1";
      FXGrid1.AllowPaging = true;
      FXGrid1.AllowSorting = true;
      FXGrid1.BorderWidth = Unit.Pixel(0);

      FXGrid1.PagerStyle.AlwaysVisible = true;
      FXGrid1.MasterTableView.TableLayout = GridTableLayout.Fixed;
     

      FXGrid1.ClientSettings.Scrolling.AllowScroll = true;
      FXGrid1.ClientSettings.Scrolling.UseStaticHeaders = true;
      FXGrid1.ClientSettings.ClientEvents.OnGridCreated = "getFwdAddr";
      ttlRow.Value = FXGrid1.rowCount.ToString();
      FXGrid1.AllowMultiRowSelection = true;
      FXGrid1.ClientSettings.Selecting.AllowRowSelect = true;

      FXGrid1.pgName = "inbound";
      this.phIBRoute.Controls.Add(FXGrid1);
      FXGrid1.DataSource = dt;

      if (!IsPostBack)
      {
        FXGrid1.MasterTableView.Columns.Add(gcsc);
        FXGrid1.DataBind();
      }
      FXGrid1.setSize();
      Page.PreRender += new EventHandler(FXGrid1.setCombo);
    }
  }

This is my cs file:

public class FXGrid : RadGrid
    {       
        private int pgVal;
        private RadComboBox pgSize;      
        public int rowCount;      
        public double percentWidth = 0;
        public bool blackList = false;
        public String pgName = "";
        public String hideCol = "";
        public String setName;
        public String setNameVal;
        public DataTable dt;
        public String browserType;
        protected RadComboBox rcb = new RadComboBox();
        public FXGrid()
        {
            rcb.DataTextField = "Text";
            rcb.DataValueField = "Value";
            rcb.LoadContentFile(@"~\Common\Xml\GridPageSize.xml");
            pgVal = int.Parse(rcb.Items[rcb.SelectedIndex].Text);
            this.ClientSettings.Resizing.AllowColumnResize = true;
            this.ItemCreated += new GridItemEventHandler(this.testo);
           
            this.ItemDataBound +=new GridItemEventHandler(setCellTooltip);
            this.EnableViewState = true;
            this.ShowHeader = true;
            this.ClientSettings.Resizing.ClipCellContentOnResize = false;
            this.ClientSettings.Resizing.ResizeGridOnColumnResize = false;
            this.ClientSettings.Resizing.AllowResizeToFit = false;
            this.ViewStateMode = ViewStateMode.Enabled;

        }
         public void setCellTooltip(object sender, GridItemEventArgs e)
        {          
            int count = 0;
            if (e.Item is GridDataItem)
            {

                foreach (TableCell cell in e.Item.Cells)
                {

                    if (pgName == "docStore" || pgName == "netSetFaxAgentDR")
                    {
                        if (count >= 5)
                        {
                            String tmpStr = cell.Text.Replace("<nobr>", "");
                            cell.ToolTip = tmpStr.Replace("</nobr>", "");
                        }
                    }
                    else if (pgName == "utilitySearchMsg")
                    {
                        if (count >= 3)
                        {
                            String tmpStr = cell.Text.Replace("<nobr>", "");
                            cell.ToolTip = tmpStr.Replace("</nobr>", "");
                        }
                    }
                    else
                    {
                        if (count >= 4)
                        {
                            String tmpStr = cell.Text.Replace("<nobr>", "");
                            cell.ToolTip = tmpStr.Replace("</nobr>", "");
                        }
                    }
                    count++;
                }
            }
        }
        public void testo(object sender, GridItemEventArgs e)
        {
            if (e.Item is GridPagerItem)
            {
                pgSize = (RadComboBox)e.Item.FindControl("PageSizeComboBox");
                pgSize.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(setSize);
                pgSize.Items.Clear();
                for (int sub = 0; sub < rcb.Items.Count; sub++) {
                    pgSize.Items.Add(new RadComboBoxItem(rcb.Items[sub].Text));
                    pgSize.FindItemByText(rcb.Items[sub].Text).Attributes.Add("ownerTableViewId", this.MasterTableView.ClientID);
                }
            }
        }
        public void setSize()//This is called at the last line in my code behind.
        {
            this.PageSize = pgVal;
            this.MasterTableView.Rebind();
        }

If i remove this line, PageSizeCombo.FindItemByText(e.Item.OwnerTableView.PageSize.ToString()).Selected = true; i can see that the pagesizecombo is showing the correct value but when i click on it, page reloads but the size of rows is not changed. Another problem is when i click on other value, the page reloads and the pagesizecombo selects the default value.

Please help. I've looked for a lot of articles but none seems to fit me.

Regards,
Dexter

Princy
Top achievements
Rank 2
 answered on 23 Sep 2011
1 answer
151 views
Hi,

We have a grid with a GridDropDownColumn, the values for this column are shown as non-breakign space '&nbsp;' when the data is an empty string. This is our column in the grid:
<telerik:GridDropDownColumn FilterControlWidth="250px" DataField="country_id" DataSourceID="sds_countries"
    HeaderText="Country" ListTextField="name" ListValueField="country_id" UniqueName="country_id">
    <FilterTemplate>
        <telerik:RadComboBox ID="ddl_countries" DataSourceID="sds_countries" DataTextField="name"
            DataValueField="country_id" AppendDataBoundItems="true" SelectedValue='<%#  ((GridItem)Container).OwnerTableView.GetColumn("country_id").CurrentFilterValue %>'
            runat="server" OnClientSelectedIndexChanged="CountryChanged">
            <Items>
                <telerik:RadComboBoxItem Text="All" />
            </Items>
        </telerik:RadComboBox>
        <telerik:RadScriptBlock ID="rsb_countries" runat="server">
            <script type="text/javascript">
                function CountryChanged(sender, args) {
                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                    tableView.filter("country_id", args.get_item().get_value(), "EqualTo");
                }
            </script>
        </telerik:RadScriptBlock>
    </FilterTemplate>
    <HeaderStyle Width="180px" />
</telerik:GridDropDownColumn>

I have tried to use the following code on the on item data bound event:
if (e.Item is GridDataItem)
        {
            foreach (TableCell cell in e.Item.Cells)
            {
                cell
                if (cell.Text == " ")
                    cell.Text = "";
            }
        }
   
However our edit column is being overwritten with an empty string. Any help would be appreciated.
Iana Tsolova
Telerik team
 answered on 23 Sep 2011
1 answer
64 views
I have a TreeList control with a page size of 10 which will have multiple pages of data...and I want to make an item on the second page (a) selected and (b) expanded, AND (c) navigate to that item so that we're on second page of data.  I don't see a way to accomplish (c) in server-side code.  Is it possible, or is there a client-side trick that works?
Johny
Top achievements
Rank 1
 answered on 23 Sep 2011
1 answer
178 views
Hi All,

I tried last four hours to implement check and uncheck all nodes in telerik tree view using javascript. but i was not able to achieve.
can any body post the code?

Thanks and regards
Vetrivelmp.
Shinu
Top achievements
Rank 2
 answered on 23 Sep 2011
1 answer
85 views
Hi! I have a problem. I want to localize RadWindow. I use Window with  page .aspx. And I do not know how to locate the controls that are located within these's page.
Shinu
Top achievements
Rank 2
 answered on 23 Sep 2011
9 answers
632 views
I think a nice feature of the RadNumericTextbox would be to have an additional property for removing trailing zeros.

Currently,

If DecimalDigits=4, lets say

User Enters : 1.2, control looses focus and 1.2000 is displayed. Would prefer to see: 1.2 (Ironically, when control has focus trailing zero are removed).

I can think of a couple ways to accomplish this feature.

1) Add a new property RemoveTrailingZeros to the Formatting object. If true then remove trailing zeros.

2) Even better, would be to enhance format strings (Positive and Negative) and for each different style (Focused, ReadOnly, Enabled etc...)  This would provide more flexibility and allow the developer to improve the user experience by having much better control over formatting.

For example, PositivePattern="0.0000" (display trailing zeros) PositivePattern = "0.####" (remove trailing zeros).

I have worked around the issue via some script, but would prefer the control to handle this by default or via format strings.

Thanks for considering this feature request,
Mark.


Steve Napurano
Top achievements
Rank 1
 answered on 23 Sep 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?