Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
399 views
Hello,

This is my requirement --

1. I do not want to have the Add New Record button in Grid.
[ I have handled this as below in ItemDataBound event --]

if

(e.Item is GridCommandItem)  

//Hide Addnew and refersh button from code behind  

 

GridCommandItem cmditem = e.Item as GridCommandItem;  

if (cmditem.FindControl("InitInsertButton") != null)

 {

cmditem.FindControl("InitInsertButton").Parent.Visible = false
}

}

2. I have a button "Add New Record" outside the grid, Onclick of this, I want to insert a row in Grid.
Additional Information --
1. I ahve the below piece of code in my aspx page -

<telerik:GridEditCommandColumn UniqueName="EditColumn" ButtonType="ImageButton" HeaderText="Edit"> 

<ItemStyle Width="10%" HorizontalAlign="Center" />
<HeaderStyle Width="10%" HorizontalAlign="Center" /> 

<FooterStyle Width="10%" HorizontalAlign="Center" />
</telerik:GridEditCommandColumn>

2. When I tried the below piece of code on buttn click,

GridName.MasterTableView.ShowFooter = true;
GridName.Rebind(); 
 

I am not getting the Edit image button.

Please suggest.

Marin
Telerik team
 answered on 02 Dec 2011
1 answer
87 views
Hello,

I need to use the raeditor control in order to post a messages within forum. As you know some of the forum messages could contain images, documents, media or other components.
I know how to use the ImageManger, DocumentManger ... dialogs in order to upload that components. But the problem is that these components must be uploaded to the server even before clicking the submit button in order to insert them the content area.

How can I post the forum messages with the diffrent components I mentioned above without uploading to the server until I click the submit button?

Regards,
Bader
Rumen
Telerik team
 answered on 02 Dec 2011
3 answers
241 views
hi all

  Anu one help how to Exportgrid to text file without using "response.write".
Because when export datatable to text file, the full page is also write into that text file.

thanks,
vinoth
Jayesh Goyani
Top achievements
Rank 2
 answered on 02 Dec 2011
4 answers
119 views
Hi

I have a RadComboBox (EnableLoadOnDemand is True) and 3 numeric boxes in Edit Template in a RadGrid.

What I am trying to do is when a user selects a option in the RadComboBox then it populates the Textboxes via its attributes.

I have the following javascript which I have used to do this previously but not in a Grid

                function rcb_Changed(sender, args) {
                    //copy port long/lat to input boxes
                    var item = args.get_item();
                    var Longitude = item.get_attributes().getAttribute("Longitude");
                    var Latitude = item.get_attributes().getAttribute("Latitude");

                     var rtxtLongDegree = $find("<%=rtxtLongDegree.ClientID %>");
                    rtxtLongDegree.set_value(Longitude_Deg);

                }
<telerik:RadComboBox ID="rcbPortList" runat="server" AllowCustomText="false" DropDownWidth="590px"
   EmptyMessage=" - Select a port - " EnableLoadOnDemand="True" Height="150px" HighlightTemplatedItems="true"
   MarkFirstMatch="True" Width="170px" OnClientSelectedIndexChanged="rcb_Changed"
   ShowMoreResultsBox="True" EnableVirtualScrolling="True">

I have tried chaging "<%=rtxtLongDegree.ClientID %>" to the name of the Textbox in the Grid Edit Template but I get an error saying it cannot find the control.

How do I do this is so when I change the ComboxBox in the Grid it populates the textboxes,,... Using Javascript.

Thanks in advance
Ajay
Top achievements
Rank 1
 answered on 02 Dec 2011
6 answers
98 views
Team,

I want to add "show more" and "show less" for RadTreeView control. Please let me know If there is any property for the same or kindly suggest a way to achieve as attached images.

Please find attached!

Thanks & Regards
Ubahariya
Ubahariya
Top achievements
Rank 1
 answered on 02 Dec 2011
3 answers
64 views
We have encountered a problem with recurring scheduling entries. I am not sure if this is caused by a default value or is a limitation that cannot be overcome.
When entering repeating scheduler entries without an end date, it appears that there is a hard stop after 3000 occurrences. After the 3000th entry the next run date is basically empty and no further entries are in the scheduler. Our clients have  events that are recurring on an hourly basis, which would limit the availability of the recurring entry to only 125 days.  Is there a default setting I am missing? 
Peter
Telerik team
 answered on 02 Dec 2011
