Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
37 views
Hello,

I was wondering whether it is possible to use the NextPrevAndNumeric PagerStyle without allowing users the option to change the page size. It doesnt seem to work properly in my solution (see screenshot), I would like it to be fixed in any case.

Thanks,

Ken
Ken Jones
Top achievements
Rank 1
 answered on 26 Oct 2010
2 answers
149 views
Good day!
I try to do everything like in this sample (http://demos.telerik.com/aspnet-ajax/window/examples/autosize/defaultcs.aspx), but something is wrong and when I add files using my RadAsyncUpload in the Window, there are a lot of files but the window do not change it's size =(
You can see it in the attached file.
Please, can you tell me what I do wrong?
Here is my code.

<telerik:RadWindowManager ID="winManager"
        runat="server" >
        <Windows>          
            <telerik:RadWindow ID="RadWindow1"  BackColor="White" OnClientClose="OnClientClose2"  Width="400px" Height="400px"
            VisibleStatusbar="false" Skin="Office2007" Behaviors="Close, Resize, Move" IconUrl="../App_Themes/Theme1/Image/1288064592_view_remove.ico"
            Animation="Fade" AutoSize="true" ShowContentDuringLoad="false" EnableShadow="true"
            NavigateUrl="../Administrators/FileWindows/UploadFile.aspx" runat="server"  Title="Загрузить файл" />          
       </Windows>
    </telerik:RadWindowManager>


UploadFile.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UploadFile.aspx.cs" Inherits="CAP.Site.Administrators.FileWindows.UploadFile" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        body   
        {    
            font-size: 12px;
            font-family:  "Segoe UI", Arial, sans-serif, Verdana, Tahoma, Helvetica;    
            color: #000000;         
        }
        .MySimpleButton
        {
            font-family: "Segoe UI", Arial, sans-serif, Verdana;
            font-size: 1.0em;
            height: 24px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">

     <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function returnToParent() {
                var oArg = new Object();
                oArg.pressCancel = "False";
                var oWnd = GetRadWindow();
                oWnd.close(oArg);
            }
            function GetRadWindow() {
                var oWindow = null;
                if (window.radWindow)
                    oWindow = window.radWindow;
                else if (window.frameElement.radWindow)
                    oWindow = window.frameElement.radWindow;
                return oWindow;
            }
            function cancel() {
                var oArg = new Object();
                oArg.pressCancel = "True";
                var oWnd = GetRadWindow();
                oWnd.close(oArg);
            }
        </script>
        </telerik:RadCodeBlock>
    <telerik:RadScriptManager ID="ScriptManager1" runat="server" />

    <div class="upload-panel" style="min-height: 350px; min-width: 350px; display: block; width: auto; height: auto;" >
        <telerik:RadProgressManager runat="server" ID="RadProgressManager1" Skin="Office2007"  />                                                        
        <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Skin="Office2007" Width="97%" MultipleFileSelection="Automatic"/>

        <telerik:RadProgressArea runat="server" ID="RadProgressArea1"
            Skin="Office2007"/>
    </div>
    <asp:Label ID="InjectScript" Runat="server" Width="330px"></asp:Label>
    <br /><br />
    <asp:Button runat="server" Text="Сохранить" onclick="Unnamed1_Click" CssClass="MySimpleButton" />
    <button title="Закрыть" id="btClose" class="MySimpleButton" onclick="cancel(); return false;">Закрыть</button>

    
    </form>
</body>
</html>

lina fetisova
Top achievements
Rank 1
 answered on 26 Oct 2010
2 answers
326 views
Hi,
(I have removed any business specific information from the markup and code samples)
I have a problem with binding to a hierarchical data structure. The structure for the grid is following:
<telerik:RadGrid ID="RadGridExample" runat="server" GridLines="Both" Skin="WebBlue">
        <MasterTableView AutoGenerateColumns="false" Name="Main"> <%-- This level holds items of Type1 --%>
            <Columns>
                 
            </Columns>
            <DetailTables>
                <telerik:GridTableView Name="SubLevel1" ShowHeadersWhenNoRecords="false" AutoGenerateColumns="false"> <%-- This level holds items of Type2 --%>
                    <Columns>
                         
                    </Columns>
                    <DetailTables>
                          <telerik:GridTableView Name="SubLevel2" ShowHeader="false" AutoGenerateColumns="false" > <%-- This level holds items of Type2 --%>
                            <Columns>
                                 
                            </Columns>
                            <DetailTables>
                                <telerik:GridTableView Name="SubLevel3" ShowHeader="false" AutoGenerateColumns="false"> <%-- This level holds items of Type2 --%>
                                    <Columns>
                                         
                                    </Columns>
                                    <DetailTables>
                                        <telerik:GridTableView Name="SubLevel4" ShowHeader="false" AutoGenerateColumns="false"> <%-- This level holds items of Type2 --%>
                                            <Columns>
                                                 
                                            </Columns>
                                        </telerik:GridTableView>
                                    </DetailTables>
                                </telerik:GridTableView>
                            </DetailTables>
                        </telerik:GridTableView>
                    </DetailTables>
                </telerik:GridTableView>
            </DetailTables>
        </MasterTableView>
    </telerik:RadGrid>
Type1 and Type2 naturally have different properties.

For all levels I use custom sorting, custom paging and custom filtering. I get all data for the entire grid (all sub levels included) in the Page_PreRender stage (of the UserControl the Grid is in).

The problem is that I have not been able to get the detail grids to bind at all after I expand a row.

Here is a little bit of background information before I go on:
The life cycle of the control is following:
1. At Init (of the user control) the user control registeres it to the page. The user control implements a custom IView interface and the Page implements a custom IViewContiner interface. The code for this is following:
protected void Page_Init(object sender, EventArgs e)
{
    IViewContainer container = this.Page as IViewContainer;
    if (container != null)
    {
        container.Register(this);
    }
}

2. In the the containing Page's Page_LoadComplete the Page calls all its IView (user control) objects Initialize method where the user control collects its state information and sends it to an application controller. At this stage the user control should traverse the grid structure and get all expanded rows. From this information the back end can get all the information needed to get the data for the view(s) (user control(s)).

3. At user control's Page_PreRender the user control receives the data it is supposed to bind to the grid. The hierarchical data structure could be of type:
IEnumerable<Tuple<Type1,IEnumerable<Tree<Type2>>>>
Where the Type1 objects are objects that should be bound to the MasterTableView level and the IEnumerable of trees should be bound to the detail tables.

The Tree and its TreeNode classes look like this:
public class Tree<TItem>
{
 
    public Tree(TItem rootItem)
    {
        root = new TreeNode<TItem>(rootItem);
    }
 
    public Tree(TreeNode<TItem> rootNode)
    {
        this.root = rootNode;
    }
 
    private TreeNode<TItem> root;
 
    public TreeNode<TItem> Root
    {
        get { return root; }
    }
}
 
public class TreeNode<TItem>
{
 
    public TreeNode(TItem item)
    {
        this.item = item;
        this.children = new List<TreeNode<TItem>>();
        this.isLeaf = true;
    }
 
    public TreeNode(TItem item, bool isLeaf)
    {
        this.item = item;
        this.isLeaf = isLeaf;
        this.children = new List<TreeNode<TItem>>();
    }
 
    public TreeNode(TItem node, IEnumerable<TItem> children)
    {
        this.item = node;
        this.children = new List<TreeNode<TItem>>(children.Count());
        foreach (var child in children)
        {
            this.children.Add(new TreeNode<TItem>(child));
        }
        this.isLeaf = false;
    }
 
    private TItem item;
 
    public TItem Item
    {
        get { return item;}
    }
 
    private List<TreeNode<TItem>> children;
 
    public IEnumerable<TreeNode<TItem>> Children
    {
        get
        {
            if (isLeaf)
                throw new InvalidOperationException("Node is set as Leaf so it can't have children");
            return children;
        }
    }
 
 
    private bool isLeaf;
 
    public bool IsLeaf
    {
        get { return isLeaf; }
        set { isLeaf = value; }
    }
         
 
    public void AddChild(TItem item)
    {
        isLeaf = false;
        children.Add(new TreeNode<TItem>(item));
    }
 
    public void AddChild(TreeNode<TItem> item)
    {
        isLeaf = false;
        children.Add(item);
    }
 
    public void AddChildren(IEnumerable<TItem> items)
    {
        isLeaf = false;
        foreach (var item in items)
        {
            children.Add(new TreeNode<TItem>(item));
        }
    }
 
    public void AddChildren(IEnumerable<TreeNode<TItem>> items)
    {
        isLeaf = false;
        foreach (var item in items)
        {
            children.Add(item);
        }
    }
 
}

Now back to the problem at hand. I tried to bind the MasterTableView to the IEnumerable<Type1>:
RadGridExample.MasterTableView.DataSource = hierarchy.Select(tuple => tuple.Item1); Where hierarchy is the IEnumerable<Tuple<Type1,IEnumerable<Tree<Type2>>>>.

Then in the RadGridExample_DetailTableDataBind handler I Tried the following:
object parentDataItem = e.DetailTableView.ParentItem.DataItem;
if (parentDataItem is Type1)
{
    Type1 fac = parentDataItem as Type1;
    var tuple = hierarchy.Single(t => t.Item1 == fac);
    if (tuple.Item2 != null)
    {
        var roots = tuple.Item2.Select(tree => tree.Root);
        //selects IEnumerable<TreeNode<Type2>>
        e.DetailTableView.DataSource = roots;
    }
 
}
else if (parentDataItem is TreeNode<Type2>)
{
    TreeNode<Type2> node = parentDataItem as TreeNode<Type2>;
    if (!node.IsLeaf)
    {
        e.DetailTableView.DataSource = node.Children;
    }
}

The rules for binding are following (as the code above suggests):
 - If the IEnumerable<Type2> associated with the Type1 in the Tuple is null, then the row is not expanded and its detail table should not be bound to anything.
 - If the TreeNode<Type2> object has IsLeaf == true then it is not expanded and its detail table should not be bound to anything.

Is it possible to bind this kind for data structures the grid hierarchy all at once at Page_PreRender? The self referencing hierarchy is out of the question since I want to some day have custom paging on all levels of the hierarchy separately. For now I would settle for getting the data binding working.

I attached an example picture of the kind of data that the grid should bind to.

EDIT:

Some more issues I ran into:

Issue1:

If I set the data source of the grid or grid's master table view as IEnumerable<Type1> the Grid_ItemDataBound handler tries to bind the Type1 objects also to the DetailTable levels. This is not at all what I intended to do. The IEnumerable<Type1> objects should be bound to the master table view level (outer most level) and the trees should be bound to the detail table levels.
For example If my data source for the master table view level would be following:
{item1, item2, item3, item4}
The grid tries to create the following hierarchy from this list:
item1
 -Item1
 -Item2
 -Item3
 -Item4
Item2
 -Item1
 -Item2
 -Item3
 -Item4
...
And so on
So it is repeating the main level objects as the children of the main level objects.

Issue2:

I got the hierarchy expanding but it is super slow. Now the problem is that if I want to collapse any row the grid won't event make a request to the server. Although this only happens when the web app is run on the Visual Studio development web server. On IIS the collapse seems to work.
Radoslav
Telerik team
 answered on 26 Oct 2010
1 answer
156 views
I have a web page that inherits from a master page.  On the master page is a rad menu control, and on the main window a a couple swfs embeded in the page.  It is an aspx page. When I open the the radwindow  the window is always below the radmenu control and when I move teh popup ot appears as if the swfs are also above the page but when I release the window the swf are below the popup, whic I want, but the rad menu is always above it.  If I switch from using a radwindow to just a window.open I have no issues.
Shinu
Top achievements
Rank 2
 answered on 26 Oct 2010
4 answers
108 views
Hello,
I'm using a RadGrid with a GridAttachmentColumn (ButtonType ImageButton) for download.
Everything is Ok and It works well.
But some of the items of my Grid don't have attached file.
So I would like to set the "visible property" of the button to false when there is no attached file.
Is there a way to do that ?
Thanks a lot.
Bernard
Bernard
Top achievements
Rank 1
 answered on 26 Oct 2010
1 answer
64 views
Hi,

i created radgrid with edit option. when clicked edit button displayed values in textbox. then i clicked enter button means another add new record option has been displayed. how to avoid this problem?
Princy
Top achievements
Rank 2
 answered on 26 Oct 2010
3 answers
172 views
I'm not a style guy, I'm a database developer, but I've had some requests to modify the "Simple" style in the system I'm working on.

I found the Visual Style Builder and think it's quite interesting and was able to do just about everything I've wanted except for one thing.

My menu that I'm using is vertical.  The user wants the arrow on the root menu when there is sub menus.  I played around with the Style Builder and was able to get the arrow showing, but only when the menu is horizontal.  if the menu is vertical, it doesn't show.

Any idea as to why this is?  Is it something I can fix?  If necessary, I can get my current project in a place you can view it, if that helps.

Thanks for any help!
Kamen Bundev
Telerik team
 answered on 26 Oct 2010
5 answers
200 views
I'm using the "Letters" setting and am just curious.  When the Captcha image is created, does it have a list of profane or "naughty" letter combinations it won't use???

I realize the odds that a bad word will come up are extremely low, but I'd just like to know before I push this to the public site!

Thanks!
Pero
Telerik team
 answered on 26 Oct 2010
5 answers
123 views
I have a numeric textbox that is used to choose a birthday year.  I want the box to be blank when the form first comes up so I know if the user fills in the box or not.  I tried setting the value and it won't let me set to 0 since it is outside the Min/Max range.  Any suggestions?
Dimo
Telerik team
 answered on 26 Oct 2010
1 answer
71 views
Hi guys
I am trying to implement drag and drop rows in two grids in both way. It is possible in both direction, to and fro. But my delete is not working. Here is my script. anybody  can help to get deleted.
 

<script type="text/javascript">

            function onRowDropping(sender, args) {
                if (sender.get_id() == "<%=grdPendingOrders.ClientID %>") {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('<%=grdShippedOrders.ClientID %>', node) && !isChildOf('<%=grdPendingOrders.ClientID %>', node)) {
                        args.set_cancel(true);
                    }

                }
                else if (sender.get_id() == "<%=grdShippedOrders.ClientID %>") {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('<%=grdPendingOrders.ClientID %>', node) && !isChildOf('<%=grdShippedOrders.ClientID %>', node)) {
                        args.set_cancel(true);
                    }
                }

                else {
                    var node = args.get_destinationHtmlElement();
                    if (!isChildOf('trashCan', node)) {
                        args.set_cancel(true);
                    }
                    else {
                        if (confirm("Are you sure you want to delete this order?"))
                            args.set_destinationHtmlElement($get('trashCan'));
                        else
                            args.set_cancel(true);
                    }
                }
            }
            function isChildOf(parentId, element) {
                while (element) {
                    if (element.id && element.id.indexOf(parentId) > -1) {
                        return true;
                    }
                    element = element.parentNode;
                }
                return false;
            }

        </script>

Pavlina
Telerik team
 answered on 26 Oct 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Top users last month
Ambisoft
Top achievements
Rank 2
Iron
Pascal
Top achievements
Rank 2
Iron
Matthew
Top achievements
Rank 1
Sergii
Top achievements
Rank 1
Andrey
Top achievements
Rank 1
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?