Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
481 views
Hi,

I have a checkbox and a Rad panel bar. When the user checks or unchecks the checkbox, the panel bar must expand or collapse. The onclick event of checkbox is Test()

<script>
function Test()
{
    //Code to expand or collpase the rad panel//----> what should i add here?
}
</script>

Regards
Saravanan
Waseem
Top achievements
Rank 1
 answered on 19 Apr 2013
6 answers
858 views
I have a relatively simple page with a radgrid inserted in a table row. I have set the radgrid width to 100%, the table is set to 100% and body is set to max-width=925px.

When the radgrid renders it fills the table width, however, if the window is subsequently resized to a narrower width, the radgrid stays at the width it was originally displayed at. If I make the window larger, the grid widens to the new width and will not go smaller again.

I have narrowed down the problem to the column headers. I am displaying only one column, and the column header is sized with an inline width value. When the grid grows, the column header also grows because the inline value is updated, presumably through some client-side javascript. However, when the grid narrows, the inline width value never changes.

What happens is that the grid will always grow, but will never shrink.

This problem always happens when the vertical scroll bars are visible. It is intermittent when the scroll bars are not visible.

Adjusting this value through javascript does no good. As soon as the focus is placed on a different item, the headers resize once again.

ideas? workarounds?

I am at a loss for what to do.
Keith
Top achievements
Rank 2
 answered on 19 Apr 2013
8 answers
133 views
I have a grid connected to a datasource and one the the field is a textbox that let the user change values. I want to keep the new values thrue my pagging but everytime I do the bind or rebind the changes do not shows.

thanks in advanced.

Ricardo.
Elliott
Top achievements
Rank 2
 answered on 19 Apr 2013
4 answers
151 views
Hello,
I get an error when I choose an item of a drop down list, that rebinds a grid. With some items of the dropdownlist works fine but with others stop working and I get this error on the browser console:
  1. Uncaught TypeError: Cannot read property 'value' of null
    1. Telerik.Web.UI.RadInputExtender.updateValueTelerik.Web.UI.WebResource.axd:5345
    2. Telerik.Web.UI.RadInputExtender._beforeSubmitTelerik.Web.UI.WebResource.axd:5431
    3. Telerik.Web.UI.RadTextBoxExtender._beforeSubmitTelerik.Web.UI.WebResource.axd:5538
    4. Telerik.Web.UI.RadInputManager._beforeSubmitTelerik.Web.UI.WebResource.axd:5483
    5. Telerik.Web.UI.RadInputManager._onSubmitTelerik.Web.UI.WebResource.axd:5479
    6. Telerik.Web.UI.RadInputManager.WebForm_OnSubmitTelerik.Web.UI.WebResource.axd:5494
    7. (anonymous function)Products_OV.aspx:10
    8. Sys.WebForms.PageRequestManager._onFormSubmitTelerik.Web.UI.WebResource.axd:15
    9. Sys.WebForms.PageRequestManager._doPostBackTelerik.Web.UI.WebResource.axd:15
    10. (anonymous function):1

If I disable AJAX, it works fine, but with AJAX problems happens. I also attach the error that I get from the console.


I also put here part of my code:

This is the index change function:
protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
   {
       ProductRepository productRP = new ProductRepository();
       Filters filters = new Filters();
 
       filters.Add(new Filter("Supplier.Id", SupplierId));
       if (ddlCategory.SelectedValue != "All")
           filters.Add(new Filter("Product.ProductCategory.Id", ddlCategory.SelectedValue.ToString()));
 
       IList<SupplierProduct> supplierProducts = productRP.LoadList<SupplierProduct>(filters);
 
       RadGrid1.DataSource = supplierProducts;
 
      // System.Threading.Thread.Sleep(3000);
       RadGrid1.Rebind();
   }


