Hi Satish,
I had done a mistake in my post ealier. The problem occurs when you put the textbox and the button in a user control and place that user control inside an accordian pane.
Here is the code,
file : testusercontrol.ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="testusercontrol.ascx.cs" Inherits="testusercontrol" %>
<asp:TextBox runat="server" ID="TextBox1" />
<asp:Button runat="server" ID="submit1" Text="submit" />
<asp:Label runat="server" ID="label" ></asp:Label>
file: testusercontrol.ascx.cs
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class testusercontrol : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
submit1.Click += new EventHandler(sub_Click);
}
void sub_Click(object sender, EventArgs e)
{
label.Text = TextBox1.Text;
}
}
Here is the page where I have put the above usercontrol (there is no important code in the code behind for the page, so I am not going to put that here )
file: testatlas.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="testatlas.aspx.cs" Inherits="testatlas" %>
<%@ Register src="testusercontrol.ascx" TagName="testusercontrol" TagPrefix="uc1" %>
<%@ Register Assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="Microsoft.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!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>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
<div>
<cc1:Accordion ID="Accordion1" runat="server" SelectedIndex="0" Width="100%" Height="100%"
>
<Panes>
<cc1:AccordionPane ID="pane1" runat="server">
<Header>pane1</Header>
<Content>
<uc1:testusercontrol id="Testusercontrol1" runat="server">
</uc1:testusercontrol>
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</div>
</form>
</body>
</html>
The issue is when you enter some text on the textbox (which is in the usercontrol) and submit, the label should be populated with whatever you entered, but it does not :(.
It works fine when you put the user control outside of the according control.
Your help is highly appreciated.
Thanks
Rukshan