Telerik Forums
UI for ASP.NET AJAX Forum
3 answers
185 views
Hi,
I'm trying to add button in the header of the dynamically created  column.
Can you give me an idea how to do that.
Shyam
Top achievements
Rank 1
 answered on 28 Dec 2011
1 answer
56 views
Radgrid gets misaligned with the page when we use the following settings for the RadGrid. Otherwise, it works fine when we dont use the settings.

<

 

Scrolling AllowScroll="True" UseStaticHeaders="true" FrozenColumnsCount="3" SaveScrollPosition="true" />

note: the RadGrid moves 200px to right when we use the above settings for thr RadGrid otherwise it start with 0px.

 

Shinu
Top achievements
Rank 2
 answered on 28 Dec 2011
1 answer
52 views
Do you to security i have to rum the application in Medium trust.

I am getting the following warning

Microsoft JScript runtime error: ASP.NET Ajax client-side framework failed to load.
Microsoft JScript runtime error: 'Sys' is undefined
Microsoft JScript runtime error: 'Telerik' is undefined


Inner Exceptions:

Cannot perform CAS Asserts in Security Transparent methods

in radgrid edit click.

Need help ASAP

Shinu
Top achievements
Rank 2
 answered on 28 Dec 2011
3 answers
112 views
Hello. I have a problem with malformed RadDatePicker controls in my application. This problem started to occur as soon as I upgraded from Q2 2011 to Q3 2011.

The problem is that when RadFormDecorator is used on the form, the RadDatePicker/RadTimePicker ignores any Width attribute and produces a very wide textbox.  If you have another control to the right of the RadDatePicker/RadTimePicker, it will superimpose over the RadDatePicker.  Please see the code sample below and the two attached files.

This problem occurs in the current versions of Safari and Chrome on Windows and OS X. IE and Firefox render the controls correctly. If I modify the RadFormDecorator control's ControlsToSkip attribute to exclude textboxes, the controls render correctly in all browsers, but of course it mangles all my textboxes.  My application is quite large, and as RadControls were originally applied to a legacy application, we have made extensive use of the RadFormDecorator control to pretty things up.  Removing it from the application and manually applying styles to all my pages, and retesting everything is a very large task.

Other than rolling back to Q2 2011, which gives me nightmares, does anyone else have any ideas?

Here's the sample code:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test2.aspx.cs" Inherits="Test2" %>
 
<%@ 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>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager>
    <telerik:RadFormDecorator ID="RadFormDecorator1" DecoratedControls="All" runat="server"
        Skin="Default" ControlsToSkip="Label" />
    <div>
        <telerik:RadDatePicker ID="RadDatePicker1" runat="server" DateInput-DateFormat="dd MMM yyyy"
            Width="110px" />
        <telerik:RadDatePicker ID="RadDatePicker2" runat="server" DateInput-DateFormat="dd MMM yyyy"
            Width="110px" />
    </div>
    </form>
</body>
</html>
Milena
Telerik team
 answered on 28 Dec 2011
2 answers
207 views
Hello,

I've seen this question asked before and I saw no appropriate resolution.

I have a RadGrid that is just a single level, no detail tables, no nesting.  The ObjectDataSource is set on the grid in code behind in response to a search button.
PayrollByCandidateRadGrid.DataSource = PayrollByCandidateObjectDataSource
PayrollByCandidateRadGrid.DataBind()
PayrollByCandidateRadGrid.Visible = True

The DataBind() method calls the ObjectDataSource.Select method 3 times before the third line of code above runs.
If I put a break point at the End Function of the ObjectDataSource code, I see the following in the Immediate Window:
F11 after first call
 
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod'
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect'
Step into: Stepping over non-user code 'System.Web.UI.DataSourceView.Select'
Step into: Stepping over non-user code 'Telerik.Web.UI.RadGrid.DataBind'
 
F11 after second call
 
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod'
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect'
Step into: Stepping over non-user code 'System.Web.UI.DataSourceView.Select'
 
F11 after third call
 
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod'
Step into: Stepping over non-user code 'System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect'
Step into: Stepping over non-user code 'Telerik.Web.UI.GridDataSourceHelper.GetResolvedDataSource'
Step into: Stepping over non-user code 'Telerik.Web.UI.GridTableView.ResolvedDataSource.get'
Step into: Stepping over non-user code 'Telerik.Web.UI.GridTableView.CreateChildControls'
Step into: Stepping over non-user code 'System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding'
Step into: Stepping over non-user code 'System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback'
Step into: Stepping over non-user code 'Telerik.Web.UI.GridTableView.PerformSelect'
Step into: Stepping over non-user code 'Telerik.Web.UI.GridTableView.DataBind'

I also have other RadGrids on the page in various tab/multipage areas and they all have detailtables or nesting of some kind.  They all call their ObjectDataSource.Select methods 3 times as well, so I thought I'd just do the testing with the single level Grid.

Your assistance with this matter will make the sale of the product and save me from the wrath of my DBA.

Regards,
Joan.
Joan
Top achievements
Rank 1
 answered on 28 Dec 2011
4 answers
76 views
Hello, I have a grid (gridEdit) where I am trying to attach a client side handler to certain auto generated edit elements.  I seem to have a valid reference and no errors are being thrown, but the handler never gets called.