NeedDataSource:
protected void RadGrid1_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
  {
 
      ProductRepository productRP = new ProductRepository();
      Filters filters = new Filters();
 
      filters.Add(new Filter("Supplier.Id", SupplierId));
      if(ddlCategory.SelectedValue != "All")
      filters.Add(new Filter("Product.ProductCategory.Id", ddlCategory.SelectedValue.ToString()));
     // filters.Add(new Filter("Active","true"));
     // filters.Add(new Filter("Product.Active", "true"));
      IList<SupplierProduct> supProducts = productRP.LoadList<SupplierProduct>(filters);
 
      RadGrid1.DataSource = supProducts;
  }


Page Load:
protected void Page_Load(object sender, EventArgs e)
    {
         
        SupplierId = Session["SupplierId"].ToString();
        if (String.IsNullOrEmpty(SupplierId))
        {
            Response.Redirect("login.aspx");
        }
 
        if (!Page.IsPostBack){
        ProductRepository productRP = new ProductRepository();
        Filters filters = new Filters();
        filters.Add(new Filter("Supplier.Id", SupplierId));
 
        IList<SupplierProductCategory> SupplierProductCategories = productRP.LoadList<SupplierProductCategory>(filters, "ProductCategory.Description");
 
        IList<ProductCategory> ProductCategories = new List<ProductCategory>();
        foreach (SupplierProductCategory supplierProductCategory in SupplierProductCategories)
        {
            ProductCategories.Add(supplierProductCategory.ProductCategory);
        }
      
        ddlCategory.DataSource = ProductCategories;
        ddlCategory.DataBind();
        }
    }


AjaxSettings:

 <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" OnAjaxRequest="RadAjaxManager1_AjaxRequest" 
    ClientEvents-OnRequestStart="mngRequestStarted"
    meta:resourcekey="RadAjaxManager1Resource1">
<AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="RadMenu1" />
                    <telerik:AjaxUpdatedControl ControlID="ddlCategory" />
                    <telerik:AjaxUpdatedControl ControlID="ddlLanguage" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="RadMenu1" />
                    <telerik:AjaxUpdatedControl ControlID="ddlCategory" />
                    <telerik:AjaxUpdatedControl ControlID="ddlLanguage" />
                </UpdatedControls>
            </telerik:AjaxSetting>
 
           <%-- ----excel export----------%>
            <telerik:AjaxSetting AjaxControlID="mngBtnExcel">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                        <telerik:AjaxUpdatedControl ControlID="mngBtnExcel" />
                    </UpdatedControls>
            </telerik:AjaxSetting>
 
            <%-- ----context menu----------%>
            <telerik:AjaxSetting AjaxControlID="RadMenu1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadMenu1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
 
                <telerik:AjaxSetting AjaxControlID="ddlCategory">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="ddlCategory" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
...

Any idea of why this is happening?
I would appreciate any idea for fixing this problem.

Thank you very much,
Jon


Harini
Top achievements
Rank 1
 answered on 19 Apr 2013
1 answer
161 views
I cannot seem to find out where this is set.
I am setting some other properties at runtime like such (VB):

 RadChart1.PlotArea.XAxis.Appearance.MajorTick.Length = 4
                RadChart1.PlotArea.XAxis.Appearance.MajorTick.Color = Color.DarkGreen
                RadChart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45
                              RadChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Calendar Quarter"

Where can I set the font size of the label?

Thanks
Ford
Petar Kirov
Telerik team
 answered on 19 Apr 2013
1 answer
96 views
How can I do to put above the bar(series) some information, like a count or sum from my query?

I need sum two values and to put above the bar. I use StackedBar.

How can I do to change color the label of my series?
(
chartSeries1.Appearance.TextAppearance.TextProperties.Font = new System.Drawing.Font("Arial", 10, System.Drawing.FontStyle.Bold
);) Style and family ok, but color, how can I do?
Petar Kirov
Telerik team
 answered on 19 Apr 2013
0 answers
51 views
 test tes test test
Mohammad
Top achievements
Rank 1
 asked on 19 Apr 2013
1 answer
64 views
I have a chart with Date series. When I don't have a value, on the xaxis ploat a value 0. How can i do to remove when the value = 0?

 
Missing User
 answered on 19 Apr 2013
