Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
131 views
The question is in the title :)

Just know that the RadTab are created dynamically, as well as the RadDock.
Is there a way to drag a dock from one tab to another?

Thanks in advance.
Slav
Telerik team
 answered on 27 Feb 2012
1 answer
207 views
In my project i have data entry grid (Rad GRID) with Rad Combo box . problem I am facing is, when I press "Add Row" button,
all rad combo box value changing to first raw of the database table. please help me to sort this issue
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="50">
            <img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>' style="border:0;" />
        </telerik:RadAjaxLoadingPanel>
        <telerik:RadGrid ID="RadGrid1" AllowMultiRowSelection="true" AllowMultiRowEdit="true"
            Skin="WebBlue" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
            Width="97%" PageSize="14" AllowAutomaticUpdates="True" AllowPaging="True" AutoGenerateColumns="False"
            OnNeedDataSource="RadGrid1_NeedDataSource" ShowStatusBar="true" >
            <PagerStyle Mode="Slider" />
            <ClientSettings>
                <Selecting AllowRowSelect="true" />
            </ClientSettings>
            <MasterTableView CommandItemDisplay="Top"  AutoGenerateColumns="False" Width="100%">
                <CommandItemTemplate>
                <div style="padding:10px 0px;">
                                                                              
                    <asp:Button runat="server" ID="btnAdd" Text="Add row" OnClick="btnAdd_Click" />
                      
                    <asp:LinkButton ID="LinkButton1" OnClientClick="javascript:return confirm('Delete all selected Products?')"
                    runat="server" CommandName="DeleteSelected" CausesValidation="false" ><img style="border:0px;vertical-align:middle;" alt="" src="images/Delete.gif" /> Delete</asp:LinkButton>
                        
                    
                    </div>
                </CommandItemTemplate>
                <Columns>
                    <telerik:GridClientSelectColumn HeaderStyle-Width="40px" />
                 
                            
                           <telerik:GridTemplateColumn UniqueName="pk_productid" HeaderText="Product Code" >
                            <FooterTemplate>
                              Template footer</FooterTemplate>
                            <FooterStyle VerticalAlign="Middle" HorizontalAlign="Center" />
                            <ItemTemplate>
                             
                             
                             
                              <telerik:RadComboBox runat="server" ID="RadComboBox1"   AutoPostBack="true"  DataSourceID="sqlproduct"
                              MarkFirstMatch="true" EnableLoadOnDemand="True" DataTextField="pk_productid"
                              OnItemsRequested="RadComboBox1_ItemsRequested" OnClientItemsRequested="UpdateItemCountField"
                              OnDataBound="RadComboBox1_DataBound" OnItemDataBound="RadComboBox1_ItemDataBound"
                              HighlightTemplatedItems="true" Height="140px" Width="220px" DropDownWidth="420px"
                              OnSelectedIndexChanged="OnSelectedIndexChangedHandler" >
                                <HeaderTemplate>
                                  <ul>
                                    <li class="col1">Product Code</li>
                                    <li class="col2">Description</li>
                                  </ul>
                                </HeaderTemplate>
                                <ItemTemplate>
                                  <ul>
                                    <li class="col1">
                                      <%#DataBinder.Eval(Container.DataItem, "pk_productid")%>
                                    </li>
                                    <li class="col2">
                                      <%#DataBinder.Eval(Container.DataItem, "descript")%></li>
                                  </ul>
                                </ItemTemplate>
                                <FooterTemplate>
                                A total of
                                <asp:Literal runat="server" ID="RadComboItemsCount" />
                                items
                            </FooterTemplate>
                              </telerik:RadComboBox>
                           </ItemTemplate>
                          </telerik:GridTemplateColumn>
                            
                                      
                                          
                   
                    <telerik:GridTemplateColumn HeaderText="Quantity" SortExpression="prQty" UniqueName="prqty"
                        EditFormColumnIndex="1">
                        <HeaderStyle Width="80px" />
                        <ItemTemplate>
                             
                            <asp:TextBox runat="server" ID="txtprqty" Text='<%# Bind("prQty", "{0:#.##}") %>'></asp:TextBox>
                        </ItemTemplate>
                    </telerik:GridTemplateColumn>
                </Columns>
                  
            </MasterTableView>
        </telerik:RadGrid><br />
         
                        </div>
                         
                         
                    </div>                      
        
    
        <asp:SqlDataSource ID="sqlds2" runat="server" ConnectionString="<%$ ConnectionStrings:conDB %>"
        SelectCommand="SELECT fk_productID,prqty from tblPurchaserequest where docnum=0">
        </asp:SqlDataSource>
         
        <asp:SqlDataSource ID="sqlProduct" runat="server" ConnectionString="<%$ ConnectionStrings:conDB %>"
        SelectCommand="SELECT TOP 5 pk_productID,descript from tblProduct">
        </asp:SqlDataSource>
         
        <script type="text/javascript">
        function UpdateItemCountField(sender, args) {
            //set the footer text
            sender.get_dropDownElement().lastChild.innerHTML = "A total of " + sender.get_items().get_count() + " items";
        }
        </script>
