Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
126 views
i tried to make a direct using an ImageButtonColumn but i was unable to put it together using this link.  http://www.telerik.com/community/forums/aspnet-ajax/grid/select-row-through-telerik-linkbutton-and-redirect.aspx

How would I make a redirect using the imagebuttoncolumn?

The code i'm using is below:

                        <telerik:GridButtonColumn DataType="System.String" FooterText="Vallet" DataTextFormatString="Vallet {0}"
                        ButtonType="ImageButton" UniqueName="valletimagebutton" HeaderText="Vallet" ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                        CommandName="CarLot_RadGrid_Redirect" DataTextField="VIN" ImageUrl="images/valletcarlot.jpg">
                    </telerik:GridButtonColumn>.
Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
5 answers
633 views

Hello,

I have a 'record update' feature enabled grid (2012 Q1).
I am using <FormTemplate> for editing/updating the data on the grid.
In the FormTemplate, I have a RadioButtonList named 'rdGrade' which is bound to the 'SchoolGrade' field in my database. The code for this RadioButtonList is as shown below.

<asp:RadioButtonList ID="rdGrade" runat="server"
SelectedValue='<%# Bind("SchoolGrade") %>'
DataSource='<%# (new string[] { "4", "5", "6" }) %>'
AppendDataBoundItems="True"
RepeatDirection="Horizontal">
</asp:RadioButtonList>

Editing the SchoolGrade field with this RadioButtonList was fine. No errors.
But when I try to Add a new record by clicking the "+ Add new record" button, I get an error. So I had to add some extra code to the code behind page to set the default selected value of this RadioButtonList and the code I added was:

protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
     {
            if (e.CommandName == RadGrid.InitInsertCommandName)
            {
                //Add new" button clicked
                e.Canceled = true;
                //Prepare an IDictionary with the predefined values
                System.Collections.Specialized.ListDictionary newValues = new
                System.Collections.Specialized.ListDictionary();
                newValues["SchoolGrade"] = 5;
                //Insert the item and rebind
                e.Item.OwnerTableView.InsertItem(newValues);
            }
        }

The code above sets the default selected value of the radio button list as 5.
My question is how do I change the code line

newValues["SchoolGrade"] = 5;

 

in order to initially UNCHECK the RadioButtonList rdGrade when a user clicks the 'Add new record' button on the grid?

Thank you.


Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
7 answers
226 views
Is there a way to handle a client side and/or server side event when a node is selected using the keyboard arrow keys?

Thanks,
Alex
Fabrizio
Top achievements
Rank 1
 answered on 12 May 2012
1 answer
154 views
Hi,

I am testing out the Drag/Drop capabilities of the RadGrid (dragging from one grid to another), and I've come across a problem. It works great when the grid I'm dragging from has more than one row, but if there's one row I get the following JScript error thrown:

Microsoft JScript runtime error: Unable to get value of the property 'rows': object is null or undefined

Here's my ASPX markup:

    <script type="text/javascript">
 
        function OnClientUpdated(sender, args) {
            var message = "Update (check) was done!";
            var newMsgs = sender.get_value();
            if (newMsgs != 0) {
                sender.show();
                message += (newMsgs == 1) ? (" There is 1 new message!") : (" There are " + newMsgs + " new messages!");
            }
            else {
                message += " There are no new messages!";
            }
        }
         
    </script>
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadScriptBlock runat="server" ID="scriptBlock">
 
        <script type="text/javascript">
                <!--
            function onRowDropping(sender, args) {
                if (sender.get_id() == "<%=RadGrid1.ClientID %>") {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('<%=RadGrid2.ClientID %>', node) && !isChildOf('<%=RadGrid1.ClientID %>', node)) {
                        args.set_cancel(true);
                    }
                }
                else {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('trashCan', node)) {
                        args.set_cancel(true);
                    }
                    else {
                        if (confirm("Are you sure you want to delete this order?"))
                            args.set_destinationHtmlElement($get('trashCan'));
                        else
                            args.set_cancel(true);
                    }
                }
            }
 
            function isChildOf(parentId, element) {
                while (element) {
                    if (element.id && element.id.indexOf(parentId) > -1) {
                        return true;
                    }
                    element = element.parentNode;
                }
                return false;
            }
                    -->
        </script>
 
    </telerik:RadScriptBlock>
     <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
         <telerik:RadSplitter ID="RadSplitter1" Width="100%" runat="server">
         <telerik:RadPane runat="server">
   <telerik:RadGrid ID="RadGrid1" runat="server" AllowFilteringByColumn="true"
                 onneeddatasource="RadGrid1_NeedDataSource" onrowdrop="RadGrid1_RowDrop">
   <MasterTableView AllowCustomSorting="true" AllowPaging="true" DataKeyNames="ID" AllowSorting="true" PageSize="20">
   
   </MasterTableView>
     <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                          <ClientEvents OnRowDropping="onRowDropping" />
                </ClientSettings>