1 answer
127 views
Hi,

I am converting a VS2008 application to use Telerik controls, and I am starting with RadGrid. In my test I have made a RadGrid that I populate from a linq query. The grid draws fine, paging works and the edit/insert/delete works from the user interface. When I try to do an insert or update I can't seem to get at the underlying data. I have tried a couple ways to do this (based on the online examples) and I'm stumped. I suspect I am missing something simple.

Here is the aspx:



<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/main.Master" CodeBehind="adminMetrics.aspx.vb" Inherits="BPS.adminMetrics" %>
<%@ Register src="controls/nav.ascx" tagname="nav" tagprefix="uc1" %>
<%@ Register src="controls/msg.ascx" tagname="msg" tagprefix="uc2" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="body" runat="server">
    <uc1:nav ID="nav1" runat="server" />
    <uc2:msg ID="msg1" runat="server" />
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="QsfSkinManager" runat="server" ShowChooser="false" />
    <telerik:RadFormDecorator ID="QsfFromDecorator" runat="server" DecoratedControls="All" EnableRoundedCorners="false" />
     
     
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function rowDblClick(sender, eventArgs)
            {
                sender.get_masterTableView().editItem(eventArgs.get_itemIndexHierarchical());
            }
        </script>
    </telerik:RadCodeBlock>
     
    <telerik:RadAjaxManager ID="RadAjaxManager1" DefaultLoadingPanelID="RadAjaxLoadingPanel1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="rgMetrics">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rgMetrics"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    <telerik:AjaxUpdatedControl ControlID="RadInputManager1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             
        </AjaxSettings>
    </telerik:RadAjaxManager>
 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
     
    <telerik:RadGrid ID="rgMetrics" AllowPaging="True" runat="server" AutoGenerateColumns="false" PageSize="10" Width="500px">
        <MasterTableView DataKeyNames="MetricID" CommandItemDisplay="Top" InsertItemPageIndexAction="ShowItemOnCurrentPage"
                AllowPaging="True">
            <Columns>
                <telerik:GridBoundColumn DataField="MetricID" HeaderText="Metric ID" ReadOnly="true" ForceExtractValue="Always" ConvertEmptyStringToNull="true"/>
                <telerik:GridBoundColumn DataField="Name" HeaderText="Name" />
                <telerik:GridDropDownColumn DataSourceID="SqlMetricTypeSource" ListTextField="Name" ListValueField="MetricTypeID" UniqueName="MetricTypeDownDownColumn"
                SortExpression="Name" HeaderText="Metric Type" DropDownControlType="DropDownList" DataField="MetricTypeID"></telerik:GridDropDownColumn>
                <telerik:GridEditCommandColumn ButtonType="ImageButton" />
                <telerik:GridButtonColumn ConfirmText="Delete this metric?" ConfirmDialogType="RadWindow"
                    ConfirmTitle="Delete" ButtonType="ImageButton" CommandName="Delete" />
            </Columns>
            <EditFormSettings>
                <EditColumn ButtonType="ImageButton"/>
            </EditFormSettings>
       </MasterTableView>
       <PagerStyle Mode="NextPrevAndNumeric" />
        <ClientSettings>
            <ClientEvents OnRowDblClick="rowDblClick" />
        </ClientSettings>
    </telerik:RadGrid>
     
    <telerik:RadInputManager runat="server" ID="RadInputManager1" Enabled="true">
        <telerik:TextBoxSetting BehaviorID="TextBoxSetting1">
        </telerik:TextBoxSetting>
         
    </telerik:RadInputManager>
     
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server" />
     
    <asp:SqlDataSource runat="server" ID="SqlMetricTypeSource" ConnectionString="<%$ ConnectionStrings:BPSConnectionString  %>"
        SelectCommand="SELECT MetricTypeID, name FROM bps_MetricType"></asp:SqlDataSource>
         
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="foot" runat="server">
</asp:Content>