Code behind:
protected void gridEdit_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        GridEditableItem form = (GridEditableItem)e.Item;
        for (int i = 0; i < _charFieldLength.Count; i++)
        {
            TextBox dataField = (TextBox)form[_charFieldLength[i].FieldName].Controls[0];
            dataField.MaxLength = _charFieldLength[i].DataLength;
        }
        for (int j = 0; j < form.Controls.Count; j++)
        {
            try
            {
                if (form.Controls[j].Controls[0] is RadNumericTextBox)
                {
                    RadNumericTextBox rnt = (RadNumericTextBox)form.Controls[j].Controls[0];
                    rnt.ClientEvents.OnKeyPress = "NumericOnKeyPress";
                }
            }
            catch (Exception ex) { }
        }
    }
}


Javascript:
function NumericOnKeyPress( sender, args )
{
    alert( 'In KeyPressHandler' );
}
Marbry
Top achievements
Rank 1
 answered on 27 Dec 2011
7 answers
404 views

A question on RabTabStrip, RadMultiPage, FormViews, two-way databinding, and dynamically loaded user controls:

Has anyone put them all together sucessfully!?

The closest Telerik demos I can find (such as TabStrip / Dynamic RadPageView) do the dynamic loading of user controls but they lack a formview and data binding features.

I've almost got there.  At present I have managed to put together a FormView which includes several RadPageViews.  I have placed a user control inside each RadPageView declaratively.  This works great but when I try to add a RadPageView dynamically (inside Page_Load) and load the user control dynamically (PageViewCreated event) my data is no longer bound to the controls inside the loaded user control (no error).

My FormView ID is FormView1 in the example below.  FormView1 is binding before before the PageView which I expect is the problem.
 
How can I add the PageView before the FormView begins binding (assuming this is the problem)?

        protected void Page_Load(object sender, EventArgs e)  
        {  
            if (!IsPostBack)  
            {  
                RadTab tab = new RadTab();  
                tab.Text = "Tab1";  
                TabStrip.Tabs.Add(tab);  
                RadPageView pageView = new RadPageView();  
                pageView.ID = "PageView1";  
                //next line is triggering data binding which is perhaps too early? PageView has not been added yet  
                RadMultiPage MultiPage1 = (RadMultiPage)FormView1.FindControl("MultiPage1");  
                MultiPage1.PageViews.Add(pageView);  
            }  
        }  
 
        protected void RadMultiPage1_PageViewCreated(object sender, RadMultiPageEventArgs e)  
        {  
            string userControlName = e.PageView.ID + ".ascx";  
            Control userControl = Page.LoadControl(userControlName);  
            userControl.ID = e.PageView.ID + "Control";  
            e.PageView.Controls.Add(userControl);  
        }   
 

More generally, in this scenario where I am trying to have one page, one formview, and one tabset with a different .ascx user control in each tab, is it advisable to instead use a different formview inside each control?  (These .ascx user controls are never re-used.)

Thanks!
John
Top achievements
Rank 1
 answered on 27 Dec 2011
4 answers
160 views
Hi. I am working on a project that will use the RadFileExplorer to show directories for specific security levels.

I know that there is a way to hardcode the items (see below code) which will be visible however, since I need to show directories and hide directories depending on the user's security level, I need it to work dynamically. I would like to pass in a list of security levels and use a switch statement to hide/show the appropriate directories depending on the user's security level.

            public override DirectoryItem ResolveRootDirectoryAsTree(string path)
                {
                DirectoryItem originalFolder = base.ResolveRootDirectoryAsTree(path);
                DirectoryItem[] originalDirectories = originalFolder.Directories;
                List<DirectoryItem> filteredDirectories = new List<DirectoryItem>();

                // Filter the folders
                foreach (DirectoryItem originalDir in originalDirectories)
                    {
                    if (!this.IsFiltered(originalDir.Name))
                        {
                        filteredDirectories.Add(originalDir);
                        }
                    }
                DirectoryItem newFolder = new DirectoryItem(originalFolder.Name, originalFolder.Location, originalFolder.FullPath, originalFolder.Tag, originalFolder.Permissions, originalFolder.Files, filteredDirectories.ToArray());

                return newFolder;
                }

            private bool IsFiltered(string name)
                {
               //I NEED THIS AREA TO BE DYNAMIC
            


                if (name.ToLower().EndsWith(".sys") ||
                    name.ToLower().Contains("_sys") ||
                    name == "Secure Directory1" ||
                    name == "Secure Directory2")
                    {
                    return true;
                    }

                // else
                return false;
                }

Thanks,
James
Osama
Top achievements
Rank 2
 answered on 27 Dec 2011
5 answers
191 views
I am trying to change the color of the header row when its in expanded mode. I tried the below code but didn't work.

Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid1.ItemDataBound
        If TypeOf e.Item Is GridGroupHeaderItem Then
            Dim gpheader As GridGroupHeaderItem = CType(e.Item, GridGroupHeaderItem)
 
           If item.Selected Then
             gpheader.BackColor = Drawing.Color.DarkSeaGreen
            End If
End Sub

Any other way?
Vijaianand
Top achievements
Rank 1
 answered on 27 Dec 2011
6 answers
144 views
I am trying to alter the visibility of a RadAjaxPanel that is within an ASP FormView. Please suggest an approach that works; the following approach does not:

FormView 

fv = form1.FindControl("FormView1") as FormView;

RadAjaxPanel myPanel = fv.FindControl("ThePanelOfInterest") as RadAjaxPanel;

myPanel.Visible = true;

myPanel is always shown as null even though it does exist.

Sy
Top achievements
Rank 1
 answered on 27 Dec 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?