Telerik Forums
UI for ASP.NET AJAX Forum
1 answer
174 views
I have a three-level grid, with each level attempting to display a one-to-many relationship in my database.

I think I've correctly set up my and my ParentTableRelation and my DataKeyNames correctly, but the ObjectDataSource is being passed "Nothing" in the SessionParameters.

Here's my grid:

<telerik:RadGrid ID="grdSchedule" 
    AllowMultiRowSelection="false" 
    AutoGenerateColumns="False" 
    GridLines="None" 
    runat="server" 
    ShowFooter="false" 
    ShowGroupPanel="True" 
    ShowStatusBar="false" 
    Skin="Web20" 
    Width="880px">  
    <MasterTableView AllowPaging="True" DataKeyNames="DepartmentId" DataSourceID="dsrDepartments" HierarchyLoadMode="ServerBind" PageSize="3">  
        <Columns> 
            <telerik:GridTemplateColumn UniqueName="CourseDescription">  
                <ItemTemplate> 
                    <table width="100%" style="border-width: 0;">  
                        <tr> 
                            <td align="left" style="border-width: 0;">  
                                <asp:Label ID="lblDepartment" runat="server" 
                                    Text='<%# Eval("DepartmentName") & " (" & Eval("Chairperson") & ", Chairperson)" %>' /> 
                            </td> 
                            <td align="right" style="border-width: 0;">  
                                <asp:Label ID="lblDivision" runat="server" Text='<%# UCase(Eval("DivisionName")) & " DIVISION" %>' /> 
                            </td> 
                        </tr> 
                    </table> 
                </ItemTemplate> 
            </telerik:GridTemplateColumn> 
        </Columns> 
       <DetailTables> 
            <telerik:GridTableView ClientDataKeyNames="DepartmentId" DataKeyNames="DepartmentId" DataSourceID="dsrCourses" 
                HierarchyLoadMode="ServerBind" runat="server" Width="100%">  
                <ParentTableRelation> 
                    <telerik:GridRelationFields DetailKeyField="DepartmentId" MasterKeyField="DepartmentId" /> 
                </ParentTableRelation> 
                 <DetailTables> 
                    <telerik:GridTableView ClientDataKeyNames="CourseId" DataSourceID="dsrSections" HierarchyLoadMode="ServerBind" 
                        runat="server" Width="100%">  
                        <ParentTableRelation> 
                            <telerik:GridRelationFields DetailKeyField="CourseId" MasterKeyField="CourseId" /> 
                        </ParentTableRelation> 
                        <ItemStyle VerticalAlign="Top" /> 
                        <Columns> 
                            <telerik:GridBoundColumn DataField="SectionNumber"  HeaderText="Section"    UniqueName="SectionNumber">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="Instructor"     HeaderText="Instructor" UniqueName="Instructor">  
                                <HeaderStyle HorizontalAlign="Left" /> 
                                <ItemStyle HorizontalAlign="Left" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridTemplateColumn                         HeaderText="Dates"      UniqueName="Dates">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                                <ItemTemplate> 
                                    <asp:Label ID="DepartmentNameLabel" runat="server" 
                                        Text='<%# Eval("DateStart", "{0:MMM d}") & " - " & Eval("DateEnd", "{0:MMM d}") %>' /> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn                         HeaderText="Time"      UniqueName="Sessions">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                                <ItemTemplate> 
                                    <asp:Repeater ID="rptSession" runat="server">  
                                        <ItemTemplate> 
                                            <asp:Label ID="lblDayAndTime" runat="server" 
                                                Text='<%# Eval("DayAndTimes") & "&nbsp;" %>' /> 
                                        </ItemTemplate> 
                                    </asp:Repeater> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridTemplateColumn                         HeaderText="Room"      UniqueName="Sessions">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                                <ItemTemplate> 
                                    D104  
                                    <br /> 
                                    D104  
                                    <asp:Repeater ID="rptSession" runat="server">  
                                    </asp:Repeater> 
                                </ItemTemplate> 
                            </telerik:GridTemplateColumn> 
                            <telerik:GridBoundColumn DataField="Enrolled"       HeaderText="Enrolled"   UniqueName="Enrolled">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridBoundColumn DataField="EnrollMaximum"  HeaderText="Seats"      UniqueName="EnrollMaximum">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                            </telerik:GridBoundColumn> 
                            <telerik:GridTemplateColumn HeaderText="Select" ItemStyle-Width="10%" UniqueName="ShowOnPlanner_2">  
                                <HeaderStyle HorizontalAlign="Center" /> 
                                <ItemStyle HorizontalAlign="Center" /> 
                                <ItemTemplate> 
                                    <input id="chkSelect" type="checkbox" onclick="chkCourse_clicked(this,'<%# Eval("SectionNumber") %>');" /> 
                                </ItemTemplate> 
                                <ItemStyle CssClass="RightColumn" /> 
                            </telerik:GridTemplateColumn> 
                        </Columns> 
                    </telerik:GridTableView> 
                </DetailTables> 
                <ItemStyle VerticalAlign="Top" /> 
                <Columns> 
                    <telerik:GridTemplateColumn UniqueName="CourseDescription">  
                        <ItemTemplate> 
                            <asp:Label ID="DepartmentNameLabel" runat="server" 
                                Text='<%# UCase(Eval("DepartmentName") & " " & Eval("CourseNumber") & " - " & Eval("CourseName")) %>' /> 
                        </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                </Columns> 
            </telerik:GridTableView> 
        </DetailTables> 
        <ItemStyle BackColor="#FFCC66" BorderColor="#444444" BorderStyle="Solid" BorderWidth="1PX" 
            Font-Bold="True" Font-Italic="False" Font-Names="Verdana" Font-Overline="False" 
            Font-Size="8pt" Font-Strikeout="False" Font-Underline="False" ForeColor="#444444" 
            HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" /> 
        <AlternatingItemStyle BackColor="#FFCC66" BorderColor="#444444" BorderStyle="Solid" 
            BorderWidth="1PX" Font-Bold="True" Font-Italic="False" Font-Names="Verdana" Font-Overline="False" 
            Font-Size="8pt" Font-Strikeout="False" Font-Underline="False" ForeColor="#444444" 
            HorizontalAlign="Left" VerticalAlign="Middle" Wrap="False" /> 
        <PagerStyle Visible="false" Mode="NextPrev" Position="TopAndBottom" /> 
        <ExpandCollapseColumn Visible="True" /> 
    </MasterTableView> 
