[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

11/06/2008 at 04:45AM PST, ID: 23881235
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

Why the event from my button is not working?

Asked by eddyperu in C# Programming Language, Asynchronous Javascript and XML (AJAX), .NET Framework 2.x

Tags: C# ,ASP.net 2.0, Ajax

Hi Experts!
I have  a Web User Control(WebUserControl.ascx) that contained a Panel(Panel1) and inside this panel there is a button(Button1) that have a click event.
Also, I have a Page in which I am trying to create  the control " collapsible Panel"  programatically(this control is Ajax).
I am trying to set the panel(Panel1) from my Web User Control inside the Collapsible panel, which I have done it.
The Problem: The  click event from the button(Button1)  inside the WebuserControl is not triggering at all.
Thinking about the Problem: I think that the problem is in this line:
                                              cpe1.TargetControlID = myControl.StepPanel.UniqueID;

Somehow the right ID has not being called or something like this, I tried the .ClientID and appear this error:
Exception Details: System.InvalidOperationException: The TargetControlID of 'CollapsiblePanelExtender' is not valid. A control with ID 'MyControl1_ContentPanelStep' could not be found

Thanks for your help!! :)

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
This is the web user control .ascx
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Exampletry.ascx.cs" Inherits="controls_Exampletry" %>
<asp:Panel ID="ContentPanelStep" runat="server" CssClass="collapsePanel" BackColor="#EAE3CF">
<table>
 <tr>
   <td>
    <asp:Button ID="Button1" runat="server" Text="Testing" OnClick="Button1_Click" />   
   </td>
 </tr>
</table>
</asp:Panel>
 
This is the web user control ascx.cs:
public partial class controls_Exampletry : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //string buttonID = this.UniqueID.Replace(this.ID, Button1.UniqueID);
        //Button1.ID = this.UniqueID + Button1.UniqueID;
        //Button1.ID = "TestButtonID1";
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
              //this is the part is not triggering
    }
 
    public Panel StepPanel
    {
        get { return ContentPanelStep; }  //this is my panel and inside this panel there is a button
    }
}
 
 
This is my code in my page:
    protected void Page_Load(object sender, EventArgs e)
    {
        
        controls_Exampletry myControl = (controls_Exampletry)Page.LoadControl("controls/Exampletry.ascx");
        myControl.ID = "MyControl1";
 
        controls_NewHireWorkflowStepControl myHeaderControl = (controls_NewHireWorkflowStepControl)Page.LoadControl("controls/NewHireWorkflowStepControl.ascx");
        myHeaderControl.ID = "MyHeaderControl1";
        //panel1.Controls.Add(myControl);  
 
 
        HtmlTableRow stepRow = new HtmlTableRow();
        HtmlTableCell stepCell = new HtmlTableCell();
        
 
        AjaxControlToolkit.CollapsiblePanelExtender cpe1 = new AjaxControlToolkit.CollapsiblePanelExtender();
        cpe1 = new AjaxControlToolkit.CollapsiblePanelExtender();
        cpe1.ID = "CollapsiblePanelExtender";
        cpe1.TargetControlID = myControl.StepPanel.UniqueID;
        cpe1.BehaviorID = "CPEBehavior";        
        cpe1.Collapsed = true;
        cpe1.ExpandControlID = myHeaderControl.StepHeaderPanel.UniqueID;
        cpe1.CollapseControlID = myHeaderControl.StepHeaderPanel.UniqueID;
        cpe1.AutoCollapse = false;
        cpe1.AutoExpand = false;
        cpe1.ScrollContents = false;
        cpe1.ExpandDirection = AjaxControlToolkit.CollapsiblePanelExpandDirection.Vertical;
 
        stepCell.Controls.Add(myHeaderControl);
        stepCell.Controls.Add(myControl);
        stepCell.Controls.Add(cpe1);
        stepRow.Cells.Add(stepCell);
        StepsTable.Rows.Add(stepRow);
 
 
    }
[+][-]11/06/08 07:33 AM, ID: 22896057

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/06/08 08:32 AM, ID: 22896845

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/07/08 09:42 AM, ID: 22906817

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: C# Programming Language, Asynchronous Javascript and XML (AJAX), .NET Framework 2.x
Tags: C# ,ASP.net 2.0, Ajax
Sign Up Now!
Solution Provided By: eddyperu
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20091111-EE-VQP-91 / EE_QW_2_20070628