</telerik:RadGrid>     
         </telerik:RadPane>
         <telerik:RadSplitBar runat="server"></telerik:RadSplitBar>
         <telerik:RadPane runat="server">
   <telerik:RadGrid ID="RadGrid2" runat="server" AllowFilteringByColumn="true"
                 onneeddatasource="RadGrid2_NeedDataSource" onrowdrop="RadGrid2_RowDrop">
   <MasterTableView AllowCustomSorting="true" DataKeyNames="ID" AllowPaging="true" AllowSorting="true" PageSize="20">
   
   </MasterTableView>
     <ClientSettings AllowRowsDragDrop="True" AllowColumnsReorder="true" ReorderColumnsOnClient="true">
                    <Resizing AllowColumnResize="true" />
                             <ClientEvents OnRowDropping="onRowDropping" />
 
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false"/>
                    <Scrolling AllowScroll="true" UseStaticHeaders="true"/>
                </ClientSettings>
</telerik:RadGrid>     
          
         </telerik:RadPane>
         
         </telerik:RadSplitter>
    
</telerik:RadAjaxPanel>
 
  <telerik:RadNotification ID="RadNotification1" runat="server" LoadContentOn="TimeInterval"
        Width="300" Animation="Fade" EnableRoundedCorners="true" EnableShadow="true"
        OnClientUpdated="OnClientUpdated" Title="Notifications" OffsetX="-20" OffsetY="-20"
        TitleIcon="none" UpdateInterval="10000" AutoCloseDelay="1500" OnCallbackUpdate="OnCallbackUpdate">
        <ContentTemplate>
            <asp:Literal ID="lbl" runat="server"></asp:Literal>
        </ContentTemplate>
    </telerik:RadNotification>

Here's my code behind:

public IList<Delivery> _Deliveries
        {
            get { return (List<Delivery>)Session["Deliveries"]; }
            set { Session["Deliveries"] = value; }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                _Deliveries = new List<Delivery>();
                _Deliveries.Add(new Delivery { ID = 1, Assigned = false, Customer = "Micross", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 2, Assigned = false, Customer = "Test", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 3, Assigned = false, Customer = "Micross3", TripDate = DateTime.Today });
                _Deliveries.Add(new Delivery { ID = 4, Assigned = false, Customer = "Test3", TripDate = DateTime.Today });
 
                RadGrid1.DataBind();
            }
        }
 
        private void BindMain()
        {
            RadGrid1.DataBind();
        }
 
        private void BindSecond()
        {
            RadGrid2.DataSource = _Deliveries.Where(a => a.Assigned == true);
            RadGrid2.DataBind();
        }
 
 
 
        protected void OnCallbackUpdate(object sender, RadNotificationEventArgs e)
        {
            int newMsgs = DateTime.Now.Second % 10;
            if (newMsgs == 5 || newMsgs == 7 || newMsgs == 8 || newMsgs == 9) newMsgs = 0;
            lbl.Text = String.Concat(new object[] { "You have ", newMsgs, " new invoices to process!" });
            RadNotification1.Value = newMsgs.ToString();
        }
 
        protected void RadGrid2_RowDrop(object sender, GridDragDropEventArgs e)
        {
                foreach (GridDataItem draggedItem in e.DraggedItems)
                {
                    var tmpOrder = _Deliveries.Where(a => a.ID == (long)draggedItem.GetDataKeyValue("ID")).Single();
                    tmpOrder.Assigned = false;
                }
 
                RadGrid1.Rebind();
                RadGrid2.Rebind();
           
        }
 
        protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid1.DataSource = _Deliveries.Where(a => a.Assigned == false);
 
        }
 
        protected void RadGrid2_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        {
            RadGrid2.DataSource = _Deliveries.Where(a => a.Assigned == true);
 
        }
 
        protected void RadGrid1_RowDrop(object sender, GridDragDropEventArgs e)
        {
 
                foreach (GridDataItem draggedItem in e.DraggedItems)
                {
                    var tmpOrder = _Deliveries.Where(a => a.ID == (long)draggedItem.GetDataKeyValue("ID")).Single();
                    tmpOrder.Assigned = true;
                }
                RadGrid1.Rebind();
                RadGrid2.Rebind();
          
        }