</telerik:RadGrid> 
 

And here are my datasources:

<asp:ObjectDataSource ID="dsrDepartments" runat="server" SelectMethod="dbSelect" TypeName="WLAC.UilDepartment">  
    <SelectParameters> 
        <asp:Parameter Name="intDepartmentId"   Type="int32"    DefaultValue="0"    /> 
        <asp:Parameter Name="intDivisionId"     Type="int32"    DefaultValue="0"    /> 
        <asp:Parameter Name="intMaxRows"        Type="int32"    DefaultValue="0"    /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
<asp:ObjectDataSource ID="dsrCourses" runat="server" SelectMethod="dbSelect" TypeName="WLAC.UilCourse">  
    <SelectParameters> 
        <asp:Parameter          Name="intCourseId"      Type="int32"    DefaultValue="0"    /> 
        <asp:SessionParameter   Name="intDepartmentId"  Type="int32"    SessionField="DepartmentId" /> 
        <asp:Parameter          Name="intMaxRows"       Type="int32"    DefaultValue="0"    /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
<asp:ObjectDataSource ID="dsrSections" runat="server" SelectMethod="dbSelect" TypeName="WLAC.UilSection">  
    <SelectParameters> 
        <asp:Parameter Name="intCourseId"       Type="int32"    DefaultValue="0"    /> 
        <asp:Parameter Name="intMaxRows"        Type="int32"    DefaultValue="0"    /> 
    </SelectParameters> 