Protected Sub RadComboBox1_DataBound(ByVal sender As Object, ByVal e As EventArgs)
        'set the initial footer label
        CType(cmbsite.Footer.FindControl("RadComboItemsCount"), Literal).Text = Convert.ToString(cmbsite.Items.Count)
    End Sub
   
  Protected Sub RadComboBox1_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
 
        Dim sql As String = "SELECT * from tblProduct WHERE pk_productID LIKE '%" + e.Text + "%' or descript LIKE '%" + e.Text + "%'"
 
        sqlProduct.SelectCommand = sql
        Dim comboBox As RadComboBox = DirectCast(sender, RadComboBox)
 
        comboBox.DataBind()
    End Sub
 
    Protected Sub RadComboBox1_ItemDataBound(ByVal sender As Object, ByVal e As RadComboBoxItemEventArgs)
        e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("pk_productID").ToString()
        e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("descript").ToString()
    End Sub
 
        
    Protected Sub OnSelectedIndexChangedHandler(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs)
        Session("pk_productid") = e.Value
    End Sub
 
    Protected Sub RadGrid1_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs)
        'Bind the grid to the source
        RadGrid1.DataSource = GetData
        If IsPostBack Then
            ViewState("dt") = dt
            dt = CType(ViewState("dt"), DataTable)
            RadGrid1.DataSource = dt
        End If
 
    End Sub
    Protected Property GetData() As DataTable
        Get
            If ViewState("dt") Is Nothing Then
                dt.Columns.Add("pk_productid", GetType(String))
                dt.Columns.Add("prqty", GetType(Int32))
                dt.Rows.Add("-", 0)
                ViewState("dt") = dt
            Else
                dt = DirectCast(ViewState("dt"), DataTable)
            End If
            Return dt
        End Get
        Set(ByVal value As DataTable)
            'Add the source to viewstate
            ViewState("dt") = value
        End Set
    End Property
    Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs)
       
        dt = CType(ViewState("dt"), DataTable)
         
        For Each dataItem As GridDataItem In RadGrid1.Items
            dt.Rows(dataItem.ItemIndex)("pk_productid") = CType(dataItem("pk_productid").FindControl("RadComboBox1"), RadComboBox).SelectedItem
            dt.Rows(dataItem.ItemIndex)("prqty") = CType(dataItem("prqty").FindControl("txtprqty"), TextBox).Text
Next
    ViewState("dt") = AddRow(dt)
        RadGrid1.Rebind()
    End Sub
   
    Private Function AddRow(ByVal dt As DataTable) As DataTable
        Dim dr As DataRow = dt.NewRow
        dr(0) = "-"
        dr(1) = 0
        dt.Rows.Add(dr)
        
        Return dt
    End Function

ZAFFAR
Top achievements
Rank 1
 answered on 27 Feb 2012
