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

Enabling a Panel control that was not visible on page load

3 Answers 369 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
jwhitley
Top achievements
Rank 1
jwhitley asked on 08 Apr 2010, 02:55 PM
In previous versions of RadControls for ASP.NET I was able to still have a standard button perform a postback which set the visible attribute of a previously hidden panel to true. That seems to have changed with the later versions.

In short, how can I have major sections of a page appear on a button press without having to set visible properties on multiple controls - eg previously I was just able to show / hide a complete panel. What is the recommended way of achieving this now?

Apologies for what must be a trivial question!

3 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 12 Apr 2010, 11:58 AM
Hello,

Could you please confirm if you are using Telerik RadAjaxPanel control which is initially hidden on the page?  I would also suggest you to paste a small code snippet which represents the described behavior so we could properly assist you.


All the best,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
jwhitley
Top achievements
Rank 1
answered on 27 Apr 2010, 11:57 AM
Hi Maria,

I rewrote a section of my code to show the behaviour and, guess what, this simplified version works just fine. Time to trawl through my original code and find out what's happening.

Just so that it doesn't go to waste, here's the simplified version that works:

<%@ 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:RadCodeBlock ID="RadCodeBlock1" runat="server">  
        <script type="text/javascript">  
 
    function RowClick(index, eventArgs) {  
        var index2 = eventArgs.get_itemIndexHierarchical();  
        var ajaxManager = $find("<%= RadAjaxManager1.ClientID %>");  
        ajaxManager.ajaxRequestWithTarget("<%= RadGrid1.UniqueID %>", "RowClicked:" + index2)  
    }  
        </script> 
    </telerik:RadCodeBlock> 
 
    <div> 
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server">  
        </telerik:RadScriptManager> 
 
        <telerik:RadGrid ID="RadGrid1" runat="server">  
            <ClientSettings Selecting-AllowRowSelect="true" ClientEvents-OnRowClick="RowClick">  
            </ClientSettings>   
        </telerik:RadGrid> 
 
        <br /><br /> 
 
        <asp:Panel ID="Panel1" runat="server" Visible="false">  
            <asp:Label ID="Label1" runat="server" Text="Now you can see this label"></asp:Label><br /><br /> 
            <asp:TextBox ID="TextBox1" runat="server" Text="and this textbox"></asp:TextBox> 
        </asp:Panel> 
 
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">  
            <AjaxSettings> 
                <telerik:AjaxSetting AjaxControlID="RadGrid1">  
                    <UpdatedControls> 
                        <telerik:AjaxUpdatedControl ControlID="Panel1" /> 
                    </UpdatedControls> 
                </telerik:AjaxSetting> 
            </AjaxSettings> 
        </telerik:RadAjaxManager> 
 
    </div> 
    </form> 
</body> 
</html> 
using System;  
using System.Collections.Generic;  
using System.Linq;  
using System.Web;  
using System.Web.UI;  
using System.Web.UI.WebControls;  
using System.Data;  
 
public partial class _Default : System.Web.UI.Page  
{  
    DataTable dt;  
 
    protected void Page_Load(object sender, EventArgs e)  
    {  
        if (!Page.IsPostBack)  
        {  
            dt = new DataTable("Test");  
            dt.Columns.Add(new DataColumn("Column 1"typeof(System.String)));  
            dt.Rows.Add(new object[] { "I am a row" });  
            RadGrid1.DataSource = dt;  
            RadGrid1.DataBind();  
        }  
    }  
 
    protected override void RaisePostBackEvent(IPostBackEventHandler source, string eventArgument)  
    {  
        base.RaisePostBackEvent(source, eventArgument);  
 
        if (source == this.RadGrid1 && RadGrid1.Items.Count != 0 && eventArgument.IndexOf("RowClicked") != -1)  
        {  
            Panel1.Visible = !Panel1.Visible;  
        }  
    }  

Many thanks
0
Maria Ilieva
Telerik team
answered on 28 Apr 2010, 11:09 AM
Hello,

I'm glad that you have managed to fix the issue.
Do not hesitate to contact us back if further assistance is needed.


Regards,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
jwhitley
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
jwhitley
Top achievements
Rank 1
Share this question
or