</asp:ObjectDataSource> 
 

TIA,

  Ed
Pavlina
Telerik team
 answered on 21 Jun 2010
1 answer
287 views
Hi,

I want to PostBack RadGrid with RadAjaxManager when close RadWindow, but ajaxRequestWithTarget doesn't work in my code below, please help me fix this

ASPX Page
<!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 id="Head1" runat="server"
    <title>Untitled Page</title> 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"
    </asp:ScriptManager> 
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server"
    </telerik:RadWindowManager> 
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server"
        <script language="javascript" type="text/javascript"
            function openConfirmDeleteMany() { 
                var oWnd = radopen("ConfirmDeleteMany.aspx", "ConfirmDeleteManyWindow"); 
                oWnd.SetSize(400, 200); 
                oWnd.SetTitle('Title'); 
                oWnd.Center(); 
            } 
 
            function OnDeleteWindowClientClose(oWnd, args) { 
                if (args) { 
                    var hdfDeleteOption = document.getElementById("<%= hdfDeleteOption.ClientID %>"); 
                    hdfDeleteOption.value = args
                    var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>"); 
                    ajaxManager.ajaxRequestWithTarget('<%= RadGrid1.UniqueID %>', ''); 
                } 
            } 
        </script> 
 
    </telerik:RadCodeBlock> 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"
        <AjaxSettings> 
            <telerik:AjaxSetting AjaxControlID="RadGrid1"
            </telerik:AjaxSetting> 
        </AjaxSettings> 
    </telerik:RadAjaxManager> 
    <asp:HiddenField ID="hdfDeleteOption" runat="server" /> 
    <telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="AccessDataSource1" GridLines="None" 
        AllowPaging="true" PageSize="20" AllowSorting="true" Skin="Vista" AllowFilteringByColumn="true" 
        OnItemDataBound="RadGrid1_ItemDataBound" OnItemCommand="RadGrid1_ItemCommand"
        <MasterTableView AutoGenerateColumns="False" DataKeyNames="EmployeeID" DataSourceID="AccessDataSource1"
            <Columns> 
                <telerik:GridBoundColumn DataField="EmployeeID" DataType="System.Int32" HeaderText="EmployeeID" 
                    ReadOnly="True" SortExpression="EmployeeID" UniqueName="EmployeeID"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName" 
                    UniqueName="LastName"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" 
                    UniqueName="FirstName"
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Title" HeaderText="Title" SortExpression="Title" 
                    UniqueName="Title"
                </telerik:GridBoundColumn> 
                <telerik:GridTemplateColumn> 
                    <ItemTemplate> 
                        <asp:LinkButton ID="btnDelete" Text="Delete" runat="server" CommandName="cmdDelete" /> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <asp:AccessDataSource ID="AccessDataSource1" DataFile="~/App_Data/Nwind.mdb" SelectCommand="SELECT [EmployeeID], [LastName], [FirstName], [Title] FROM [Employees]" 
        runat="server"></asp:AccessDataSource> 
    </form> 
</body> 
</html> 