1 answer
130 views
In my aspx page I have a RadPageView which contains RadWindow and the RadGrid is inside the RadWindow. (ie. RadMultiPage -> RadPageView -> RadWindow -> RadGrid).
<telerik:RadWindow EnableShadow="true" ShowContentDuringLoad="false" runat="server"
                                        ReloadOnShow="true" Title="Standard Text: Add Observation." OpenerElementID="lnkObservationsText"
                                        Behaviors="None" VisibleStatusbar="false" EnableViewState="true" ID="rdWndObservationText"
                                        Skin="Web20" Modal="true" Width="600">
                                        <ContentTemplate>
                                            <div class="RadModalMainDiv">
                                                <div>
                                                    <p>
                                                        Help text to go here....</p>
                                                </div>
                                                <div class="divStandardTextButtonList">
                                                    <asp:Button ID="btnObservationsTextSelect" runat="server" Text="Select" CssClass="btnStandardText"
                                                        OnClientClick="return ObservationStandardText_Confirm()" />
                                                    <asp:Button ID="btnObservationsTextCancel" runat="server" Text="Cancel" CssClass="btnStandardText" />
                                                </div>
                                                <asp:Panel ID="pnl1" runat="server">
                                                    <div>
                                                        <telerik:RadGrid ID="radGdObservationsText" runat="server" AllowPaging="True" AllowSorting="True"
                                                            AutoGenerateColumns="False" GridLines="None" PageSize="10" Width="100%">
                                                            <MasterTableView CommandItemDisplay="None" Name="ParentGrid">
                                                                <Columns>
                                                                    <telerik:GridClientSelectColumn UniqueName="ClientSelectColumn">
                                                                    </telerik:GridClientSelectColumn>
                                                                    <telerik:GridBoundColumn DataField="description" HeaderText="Observation Description"
                                                                        Visible="true">
                                                                    </telerik:GridBoundColumn>
                                                                </Columns>
                                                            </MasterTableView>
                                                            <PagerStyle Mode="NextPrevAndNumeric" />
                                                            <ClientSettings>
                                                                <Selecting AllowRowSelect="True" />
                                                                <ClientEvents OnRowSelected="SetObservationStandardText" />
                                                            </ClientSettings>
                                                        </telerik:RadGrid>
                                                    </div>
                                                </asp:Panel>
                                            </div>
                                        </ContentTemplate>
                                    </telerik:RadWindow>

When I try to sort the grid clicking on the header, the page refreshes and the RadWindow disappears. Sorting happens coz when i reopens the RadGrid the rows appea sorted. I need the RadGrid to be sroted and remain in the same state. Thanks for all helps in prior.
Casey
Top achievements
Rank 1
 answered on 27 Feb 2012
6 answers
297 views
Hello

I want to access a control which is in the EditTemplate, when the grid is in edit mode. The control would become visible or not
when user chooses an option from a RadioButtonList(possible when grid in edit mode only), and the only ideea I had was to treat the OnSelectedIndexChanged of the RadioButtonList, and then set the Visible property of some control:
protected void PollDistribPointsTypeOptions_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadioButtonList rbl = sender as RadioButtonList;
        if(rbl.SelectedValue == "0" || rbl.SelectedValue=="2")
            (RadGrid1.EditItems[0] as GridEditableItem)["Poll_DistribPointsType"].Controls[3].Visible = false;
    }

