This is a migrated thread and some comments may be shown as answers.

SOS Grid in usercontrol

3 Answers 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Sánchez
Top achievements
Rank 1
David Sánchez asked on 12 Sep 2008, 05:41 PM
Firstly sorrry my broken english
I have  a big problem, my web only has one page, in this page i have a table with 3 rows, one cell in the first row, two cells in the second and one cell in the third row. In the first cell in the second row i have a menu (panel bar) when i click ion a option omenu, soy a usercontrol in the second cell of the second row. One of the usercontrol has a rad grid, i am testing the control but when i try paging or order or grouping the grid has not anything, when i delete the radajaxmanger of the page and try to do something with the grid this one disapear.
the same but the radgrid in a aspx work fine.
what's matter????

thank you!!!

3 Answers, 1 is accepted

Sort by
0
David Sánchez
Top achievements
Rank 1
answered on 12 Sep 2008, 06:17 PM
i've created a sample application to show you the the fix

aspx:
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %> 
 
<%@ 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"> 
 
<html xmlns="http://www.w3.org/1999/xhtml">  
<head runat="server">  
    <title></title>  
</head> 
<body> 
    <form id="form1" runat="server">  
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"   
        OutputCompression="AutoDetect">  
    </telerik:RadScriptManager> 
    <div> 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
        </telerik:RadAjaxManager> 
        <table> 
            <tr> 
                <td> 
                    <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> 
                </td> 
                <td> 
                    <asp:Panel ID="Panel1" runat="server" Width="579px">  
                    </asp:Panel> 
                </td> 
            </tr> 
        </table> 
      
    </div> 
    </form> 
</body> 
</html> 

the ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="WebUserControl.ascx.cs" Inherits="WebUserControl" %> 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> 
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True"   
    DataSourceID="SqlDataSource1" GridLines="None">  
<MasterTableView autogeneratecolumns="False" datakeynames="IDOPERATION"   
        datasourceid="SqlDataSource1">  
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="IDOPERATION" DataType="System.Int32"   
            HeaderText="IDOPERATION" ReadOnly="True" SortExpression="IDOPERATION"   
            UniqueName="IDOPERATION">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DSOPERATION" HeaderText="DSOPERATION"   
            SortExpression="DSOPERATION" UniqueName="DSOPERATION">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="FKPARENTOP" DataType="System.Int32"   
            HeaderText="FKPARENTOP" SortExpression="FKPARENTOP" UniqueName="FKPARENTOP">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DSASCXPATH" HeaderText="DSASCXPATH"   
            SortExpression="DSASCXPATH" UniqueName="DSASCXPATH">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="FHULTACT" DataType="System.DateTime"   
            HeaderText="FHULTACT" ReadOnly="True" SortExpression="FHULTACT"   
            UniqueName="FHULTACT">  
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="FKUPDBY" DataType="System.Int32"   
            HeaderText="FKUPDBY" SortExpression="FKUPDBY" UniqueName="FKUPDBY">  
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
 
<FilterMenu EnableTheming="True">  
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
</telerik:RadGrid> 
<asp:SqlDataSource ID="SqlDataSource1" runat="server"   
    ConnectionString="<%$ ConnectionStrings:GiCOTConnectionString %>"   
    SelectCommand="SELECT * FROM [TOPERATIONS]"></asp:SqlDataSource> 

the code of aspx:
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
 
public partial class _Default : System.Web.UI.Page   
{  
    protected void Page_Load(object sender, EventArgs e)  
    {  
 
    }  
    protected void Button1_Click(object sender, EventArgs e)  
    {  
        UserControl MyControl = (UserControl)LoadControl("WebUserControl.ascx");  
        Panel1.Controls.Add(MyControl);  
    }  

when i try to paging the Rad Grid holding
0
David Sánchez
Top achievements
Rank 1
answered on 14 Sep 2008, 12:43 PM
I' ve read that perhaps Q1 2008 SP1 fix the proble, where can i get it?
0
Vladimir
Top achievements
Rank 1
answered on 14 Sep 2008, 04:43 PM
David,

UserControls loaded on post-back events should be reloaded when needed. You can check this example for more info:
http://demos.telerik.com/aspnet/prometheus/Ajax/Examples/Common/LoadingUserControls/DefaultCS.aspx
Tags
Grid
Asked by
David Sánchez
Top achievements
Rank 1
Answers by
David Sánchez
Top achievements
Rank 1
Vladimir
Top achievements
Rank 1
Share this question
or