7 answers
442 views
Hi,

     I am using a RadPanel bar with three panel items. I want to load the controls dynamically in each panel item depends on the panel item expanded.  I have using the client side event  "onclientitemexpand" to generate the postback. In the client side function first i have used  the __doPostBack function to initiate the postback. When I am using __doPostBack the page will be refreshed so i move to  the following ajaxrequest function "$find("<%=ajaxmanager1.ClientID%>").ajaxRequest("PanelItem");.  But nothing will happened that is the page is not postbacked. I attach the code  below.


C#
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Telerik.Web.UI;
using System.Web.UI.WebControls;
 
public partial class RadPanelDemo : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         
 
        CustomContentTemplate1 template1= new CustomContentTemplate1();
        CustomContentTemplate2 template2 = new CustomContentTemplate2();
 
        if (IsPostBack)
        {
            lblpost.Text = "OnPostBack";
        }
 
        foreach (RadPanelItem item in RadPanelBar1.Items)
        {
            if (IsPostBack)
            {
                Response.Write("post");
                item.ContentTemplate = new CustomContentTemplate2();
                template2.InstantiateIn(item);
                item.DataBind();
            }
            else
            {
                Response.Write("load");
                item.ContentTemplate = new CustomContentTemplate1();
                template1.InstantiateIn(item);
                item.DataBind();
            }
                         
        }
 
        ajaxmanager1.AjaxRequest += new RadAjaxControl.AjaxRequestDelegate(ajaxmanager1_AjaxRequest);
    }
 
    void ajaxmanager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
    {
        Response.Write(e.Argument);
    }
}
 
class CustomContentTemplate1 : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Label label1 = new Label();
        label1.Font.Bold = true;
        label1.DataBinding += new EventHandler(label1_DataBinding);
        container.Controls.Add(label1);
    }
 
    private void label1_DataBinding(object sender, EventArgs e)
    {
        Label target = (Label)sender;
        RadPanelItem item = (RadPanelItem)target.BindingContainer;
        
        target.Text ="load";
        //Alternative way:
        //string itemText = (string)DataBinder.Eval(item, "Value"); target.Text = itemText;
    }
}
 
class CustomContentTemplate2 : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Label label1 = new Label();
        label1.Font.Bold = true;
        label1.DataBinding += new EventHandler(label1_DataBinding);
        container.Controls.Add(label1);
    }
 
    private void label1_DataBinding(object sender, EventArgs e)
    {
        Label target = (Label)sender;
        RadPanelItem item = (RadPanelItem)target.BindingContainer;
        target.Text = "post";
        //Alternative way:
        //string itemText = (string)DataBinder.Eval(item, "Value"); target.Text = itemText;
    }
}
 
class CustomContentTemplate3 : ITemplate
{
    public void InstantiateIn(Control container)
    {
        Label label1 = new Label();
        label1.Font.Bold = true;
        label1.DataBinding += new EventHandler(label1_DataBinding);
        container.Controls.Add(label1);
    }
 
    private void label1_DataBinding(object sender, EventArgs e)
    {
        Label target = (Label)sender;
        RadPanelItem item = (RadPanelItem)target.BindingContainer;
        target.Text = item.Value;
        //Alternative way:
        //string itemText = (string)DataBinder.Eval(item, "Value"); target.Text = itemText;
    }
}
ASPX
 
 
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="RadPanelDemo.aspx.cs" Inherits="RadPanelDemo" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<!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>
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript" language="javascript">
 
        function OnClientItemExpand(sender, args) {
 
            $find("<%=ajaxmanager1.ClientID%>").ajaxRequest("arguments");
     
            
        }      
    </script>
    </telerik:RadCodeBlock>
    </head>
<body>
 
    <form id="form1" runat="server">
    <telerik:RadAjaxManager ID="ajaxmanager1" runat="server" EnableAJAX="true" >
    <AjaxSettings >
        <telerik:AjaxSetting AjaxControlID="RadPanelBar1" >
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadPanelBar1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
        <table width="100%">
            <tr style="width:100%">
                <td style="width:100%">
               <%-- <telerik:RadAjaxPanel ID="panel1" runat="server" EnableAJAX="true" >--%>
                    <telerik:RadPanelBar ID="RadPanelBar1" onclientitemexpand="OnClientItemExpand"  ExpandMode="FullExpandedItem"   Width="100%" runat="server">
                        <Items>
                            <telerik:RadPanelItem runat="server" Text="Root RadPanelItem1" PostBack="true"  Value="A">
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem runat="server" Text="Root RadPanelItem2" Value="B">
                            </telerik:RadPanelItem>
                            <telerik:RadPanelItem runat="server" Text="Root RadPanelItem3" Value="C">
                            </telerik:RadPanelItem>
                        </Items>
                    </telerik:RadPanelBar>
                   <%-- </telerik:RadAjaxPanel>--%>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Button ID="post" Text="PostBack" runat="server" />
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Label ID="lblpost" Text="Load" runat="server"></asp:Label>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>