Problem is I only get the controls of the ItemTemplate, not the EditTemplate, where the desired controll exists :(
Is there a workaround for this?

Thx a lot.
Casey
Top achievements
Rank 1
 answered on 27 Feb 2012
4 answers
167 views
hi i update 2 RadGrid and 1 panel while RadTree AjaxRequest
i dun want to show the AjaxLoadingPanel showing on Panel control cs the Panel height is 30px oni
is there away to hide ajaxLoadingPanel for certaincontrol
Maria Ilieva
Telerik team
 answered on 27 Feb 2012
1 answer
172 views
I have a combo box that allows custom text. Is there a way for the combo box to perform a postback each time the text in the combo box is updated, added to or removed from? It seems as though current i have to click away from the combo box or hit enter for a postback to occur.

Also, if the above is possible, is there a way to make it NOT postback if there are items available in the list?

Thank,
Duncan
Dimitar Terziev
Telerik team
 answered on 27 Feb 2012
1 answer
240 views
Hi,

I am tring to create a button outside the RadGrid that will export the grid data.

I am using RadAjaxManagerProxy and added
protected void Page_Load(object sender, EventArgs e)
       {
           RadAjaxManager.GetCurrent(this.Page).ClientEvents.OnRequestStart = "onRequestStart";
           if (!IsPostBack) this.DataBind();
       }
on the client side I've
<telerik:RadButton runat="server" ID="export" OnClientClicked="ExportGrid" />
and the following script code in the head section
<script type="text/javascript">
 
    function ExportGrid(sender, args) {
        var masterTable = $find("<%=RadGrid1.ClientID %>").get_masterTableView();
        masterTable.exportToExcel();
 
    }
    function onRequestStart(sender, args) {
        alert(args.get_eventTarget());
        if (args.get_eventTarget().indexOf("btnExport") >= 0)
            args.set_enableAjax(false);
    }
</script>

The problem is that inlike export from the grid button , this way args.get_eventTarget() is always "ctl00$ContentPlaceHolder1$RadGrid1" and there is no indication if this is export or other action ( I send the insert command using custom button as well)  do  I can't disable the ajax .

Is there a way to overcome this?
Casey
Top achievements
Rank 1
 answered on 27 Feb 2012
1 answer
96 views
I am having a radtreeview with checkboxes. I have around 5000 nodes. Now the check and uncheck works fine with enter key and mouse click. It also works with spacebar key. But when there is a scrollbar in the treeview the treeview is scrolling down on pressing spacebar key. Is this a default behavior, and any ways we can supress this.
Bozhidar
Telerik team
 answered on 27 Feb 2012
3 answers
139 views
Hello,
I need to show a horizontal stackedbar RadChart for several (say, 2) series, each series has one item and with some  limitations for min and max values. I insert below a page with some simple code and attach 2 images. As you can see if orientation is vertical that all is perfect. But when I change orientation to horizontal one I get some exccessive bar after the last bar. Is it a bug ? How can I fix that? I use Q2 2010 version in this project. May be it is fixed in more latest versions?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Stackbar2.aspx.cs" Inherits="Stackbar2" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Charting" 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>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <div>
        <telerik:RadChart ID="RadChart1" runat="server" DefaultType="StackedBar"
            SeriesOrientation="Vertical">
             
            <Series>
                <telerik:ChartSeries Name="Series 1" Type="StackedBar">
                    <Items>
                        <telerik:ChartSeriesItem Name="Item 1" YValue="190">
                        </telerik:ChartSeriesItem>
                    </Items>
                </telerik:ChartSeries>
                <telerik:ChartSeries Name="Series 2" Type="StackedBar">
                    <Items>
                        <telerik:ChartSeriesItem Name="Item 1" YValue="100" >
                        </telerik:ChartSeriesItem>
                    </Items>
                </telerik:ChartSeries>
            </Series>
       
        </telerik:RadChart>
        <br />
         
        <asp:Label ID="lblChartOrientation" runat="server" Text="Series orientation:" />
<asp:RadioButtonList AutoPostBack="true" ID="OrientationList" runat="server" OnSelectedIndexChanged="OrientationList_SelectedIndexChanged">
<asp:ListItem Text="Horizontal" Value="Horizontal" />
<asp:ListItem Text="Vertical" Value="Vertical" Selected="True" />
</asp:RadioButtonList>
    </div>
    </form>
    </body>
    </html>
        
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Charting;
using System.Drawing;
 
public partial class Stackbar2 : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack)
        Settings();
    }
    private void Settings()
    {
        ChartSeriesCollection coll = RadChart1.Series;
        for (int i = 0; i < coll.Count; i++)
        {
 
        }
 
       double yMin=110;
        double yMax=400;
        double step = 50;
        RadChart1.PlotArea.YAxis.AddRange(yMin, yMax, step);
        RadChart1.PlotArea.YAxis.AutoScale = false;
    }
 
    protected void OrientationList_SelectedIndexChanged(object sender, EventArgs e)
    {
        RadChart1.SeriesOrientation = (ChartSeriesOrientation)Enum.Parse(typeof(ChartSeriesOrientation), OrientationList.SelectedValue);
    }
 
}

Giuseppe
Telerik team
 answered on 27 Feb 2012
1 answer
59 views
Sir;

Can we use telerik ajax control to develop application that runs on mobile browsers.
i had created a sample application in which i use simple asp button and a telerik button. and redirected to another page on both button clicks. Asp button click works on mobile browser button telerik button does not works on mobile browser.

Please clear as soon as possible.

Regards
raman singla
Slav
Telerik team
 answered on 27 Feb 2012
Narrow your results
Selected tags
Tags
+? more
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Boardy
Top achievements
Rank 2
Veteran
Iron
Benjamin
Top achievements
Rank 3
Bronze
Iron
Veteran
ivory
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
ClausDC
Top achievements
Rank 2
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?