Thanks!
Chris
Top achievements
Rank 1
 answered on 12 May 2012
2 answers
212 views
Hi Team,


        Today, I got strange error on Ajax Manager & Panel. Let me explain my test case. I have 1 text box and ontextchanged event of that textbox. Inside ontextchange event i updated current dattime to label control. All controls are inside asp:panel. After textchanged Ajax Manager will auto update my asp:panel.

         My error is after 1st time text change i can't type any text into text box if i didn't cursor move to other text box. It means i can type only one time at text box without cursor move to other. That error i face at IE8 and IE9. That error will get after press enter and lost cursor if i use tab key.

         Why i got this error on IE? Is it bug or my code wrong? I try to do that because of my require is same this case and all user are using IE only.

Noted: AjaxManager and Panel are same error.

Kindly please help to me. I need urgent for this case.

Sample Code aspx

Default3.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="_txtBox" EventName="OnTextChanged">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="_pnlLine" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="_txtDock" EventName="OnTextChanged">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="_pnlDock" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <div>
            <asp:Panel runat="server" ID="_pnlLine">
                <asp:Label runat="server" ID="_lblTime" Text="Time"></asp:Label><br />
                <asp:TextBox runat="server" ID="_txtBox" OnTextChanged="_txtBox_TextChanged" AutoPostBack="true"></asp:TextBox><br />
                <asp:TextBox runat="server" ID="TextBox1" Text="Nothing"></asp:TextBox>
            </asp:Panel>
        </div>
        <div>
            <telerik:RadDockLayout ID="rdlayout" runat="server" EnableEmbeddedSkins="true">
                <telerik:RadDockZone ID="rdZone" runat="server" Orientation="Vertical" Width="890px"
                    FitDocks="true" CssClass="margin-top: 100px">
                    <telerik:RadDock ID="AddLine" runat="server" DefaultCommands="ExpandCollapse" DockMode="Docked"
                        Width="780px" Title="Testing">
                        <ContentTemplate>
                            <div>
                                <asp:Panel runat="server" ID="_pnlDock">
                                    <asp:Label runat="server" ID="_lblDock" Text="Time"></asp:Label><br />
                                    <asp:TextBox runat="server" ID="_txtDock" OnTextChanged="_txtDock_TextChanged" AutoPostBack="true"></asp:TextBox><br />
                                    <asp:TextBox runat="server" ID="TextBox3" Text="Nothing"></asp:TextBox>
                                </asp:Panel>
                            </div>
                        </ContentTemplate>
                    </telerik:RadDock>
                </telerik:RadDockZone>
            </telerik:RadDockLayout>
        </div>
    </div>
    </form>
</body>
</html>

CB of Default3.aspx

using System;
 