Code-behind:
        protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
        { 
            if (e.Item is GridDataItem) 
            { 
                var item = e.Item as GridDataItem; 
                var btnDelete = (LinkButton)item.FindControl("btnDelete"); 
                btnDelete.OnClientClick = "openConfirmDeleteMany(); return false;"
            } 
        } 
 
        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e) 
        { 
            if(e.CommandName == "cmdDelete"
            { 
                Response.Write(RadGrid1.MasterTableView.DataKeyValues[e.Item.ItemIndex]["EmployeeID"]); 
            } 
        } 


ConfirmDeleteMany.aspx
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 
<html> 
<head id="Head1" runat="server"
    <link href="/App_Themes/Administrator/adminStyle.css" rel="stylesheet" /> 
    <script src="/Scripts/Portal.js"type="text/javascript" language="javascript"></script> 
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server" /> 
 
    <script language="javascript" type="text/javascript"
 
        function GetRadWindow() { 
            var oWindow = null
            if (window.radWindow) oWindow = window.radWindow; 
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; 
            return oWindow; 
        } 
         
        function returnToParent() { 
 
            if (confirm('Are you sure?')) { 
                var comboBox = $find("<%= ddlDeleteOption.ClientID %>"); 
                var item = comboBox.get_selectedItem(); 
                //alert(item.get_value()); 
                //get a reference to the current RadWindow 
                var oWndRad = GetRadWindow(); 
 
                var openerPage = oWndRad.BrowserWindow; 
                openerPage.OnDeleteWindowClientClose(oWndRad, item.get_value()); 
                oWndRad.close(); 
            } 
        } 
    </script> 
 
    <table cellpadding="2" cellspacing="2" border="0" width="100%"
        <tr> 
            <td> 
                <telerik:RadComboBox ID="ddlDeleteOption" runat="server"
                    <Items> 
                        <telerik:RadComboBoxItem Text="Delete One" Value="ONE" /> 
                        <telerik:RadComboBoxItem Text="Delete All" Value="ALL" /> 
                    </Items> 
                </telerik:RadComboBox> 
            </td> 
        </tr> 
        <tr> 
            <td> 
                <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClientClick="returnToParent(); return false;" /> 
            </td> 
        </tr> 
    </table> 
    </form> 
</body> 
</html> 



Pavlina
Telerik team
 answered on 21 Jun 2010
3 answers
118 views
I've created a toolstrip with about half a dozen entries. When its displayed it cuts off the text description of each of the tools. I can make the toolstrip wider but it continues to trim the text. See the pic below for an example.

Rumen
Telerik team
 answered on 21 Jun 2010
1 answer
79 views
Hello, is there any way in which I can implement a RadWindow that will show the user that the session will expire in, say 1 minute, and allow the user to extend it???

Thanks,
Manuel
Georgi Tunev
Telerik team
 answered on 21 Jun 2010
1 answer
118 views
I have a readpanelbar with several radpanelitems within it.
When I try to expand or collapse any radpanelitem, it takes a long time.
There are several raddatepickers in the radpanelitems as well, which use a shared calendar.
If I remove the raddatepickers from the radpanelitems, or the panelitems which consists of raddatepickers are already collapsed, then the other radpanelitems expand or collapse very fast.
This behavior is in IE only and it behaves fine in Firefox.
Nikolay Tsenkov
Telerik team
 answered on 21 Jun 2010
3 answers
88 views
Go to the RadWindow Restriction Zone demo.

When the demo has loaded, maximize one of the windows. Click on the RadWindow menu option. You should see the menu drop behind the maximized window at least it does here in both IE8 and Chrome. 

Now, click on one of the options on the left side of the page, I picked cssplay.co.uk, but it doesn't actually matter which you pick. You'll see the window open up through the titlebar of the maximized window but you won't be able to access it without at least restoring with maximized window. I would have at least expected the newly opened window to appear on top.

-- 
Stuart
Georgi Tunev
Telerik team
 answered on 21 Jun 2010
3 answers
136 views
I have a simple RadGrid bound to a DataTable retrieved from a SQL database with a simple "SELECT * FROM <table_name>" query.
One of the table's columns stores XML strings.

My problem is that the corresponding RadGrid column does not display the XML string itself; it displays only the XML element values one after another.

E.g.  say the database value in column X is:
    "<root><username>foo</username><password>bar</password></root>".
The RadGrid displays in its column X:
    "foo bar".

Is it possible for the RadGrid to show the actual XML string itself?

Many thanks.
hobbes_child
Top achievements
Rank 1
 answered on 21 Jun 2010
1 answer
100 views
I have a master page that contains a RadSplitter with several rad panels and two toolbars (top and bottom).  When a content page is loaded, the master page uses an interface on the content page to determine what buttons should be available and on which toolbar.

When a toolbar contains no buttons, I'd like to hide it and have the space reclaimed by the splitter.  Unfortunately, I have been running in circles because when I set the RadPanel's visibility to false, the application fails on a postback to show the toolbar again.  I consistently run into javascript errors where I see [null] is null or not an object.

I'm using RadControls_for_ASP.NET_AJAX_2009_3_1208 and the browser is IE 7.  Is this a problem with redisplaying of CSS styles?
Dobromir
Telerik team
 answered on 21 Jun 2010
1 answer
101 views
Hi

I am using Ajax controls Q1 2010 RadGrid control for client side binding. I need to format rows based on the values in the returned row.  I found a good postng on how to do this (see here) but when I try to access the row data using eventArgs.get_gridDataItem().get_dataItem() in the RowCreated client event it always returns null.  Is this by design as it seems rather odd.  Strangely I am using the RowSelected event on the same grid and it returns the data without any problem.

Can anyone help me???

Cheers
Jonny
Veli
Telerik team
 answered on 21 Jun 2010
1 answer
98 views
Description: Calling this class to load into a userControl on the page.

Xml Structure:

<Products> 
    <Product> 
        <items> 
            <ProdID>123</ProdID> 
            <ProdNo>89415F</ProdNo> 
            <ProdName>OTBuild</ProdName> 
        </items> 
    </Product> 
</Products> 
Class:
Dim RadGrid1 as New RadGrid()    
Dim root as new xmldocument()  
 
Public Sub GetData(ByRef Placeholder1 as Control)  
    
   CustBinding()  
   root.load(Server.mappath("test.xml"))  
   Dim ndlist As XmlNodeList = root.SelectNodes("//Products/Product")  
 
        Dim xDoc As New XmlDocument()  
          
        For Each cNode As XmlNode In ndlist  
            Dim subNode As XmlNode = xDoc.ImportNode(cNode, True)  
            xDoc.InnerXml = subNode.OuterXml  
            Dim chNode As XmlNode = nDoc.SelectSingleNode("//Product")  
            dS.ReadXml(New XmlNodeReader(chNode))  
        Next 
    RadGrid1.datasource=dS  
      CustControl()  
    RadGrid1.DataBind()  
 
    Placeholder1.controls.add(RadGrid1)  
 
End Sub 
 
Public Sub CustBinding()  
   RadGrid1.Skin = "Default" 
        RadGrid1.ItemStyle.Font.Name = "sans-serif" 
        RadGrid1.PagerStyle.Mode = 2  
 
        RadGrid1.ShowGroupPanel = False 
        'RadGrid1.AutoGenerateColumns = True  
        RadGrid1.AutoGenerateHierarchy = True 
        RadGrid1.AllowPaging = True 
RadGrid1.AllowSorting = True 
 
End sub  
 
Public Sub CustControl()  
RadGrid1.Skin = "Default" 
        RadGrid1.ItemStyle.Font.Name = "sans-serif" 
        RadGrid1.PagerStyle.Mode = 2  
 
        RadGrid1.ShowGroupPanel = False 
        'RadGrid1.AutoGenerateColumns = True  
        RadGrid1.AutoGenerateHierarchy = True 
        RadGrid1.AllowPaging = True 
End Sub 


 

Issues:

1) Clicking on one column sorts the next column, the column on the right.(Even for Basic Sorting)
2) Same is issue with MultiColumnSorting.
3) rgStatus Class with div's causes improper align of PagerStyle

Referred most of the blogs: One , Two .... and many

Pavlina
Telerik team
 answered on 21 Jun 2010
Narrow your results
Selected tags
Tags
+? more
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Hiba
Top achievements
Rank 1
Iron
Iron
Rob
Top achievements
Rank 3
Bronze
Bronze
Iron
Max
Top achievements
Rank 1
Veteran
Iron
Alina
Top achievements
Rank 1
Rakhee
Top achievements
Rank 1
Iron
Iron
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?