Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
55 views

I would like to click on my grid client select column, hit the edit button, and retain the checked/selected state of the item after postback, but for some reason the SelectItems count of the grid is 0 after databinding.

<Rad:RadGrid ID="testgrid"
OnNeedDataSource="testgrid_NeedDataSource"
ClientSettings-Selecting-AllowRowSelect="true"
 runat="server">
    <MasterTableView CommandItemDisplay="Top" EditMode="InPlace">
        <CommandItemTemplate>
            <Asp:LinkButton ID="btnEditSelected" runat="server"
                CommandName="EditSelected"
                EnableViewState="true"
                CausesValidation="false"
                Visible="true"
                Text="Edit"
            />
        </CommandItemTemplate>
        <Columns>
            <Rad:GridClientSelectColumn UniqueName="testselect">
            </Rad:GridClientSelectColumn>
        </Columns>
    </MasterTableView>
</Rad:RadGrid>
 
 
    protected void testgrid_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        IList<string> items = new List<string>();
        items.Add("test");
        testgrid.DataSource = items;
    }
Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
1 answer
305 views
I want to find  <telerik:GridBoundColumn DataField="ID" Visible="false" /> in javascript function.

please suggest for it.
Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
1 answer
95 views
I want to use footer but i dont want to any  grid events .. How can i access that 


function (){

sum += double.Parse((dataItem[templateColumnName].FindControl("ctl00") as RadNumericTextBox).Value.ToString()); 
this work perfect for dataitem 

 (footer[templateColumnName].FindControl("ctl00") as RadNumericTextBox).Value = Double.Parse(sum.ToString());
}
it does not recongnize footer in current context :(



Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
1 answer
99 views
We have been using latest Telerik Ajax controls. As seen in Telerik Demo I am trying to use "InsertCaption" and "EditFormSettings" of EditForm. However it does not display text.I tried code behind to set text however that is also not working. 

Can anyone help.
Jayesh Goyani
Top achievements
Rank 2
 answered on 13 May 2012
1 answer
103 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
579 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
177 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
108 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
167 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
82 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
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?