Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
112 views
I'm using External Edit in RadDock BUT I'm using EntityDataSources rather than SessionDataSources. On editing an appointment with my custom form (in the RadDock) the database is correctly updated but the RadScheduler is redrawn before the data update so it appears not to update on the page.
  • I've checked with Firebug and it definitely does make the ajax call and redraw with the pre-edit data, thus the problem is not that the AjaxManager fails to call (which was my first thought).
  • If I click on the today link (or in any way cause the RadScheduler to redraw again) all is well, the data is correctly displayed.
  • Immediately after editing the appointment the context menu (on the edited appointment only) fails, i.e. no longer comes up with the custom (EDIT and DELETE) but right click shows the browser's context menu. (Hovering on the appointment at this point gives a javascript error that l is null in this)
    var k=(l._allowDelete!=null)?l.get_allowDelete():this.get_allowDelete();
    Again a reload fixes this.
  • Drag and drop works
  • Delete works
  • Completely removing the RadAjaxManager (so the whole page reloads) does not change the behavior, still getting the pre-edit data back and the context menu problem.

Any Ideas?

Boyan Dimitrov
Telerik team
 answered on 29 Apr 2013
9 answers
248 views
Dear All,

I am using Telerik RAD Grid in my ASP.NET Application. The aspx form has more control so vertical scroll is enabled. when RAD Grid is in bottom or due to more data in the grid, current position of the form is at the bottom with scrolled down. if I add new item to grid, Edit Form is not visible, since it is appearing at the top of the form which is not in visible to user. 
The code I used for EditFOrm Popup is given below.

popUp = eventArgs.get_popUp();
popUp.style.position = "fixed";
var gridWidth = sender.get_element().offsetWidth - 100;
var gridHeight = sender.get_element().offsetHeight + 400;
var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
popUp.style.left = ((gridWidth) / 2 + sender.get_element().offsetLeft).toString() + "px";
popUp.style.top = ((gridHeight) / 2 + sender.get_element().offsetTop).toString() + "px";



I tried with the following code which is not working in RAD Windows (My form is part of RAD Windows and appear like modal popup) and in normal form also it is misbehaving.

var myWidth = 0, myHeight = 0;
if (typeof (window.innerWidth) == 'number')
{
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
}
else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight))
{
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
}
else if (document.body && (document.body.clientWidth || document.body.clientHeight))
{
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
}
 
popUp = eventArgs.get_popUp();
popUp.style.position = "fixed";
var gridWidth = myWidth;
var gridHeight = myHeight;
var popUpWidth = popUp.style.width.substr(0, popUp.style.width.indexOf("px"));
var popUpHeight = popUp.style.height.substr(0, popUp.style.height.indexOf("px"));
popUp.style.left = ((gridWidth - popUpWidth) / 2) + "px";
popUp.style.top = ((gridHeight - popUpHeight) / 2) + "px";

Kindly Requesting your guidance on the same.


With Regards
Palanivelrajan.L
Angel Petrov
Telerik team
 answered on 29 Apr 2013
6 answers
312 views
Hi,

I have a grid doing an inline update to a stored procedure.  But I do not know how to get the value of the grid column passed as a parmater to the stored procedure using VS12 VB aspx.   Here is partial code.

           <telerik:RadGrid ID="dgPlans" GridLines="None" runat="server" AllowAutomaticDeletes="True"
              AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True"
              AutoGenerateColumns="False" CellSpacing="0" Width="716px" DataSourceID="sqlPlans"  

        <telerik:GridDropDownColumn DataField="PlanId" DataSourceID="sqlGetPlans"
            HeaderText="Plan" ListTextField="ippPlan" ListValueField="PlanId"
            UniqueName="ippPlanId" ColumnEditorID="GridDropDownColumnEditor1">
        </telerik:GridDropDownColumn>
    

            UpdateCommand="sp_Update_Plan" UpdateCommandType="StoredProcedure"

            <UpdateParameters>
                <asp:Parameter Name="EffectiveDate" Type="Datetime"></asp:Parameter>
                <asp:Parameter Name="ExpirationDate" Type="Datetime"></asp:Parameter>
                <asp:Parameter Name="Split" Type="Decimal"></asp:Parameter>
                <asp:Parameter Name="Level" Type="String"></asp:Parameter>
                <asp:Parameter Name="PlanId" Type="Int32"></asp:Parameter>
            </UpdateParameters>

Like I said the stored procedure name on my SQL box is sp_Update_Plan and it takes several params.  But what is used as the @ piece of the parameter? What part of the radgrid become the @piece to pass to my SP? The uniquename? The Datafield has to match the @parameter?

All the examples I have seen just have the SQL statement in the updatecommand I need to use as stored procedure.

thanks,

 


 

Maria Ilieva
Telerik team
 answered on 29 Apr 2013