Here is the .vb:
Imports Telerik.Web.UI
Imports System.Linq
 
Partial Public Class adminMetrics
    Inherits BaseWebPage
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not emp.HasPemission("Administer Groups") Then
            Response.Redirect("login.aspx")
        End If
 
    End Sub
 
    Private Sub rgMetrics_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles rgMetrics.NeedDataSource
        Dim m As New metric
        rgMetrics.DataSource = m.GetMetrics
    End Sub
 
    Private Sub rgMetrics_UpdateCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgMetrics.UpdateCommand
        Dim editableItem = (DirectCast(e.Item, GridEditableItem))
        Dim MetricID = DirectCast(editableItem.GetDataKeyValue("MetricID"), Integer)
 
        Dim x As New metric
        x.LoadMetric(MetricID)
 
        editableItem.UpdateValues(x.data)
 
        x.Update()
    End Sub
 
    Private Sub rgMetrics_DeleteCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgMetrics.DeleteCommand
        RadAjaxManager1.ResponseScripts.Add(String.Format("window.radalert(""Sorry, deleting tasks is not supported!"")"))
    End Sub
 
    Private Sub rgMetrics_InsertCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rgMetrics.InsertCommand
        Dim editableItem = (DirectCast(e.Item, GridEditableItem))
 
        Dim o As Object
 
        ' Tesing to see if I can manually find a control! (Nope, didn't work)
        For Each o In editableItem.Controls
            If TypeOf o Is TextBox Then
                RadAjaxManager1.ResponseScripts.Add(String.Format("window.radalert(""Found a textbox with a value of " & o.text & """)"))
            End If
        Next
 
        Dim values As New Hashtable()
        editableItem.ExtractValues(values)
 
        Dim x As New metric
        x.data.name = DirectCast(values("name"), String)
        x.data.MetricTypeID = Integer.Parse(values("MetricTypeID").ToString)
        x.Update()
 
    End Sub
 
    Private Sub rgMetrics_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles rgMetrics.ItemCreated
        If TypeOf e.Item Is GridEditableItem AndAlso (e.Item.IsInEditMode) Then
            Dim editableItem As GridEditableItem = DirectCast(e.Item, GridEditableItem)
            SetupInputManager(editableItem)
        End If
 
    End Sub
 
    Private Sub SetupInputManager(ByVal editableItem As GridEditableItem)
        ' style and set ProductName column's textbox as required
        Dim textBox = (DirectCast(editableItem.EditManager.GetColumnEditor("Name"), GridTextBoxColumnEditor)).TextBoxControl
 
        Dim inputSetting As InputSetting = RadInputManager1.GetSettingByBehaviorID("TextBoxSetting1")
        inputSetting.TargetControls.Add(New TargetInput(textBox.UniqueID, True))
        inputSetting.InitializeOnClient = True
        inputSetting.Validation.IsRequired = True
 
        '' style UnitPrice column's textbox
        'textBox = (DirectCast(editableItem.EditManager.GetColumnEditor("UnitPrice"), GridTextBoxColumnEditor)).TextBoxControl
 
        'inputSetting = RadInputManager1.GetSettingByBehaviorID("NumericTextBoxSetting1")
        'inputSetting.InitializeOnClient = True
        'inputSetting.TargetControls.Add(New TargetInput(textBox.UniqueID, True))
 
        '' style UnitsInStock column's textbox
        'textBox = (DirectCast(editableItem.EditManager.GetColumnEditor("UnitsInStock"), GridTextBoxColumnEditor)).TextBoxControl
 
        'inputSetting = RadInputManager1.GetSettingByBehaviorID("NumericTextBoxSetting2")
        'inputSetting.InitializeOnClient = True
        'inputSetting.TargetControls.Add(New TargetInput(textBox.UniqueID, True))
    End Sub
 
    Protected Sub rgMetrics_ItemDeleted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridDeletedEventArgs) Handles rgMetrics.ItemDeleted
        If e.Exception IsNot Nothing Then
            e.ExceptionHandled = True
            ShowErrorMessage()
        End If
    End Sub
 
    Protected Sub rgMetrics_ItemInserted(ByVal source As Object, ByVal e As Telerik.Web.UI.GridInsertedEventArgs) Handles rgMetrics.ItemInserted
        If e.Exception IsNot Nothing Then
            e.ExceptionHandled = True
            ShowErrorMessage()
        End If
    End Sub
 
    Protected Sub rgMetrics_ItemUpdated(ByVal source As Object, ByVal e As Telerik.Web.UI.GridUpdatedEventArgs) Handles rgMetrics.ItemUpdated
        If e.Exception IsNot Nothing Then
            e.ExceptionHandled = True
            ShowErrorMessage()
        End If
    End Sub
 
    ''' <summary>
    ''' Shows a <see cref="RadWindow"/> alert if an error occurs
    ''' </summary>
    Protected Sub ShowErrorMessage()
        RadAjaxManager1.ResponseScripts.Add(String.Format("window.radalert(""Please enter valid data!"")"))
    End Sub
 
 
 
    Protected Sub rgMetrics_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles rgMetrics.PreRender
        If (Not IsPostBack AndAlso rgMetrics.MasterTableView.Items.Count > 0) Then
            rgMetrics.MasterTableView.Items(1).Expanded = True
        End If
    End Sub
 
     
End Class

Thanks for any help, I'm stumped!

Vasil
Telerik team
 answered on 19 Apr 2013
15 answers
356 views
I am working on an interface where the basic concept is to have multiple RadWindows open within a single browser. Each window will contain different things, reports, tools, administration interfaces, etc... The way this is meant to be used means I would not be able to have a predefined set of RadWindow controls in the aspx. I have been trying to open the windows client-side using the following code:

function OpenWindow() {
            var oWnd = radopen("http://localhost/MAG_ConsoleServer/Platform_EmailManagement.aspx");
            oWnd.set_title("Email Management");
            //oWnd.setSize(1055, 690);
            oWnd.set_height(690);
            oWnd.set_width(1055);
            oWnd.set_top(38);
            oWnd.set_left(108);
            oWnd.show();
            return false;
        }

The above code will open a window however the size settings (I've tried both set_height/set_width and setSize) do not work, nor do the positioning settings. The only way I can get these settings to work is if I define the RadWindow in the aspx, and do a $find for the control instead of a RadOpen. 

I'm also having issues with the client events for the RadWindow. If I try setting javascript handlers for things like OnClientDragEnd or OnClientResizeEnd, then I am finding more weird behavior. Defining the events in the RadWindowManager control itself results in those events firing on pageload multiple times per defined window, my count is 4 per window. If I define those events in a RadWindow control in the aspx itself then I get the event at the right time, however I get the following error for the OnClientDragEnd and similar errors for the other events: 

Uncaught TypeError: Property '0' of object  is not a function Telerik.Web.UI.WebResource.axd:6
(anonymous function) Telerik.Web.UI.WebResource.axd:6
Telerik.Web.UI.RadWebControl.raiseEvent Telerik.Web.UI.WebResource.axd:785
a.RadWindow.onDragEnd Telerik.Web.UI.WebResource.axd:6692
a.ResizeExtender._raiseDragEvent Telerik.Web.UI.WebResource.axd:5825
a.ResizeExtender._onDocumentMouseUp Telerik.Web.UI.WebResource.axd:5982
(anonymous function) Telerik.Web.UI.WebResource.axd:6

Can someone help me figure this out so I can move forward with this concept? Between the errors and the inconsistent functionality I am stuck. 
Mike
Top achievements
Rank 1
 answered on 19 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Top users last month
Miljana
Top achievements
Rank 2
Iron
Iron
Joel
Top achievements
Rank 3
Bronze
Bronze
Bronze
Cynthia
Top achievements
Rank 1
John
Top achievements
Rank 1
Iron
Mozart
Top achievements
Rank 1
Iron
Veteran
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?