Looking forward your reply.

Kind regards,
Velkumar.

Iana Tsolova
Telerik team
 answered on 02 Dec 2011
8 answers
326 views
Hello,

When I set ReadOnly=true on a RadNumericTextBox via markup, the client event OnFocus() does not fire.
<telerik:RadNumericTextBox CssClass="FarmSerialNumber" ID="rntbAcreageFarmSerialNumber"
    runat="server" Width="40px" Value='<%# DoubleFromDb(Eval("FarmSerialNumber"), true) %>'
    ReadOnly='<%# DoubleFromDb(Eval("FarmSerialNumber"), true) != null %>' MinValue="1">
    <NumberFormat DecimalDigits="0" GroupSeparator="" />
    <IncrementSettings InterceptMouseWheel="false" />
    <ReadOnlyStyle ForeColor="Gray"></ReadOnlyStyle>
    <ClientEvents OnValueChanged="radNumericTextBox_ClientValueChanged" OnFocus="acreageControl_ClientFocus" />
</telerik:RadNumericTextBox>

The documentation does not mention that this doesn't fire when it is readonly.
http://www.telerik.com/help/aspnet-ajax/input-client-side-onfocus.html

To ensure that this is not a problem with the <input> element, I added this and it works fine.
<input type="text" onfocus="alert('Yup.  Works')" readonly="readonly" />

Is this a bug or by design?

Thanks!
Thad
Vasil
Telerik team
 answered on 02 Dec 2011
9 answers
117 views
Hello,
I'm adding new node on client side. When users presses Escape key, I have to delete new node. How do I do that? NodeEdited event wont fire in this case.
3 years ago you promised here to implement this event but nothing has changed.
Thank you.
Plamen
Telerik team
 answered on 02 Dec 2011
1 answer
98 views

I am using the scrolling functionality of the grid in order to load more records if the user scrolls to the bottom of the page.I have taken the examples from the site and changed the data source.  Now when I scroll to the end the grid does not show the additional records.  In the code behind AjaxRequest I can see that the page size is increasing every time i reach the bottom of the page but no loader image shows up and the grid does not show the additional records.

Here is the code
Thank you

protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
     RadGrid1.PageSize = 15 + RadGrid1.PageSize;
     RadGrid1.Rebind();
}
 
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="WebApplication2._Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
 
 
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
      <script type="text/javascript">
          function HandleScrolling(e) {
              var grid = $find("<%=RadGrid1.ClientID %>");
              var scrollArea = document.getElementById("<%= RadGrid1.ClientID %>" + "_GridData");
              if (IsScrolledToBottom(scrollArea)) {
                  var currentlyDisplayedRecords = grid.get_masterTableView().get_pageSize() * (grid.get_masterTableView().get_currentPageIndex() + 1);
                  //if the visible items are less than the entire record count      
                  //trigger an ajax request to increase them   
                  if (currentlyDisplayedRecords < 100)
                  { $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("LoadMoreRecords"); }
              }
          }
          //calculate when the scroll bar is at the bottom   
          function IsScrolledToBottom(scrollArea) {
              var currentPosition = scrollArea.scrollTop + scrollArea.clientHeight;
              return currentPosition == scrollArea.scrollHeight;
          }
      </script>
    </telerik:RadCodeBlock>
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest">
      <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
          <UpdatedControls>
            <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
          </UpdatedControls>
        </telerik:AjaxSetting>
      </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="25">
      <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border: 0;" />
    </telerik:RadAjaxLoadingPanel>
 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1"
      AllowSorting="True" AllowPaging="True" PageSize="15" Width="97%" GridLines="None">
       
      <PagerStyle Visible="False" />
       
      <MasterTableView Width="99%" TableLayout="Fixed" CommandItemDisplay="None" CurrentResetPageIndexAction="SetPageIndexToFirst"
        DataSourceID="SqlDataSource1" PageSize="15">
      </MasterTableView>
       
      <ClientSettings>
        <Scrolling AllowScroll="True" UseStaticHeaders="True" ScrollHeight="100px" />
        <ClientEvents OnScroll="HandleScrolling" />
      </ClientSettings>
    </telerik:RadGrid>
 
 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnection %>"
  SelectCommand="SELECT DisplayName FROM SP_Messages"></asp:SqlDataSource>
</asp:Content>

Mira
Telerik team
 answered on 02 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Shiori
Top achievements
Rank 2
Iron
Tien
Top achievements
Rank 1
Iron
Robert
Top achievements
Rank 1
Rob
Top achievements
Rank 4
Bronze
Bronze
Iron
Geoff
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?