5 answers
131 views
Hi,
I would like to set RowHeader cells' width individually. I use below code;
<telerik:PivotGridRowField DataField="INVENTSITE" Caption="Üretim Mer.">
                            <CellStyle Width="105" />
</telerik:PivotGridRowField>
But it seems this does not effect, somehow rendered output overwrites width value. I can see the cell property like style="width:105px;" with FireBug but computed values are different, actually wider. I need to fix this problem, because I have a cell that needs to be wider so that text inside this cell can be read. Please refer to attached image to see the problem. For example I set cell (line #1) width to 100px and cell (line #2) to 200px (so the text can be read) but no way. All my data and layout is as seen. How can I fix this problem?

TIA
Maria Ilieva
Telerik team
 answered on 29 Apr 2013
1 answer
127 views
Hi
i have question when i change from C# to vb  in default.aspx   the loaded control in content work but the problem  if i sort the datagrid its disappear ,same code for c# work Fine sort grid filtering .... ,  but when translate to vb this problem come ,  so i thing problem here when i make translation to vb



 C# Code
using System;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web.UI;
using System.Web.UI.WebControls;
 
using Telerik.Web.UI;
using Telerik.Web.UI.Calendar;
 

public partial class _Default : Page, IViewSelector
{
    private const string ViewsFolder = "~/Views/";
    private const string DefaultContentControl = "Statistics.ascx";

    private string LoadedControlName
    {
        get
        {
            return (string)ViewState["LoadedControlName"] ?? DefaultContentControl;
        }

        set
        {
            ViewState["LoadedControlName"] = value;
        }
    }

    private int EmployeeID
    {
       

        get
        {
            if (Session["EmployeeID"] == null)
            {
                Session["EmployeeID"] = 1;
            }

            return (int) Session["EmployeeID"];
        }
        set
        {
            Session["EmployeeID"] = value;
        }
    }

    private DateTime StartDate
    {
        get
        {
            return StartDatePicker.SelectedDate.Value;
        }
    }

    private DateTime EndDate
    {
        get
        {
            return EndDatePicker.SelectedDate.Value;
        }
    }

    

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            EmployeesListView.Rebind();
            EmployeesListView.SelectedIndexes.Add(0);
        }
        LoadContent();
    }

    public void SelectView(string viewName)
    {
        var tab = ViewChooser.Tabs.FindTabByText(viewName);
        if (tab != null)
            tab.Selected = true;

        UpdateSelectedView();
    }

    protected void ViewChooser_TabClick(object sender, RadTabStripEventArgs e)
    {
        UpdateSelectedView();
    }

    private void LoadContent()
    {
        var control = LoadControl(ViewsFolder + LoadedControlName);
        control.ID = "contentControl";
        var contentControl = control as IContentControl;

        if (contentControl != null)
        {
            contentControl.EmployeeID = EmployeeID; // from ListView
            contentControl.StartDate = StartDate;
            contentControl.EndDate = EndDate;
        }

        var userDetailsPanel = (UserDetails) as IContentControl;
        userDetailsPanel.EmployeeID = EmployeeID;
        userDetailsPanel.StartDate = StartDate;
        userDetailsPanel.EndDate = EndDate;

        Content.Controls.Clear();
        Content.Controls.Add(control);
    }

    protected void UpdateSelectedView()
    {
        string selectedControl = ViewChooser.SelectedTab.Value;
        if (selectedControl != LoadedControlName)
        {
            LoadedControlName = selectedControl;
            LoadContent();
        }
    }

    public string GetSalesPercentage(int employeeID)
    {

        var empSales = 222;
        return (empSales * 100).ToString("F0");
    }

    protected void PagerSlider_ValueChanged(object sender, EventArgs e)
    {
        string newValue = (sender as RadSlider).Value.ToString();
        EmployeesListView.Items[0].FireCommandEvent(RadListView.PageCommandName, newValue);
    }

    protected void EmployeesListView_NeedDataSource(object sender, RadListViewNeedDataSourceEventArgs e)
    {
       
    }

    protected void EmployeesListView_SelectedIndexChanged(object sender, EventArgs eventArgs)
    {
        EmployeeID = int.Parse(EmployeesListView.SelectedValue.ToString());     
        LoadContent();
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "hide", "HideLoadingPanel()", true);
    }

    protected override void OnPreRenderComplete(EventArgs e)
    {
        base.OnPreRenderComplete(e);

        // Make the EmployeeID available to scripts
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "employeeID" ,
            "function getEmployeeID()    { return " + EmployeeID + "; }", true);
    }

    protected void SelectedDataChanged(object sender, SelectedDateChangedEventArgs e)
    {
        LoadContent();
    }
}






VB Code

Imports System.Configuration
Imports System.Data.SqlClient
Imports System.Linq
Imports System.Web.UI
Imports System.Web.UI.WebControls