public partial class Default3 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
 
    }
    protected void _txtBox_TextChanged(object sender, EventArgs e)
    {
        _lblTime.Text = System.DateTime.Now.ToString();
    }
 
    protected void _txtDock_TextChanged(object sender, EventArgs e)
    {
        _lblDock.Text = System.DateTime.Now.ToString();
    }
}

Regards,
Alex
ALEX
Top achievements
Rank 1
 answered on 12 May 2012
1 answer
106 views
Hi,

I implemented comboBox following scenarios.
A defined asp page of master page has a web user control 1 (UC1), UC1 contains another web user control (UC2) which has a radcombox control.  It messes up on display and can not select with the custom skin which I defined.  It works with simple a page -> web user control but not with above case.

my telerik v2009.3.1208.35,

Kind Regards,

Duy
Ivana
Telerik team
 answered on 12 May 2012
9 answers
477 views
Hi,
I have a page with a RadSplitter taking 100% height and width. Inside this I have two RadPanes (vertical) correctly fitting the page.
If I put a RadGrid with a number of records that would exceed the page height inside one of the two panes it happens that the RadGrid is correctly represented  inside the pane with vertical scroll bar that is correctly contained inside the RadPane, but the page gets an additional vertical scroll bar that would scroll the page to all the height of the table...which is not shown ! (Two screen shots are attached).
This behavior shows up in IE, Firefox, Safari, ect....so it is not browser dependent. 
I've tried many...adjustments including adjusting ScrollHeight but without any change in the behavior of the page.
Help !

Thanks a lot as always.
Irwin
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
156 views
I am trying to bind a grid to this xml

<?xml version="1.0" encoding="utf-8"?>
<Sites>
  <Site Name="Name" URL="www.google.com" >
    <KPIData StartDate="2012-04-01"></KPIData>
  </Site>
 
</Sites>


It works apart from the last column and I can't work out how to get it to appear.  I suspect it needs a selector but haven't been able to find out how to do it.  Here is my ASPX page

<Columns>
      <telerik:GridBoundColumn DataField="Name"
          FilterControlAltText="Filter Name column" HeaderText="Site Name" SortExpression="Name"
          UniqueName="Name">
      </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="URL"
          FilterControlAltText="Filter URL column" HeaderText="URL" SortExpression="URL"
          UniqueName="URL">
      </telerik:GridBoundColumn>
      <telerik:GridBoundColumn DataField="GATableID"
          FilterControlAltText="Filter GATableID column" HeaderText="GA Profile Id" SortExpression="GATableID"
          UniqueName="GATableID">
      </telerik:GridBoundColumn>
 
 
       <telerik:GridBoundColumn DataField="/KPIData[@StartDate]"
          FilterControlAltText="Filter StartDate column" HeaderText="StartDate" SortExpression="StartDate"
          UniqueName="StartDate">
      </telerik:GridBoundColumn>
  </Columns>
Richard
Top achievements
Rank 1
 answered on 11 May 2012
13 answers
229 views
Im using FileExplorer to display a directory in which the user can "file away" into our document management program. A request came in for us to delete the directory if it becomes empty. This is no problem but fileexplorer is still pointing at the directory that has now been removed. Any suggestions? Im using CustomFileSystemProvider as outlined in http://www.telerik.com/support/kb/aspnet-ajax/editor/physical-paths-and-different-content-types.aspx for the deletion of the directory i've tried several things including

CustomFileSystemProvider myProvider = (CustomFileSystemProvider)Session["myCustomFileSystemProvider"];
myProvider.DeleteDirectory(RadFileExplorer1.TreeView.SelectedValue);
Fred
Top achievements
Rank 1
 answered on 11 May 2012
1 answer
78 views
Hi,

Can we edit rows when radgrid is generated with AutoGenerateColumns="true".


Regards,
Akki
Kshitiz
Top achievements
Rank 1
 answered on 11 May 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Jake
Top achievements
Rank 1
RBarnes
Top achievements
Rank 1
Iron
Iron
Rami
Top achievements
Rank 1
Iron
Veteran
Nathan
Top achievements
Rank 1
Kumeri
Top achievements
Rank 1
Iron
Veteran
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?