Imports Telerik.Web.UI
Imports Telerik.Web.UI.Calendar
Partial Class Default3
    Inherits Page
    Implements IViewSelector
    Private Const ViewsFolder As String = "~/Views/"
    Private Const DefaultContentControl As String = "Statistics.ascx"

    Private Property LoadedControlName() As String
        Get
            Return If(DirectCast(ViewState("LoadedControlName"), String), DefaultContentControl)
        End Get

        Set(value As String)
            ViewState("LoadedControlName") = value
        End Set
    End Property

    Private Property EmployeeID() As Integer


        Get
            If Session("EmployeeID") Is Nothing Then
                Session("EmployeeID") = 1
            End If

            Return CInt(Session("EmployeeID"))
        End Get
        Set(value As Integer)
            Session("EmployeeID") = value
        End Set
    End Property

    Private ReadOnly Property StartDate() As DateTime
        Get
            Return StartDatePicker.SelectedDate.Value
        End Get
    End Property

    Private ReadOnly Property EndDate() As DateTime
        Get
            Return EndDatePicker.SelectedDate.Value
        End Get
    End Property



    Protected Sub Page_Load(sender As Object, e As EventArgs)
        If Not IsPostBack Then
            EmployeesListView.Rebind()
            EmployeesListView.SelectedIndexes.Add(0)
        End If
        LoadContent()
    End Sub

    Public Sub SelectView(viewName As String)
        Dim tab = ViewChooser.Tabs.FindTabByText(viewName)
        If tab IsNot Nothing Then
            tab.Selected = True
        End If

        UpdateSelectedView()
    End Sub

    Protected Sub ViewChooser_TabClick(sender As Object, e As RadTabStripEventArgs)
        UpdateSelectedView()
    End Sub

    Private Sub LoadContent()
        Dim control = LoadControl(ViewsFolder & LoadedControlName)
        control.ID = "contentControl"
        Dim contentControl = TryCast(control, IContentControl)

        If contentControl IsNot Nothing Then
            contentControl.EmployeeID = EmployeeID
            ' from ListView
            contentControl.StartDate = StartDate
            contentControl.EndDate = EndDate
        End If

        Dim userDetailsPanel = TryCast(UserDetails, IContentControl)
        userDetailsPanel.EmployeeID = EmployeeID
        userDetailsPanel.StartDate = StartDate
        userDetailsPanel.EndDate = EndDate

        Content.Controls.Clear()
        Content.Controls.Add(control)
    End Sub

    Protected Sub UpdateSelectedView()
        Dim selectedControl As String = ViewChooser.SelectedTab.Value
        If selectedControl <> LoadedControlName Then
            LoadedControlName = selectedControl
            LoadContent()
        End If
    End Sub

    Public Function GetSalesPercentage(employeeID As Integer) As String

        Dim empSales = 222
        Return (empSales * 100).ToString("F0")
    End Function

    Protected Sub PagerSlider_ValueChanged(sender As Object, e As EventArgs)
        Dim newValue As String = TryCast(sender, RadSlider).Value.ToString()
        EmployeesListView.Items(0).FireCommandEvent(RadListView.PageCommandName, newValue)
    End Sub

    Protected Sub EmployeesListView_NeedDataSource(sender As Object, e As RadListViewNeedDataSourceEventArgs)

    End Sub

    Protected Sub EmployeesListView_SelectedIndexChanged(sender As Object, eventArgs As EventArgs)
        EmployeeID = Integer.Parse(EmployeesListView.SelectedValue.ToString())
        LoadContent()
        ScriptManager.RegisterStartupScript(Page, GetType(Page), "hide", "HideLoadingPanel()", True)
    End Sub

    Protected Overrides Sub OnPreRenderComplete(e As EventArgs)
        MyBase.OnPreRenderComplete(e)

        ' Make the EmployeeID available to scripts
        ScriptManager.RegisterStartupScript(Page, GetType(Page), "employeeID", "function getEmployeeID()" & vbTab & "{ return " & EmployeeID & "; }", True)
    End Sub

    Protected Sub SelectedDataChanged(sender As Object, e As SelectedDateChangedEventArgs)
        LoadContent()
    End Sub

End Class








error message :
  1.  Error    5    Overload resolution failed because no accessible 'Int' accepts this number of arguments.    C:\Users\Administrator\Documents\Visual Studio 2010\WebSites\abc\Default3.aspx    
  2. Error    7    Class 'Default3' must implement 'Sub SelectView(viewName As String)' for interface 'IViewSelector'.    C:\Users\Administrator\Documents\Visual Studio 2010\WebSites\abc\Default3.aspx.vb   

so what i did

  1. replace  int by  integer .....so problem solved
  2. replace   Public Sub SelectView(viewName As String)    by         Public Sub SelectView(viewName As String)   Implements IViewSelector.SelectView         .....so problem solved

but problem explained above occur, any suggestion ?...sorry for stretching

Maria Ilieva
Telerik team
 answered on 29 Apr 2013
2 answers
106 views
Hi,

I'm encountering some issues with controls in IE10,  they look ugly and I think that IE10 is doing it.  See attached PNG.  On the left is a list box and another one with checkboxes.  The top one shows the IE10 rendering of the checkboxes - a very WIndows 3.1 look.  The right image is the same page in Chrome.  The bottom image shows the scroll bar ugliness.

I'm 90% certain that those idiots at MS have done something to change IE10.  How do we override this and get the proper skin based settings?

This can be seen on these two pages
http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/checkboxes/defaultcs.aspx


http://demos.telerik.com/aspnet-ajax/listbox/examples/functionality/draganddrop/defaultcs.aspx

Obviously the best approach is to get rid of IE once and for all but telling the users that isn't so easy.  Only reason I use it now is because of being able to see what the users might see and for the VS integration.  

Best Regards

Jon
Jon
Top achievements
Rank 1
 answered on 29 Apr 2013
1 answer
138 views
Hello all,

I have a radgrid with an edit form type of web user control. My user control has two combo boxes and a listbox. These combo box selections filter the items within the listbox. I have a RadAjaxManagerProxy within the user control as follows:

<telerik:RadAjaxManagerProxy ID="ctrlAjaxManager" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="cbLocations">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbAvailableEmployees" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cbOccupations">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbAvailableEmployees" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
</telerik:RadAjaxManagerProxy>

These postbacks (selecting different combo box items; OnItemChecked) are causing the parent Grid (which resides in the web form) to refresh and fire the Grid's events: ItemCreated and PreRender. Is there any way to avoid having this occur, as it negatively affects performance in a significant way. Any help is greatly appreciated
Maria Ilieva
Telerik team
 answered on 29 Apr 2013
1 answer
89 views
we have our piece of code which worked perfectly for ExpandCollapse command until we upgraded to latest control set:
switch (e.CommandName)
                {
                    case RadGrid.ExpandCollapseCommandName:
                        {
                            gridId = (GridDataItem)e.Item;
                            ViewState["mkAccountID"] = gridId.GetDataKeyValue("mkAccountID").ToString();
                            ViewState["DecimalPlaces"] = gridId.GetDataKeyValue("DecimalPlaces").ToString();
 
                            //Set paramaters for dsAccountTID
                            dsAccountTID.SelectParameters.Clear();
                            dsAccountTID.SelectParameters.Add("mkAccountId", ViewState["mkAccountID"].ToString());
 
                            //Set paramaters for dsAccountCardSchemes
                            dsAccountCardSchemes.SelectParameters.Clear();
                            dsAccountCardSchemes.SelectParameters.Add("mkAccountId", ViewState["mkAccountID"].ToString());
 
                            if (SharedUtilities.ExpandCollapseItems(e.Item))
                                e.Canceled = true;
                        }
                        break;
            
public static bool ExpandCollapseItems(GridItem item)
   {
 
       try
       {
           // expand the grid data item that has been clicked
           // and collapse any other so that we only ever get
           // one expanded.
           foreach (GridDataItem gdi in item.OwnerTableView.Items)
           {
               if (gdi.ItemIndexHierarchical == item.ItemIndexHierarchical)
               {
                   gdi.Expanded = !gdi.Expanded;
               }
               else
               {
                   gdi.Expanded = false;
               }
           }
           return true;
       }
       catch (Exception ex)
       {
           throw new Exception("ExpandCollapseItems: " + ex);
       }
   }

While debugging everything looks correct apart from the fact that selected DetailTable doesn't expand.
Any thought's ?
Antonio Stoilkov
Telerik team
 answered on 29 Apr 2013
3 answers
64 views
Firstly, i select with
combo.SetText("abc")

it works but when page is going to postback it clears the combo

then i get the item

 

item = combo.FindItemByText("abc");
item.Select()

it works in postback ...but when i use tab button to treverse more control...it again clear or select any other item...

please help to select the combo wrt to above problems

thanks

Shinu
Top achievements
Rank 2
 answered on 29 Apr 2013
1 answer
81 views
Hello everyone ,

i've database contain some data :
Name
Age
Image Dbtype " Image "

i already created this database

now i want to add data in it , and am using binary image to show the image , how can i upload the image in the grid and after upload it , to be shown
Princy
Top achievements
Rank 2
 answered on 29 Apr 2013
Narrow your results
Selected tags
Tags
+? more
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Chester
Top achievements
Rank 1
Iron
Simon
Top achievements
Rank 1
Iron
Douglas
Top achievements
Rank 2
Iron
Iron
SUNIL
Top achievements
Rank 3
Iron
Iron
Iron
Marco
Top achievements
Rank 3
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?