|
Rank: Advanced Member Groups: Member
Joined: 5/31/2007 Posts: 58
|
Hi,
i've a Dialog control with inside ContentTemplate a control. I get control with DialogID.FindControl(ControlID) and it ever work fine. I've have install new dll version and FindControl now find nothing.. but it not is realy correct.. because if i put a break point in the code before finding control and i try to view value (usign DialogID.Control(0).FindControl(ControlID)) for some times it get nothing but at the end get the control. It is like if the control is not till designed.
Thanks Samuele
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi Samuele,
I am not sure what you mean by "it is like if the control is not till designed". Can you paste your code with detailed description about how it's working/not working so that we can take a look?
Thanks
|
|
Rank: Advanced Member Groups: Member
Joined: 5/31/2007 Posts: 58
|
I'm sorry for my bad English..
Code: HTML/ASPX
<%@ Register TagPrefix="eo" Namespace="EO.Web" Assembly="EO.Web" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="WebApplication2.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<eo:Dialog id="Dialog1" style="Z-INDEX: 101; LEFT: 8px; POSITION: absolute; TOP: 8px" runat="server"
Height="100px" Width="168px" BackColor="#47729F" ControlSkinID="None" HeaderHtml="Dialog Title"
FooterHtml="Dialog Footer">
<HeaderStyleActive CssText="border-right: #22456a 1px solid; padding-right: 4px; border-top: #ffbf00 3px solid; padding-left: 4px; font-weight: bold; font-size: 11px; padding-bottom: 2px; color: white; padding-top: 2px; border-bottom: #22456a 1px solid; font-family: verdana"></HeaderStyleActive>
<ContentStyleActive CssText="border-right: #22456a 1px solid; padding-right: 4px; border-top: #7d97b6 1px solid; padding-left: 4px; border-left-width: 1px; font-size: 11px; border-left-color: #728eb8; padding-bottom: 4px; color: white; padding-top: 4px; border-bottom: #22456a 1px solid; font-family: verdana"></ContentStyleActive>
<ContentTemplate>
<asp:Button id="ToSearch" runat="server" Text="Button"></asp:Button>
</ContentTemplate>
<FooterStyleActive CssText="border-right: #22456a 1px solid; padding-right: 4px; border-top: #7d97b6 1px solid; padding-left: 4px; border-left-width: 1px; font-size: 11px; border-left-color: #728eb8; padding-bottom: 4px; color: white; padding-top: 4px; border-bottom: #22456a 1px solid; font-family: verdana"></FooterStyleActive>
</eo:Dialog>
</form>
</body>
</HTML>
In this case ToSearch is nothing
Code: Visual Basic.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ToSearch As Button = Dialog1.FindControl("ToSearch")
End Sub
In this case get error "Index is over ..." But is you put a break point work correctly.
Code: Visual Basic.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ToSearch As Button = Dialog1.Controls(0).FindControl("ToSearch")
End Sub
Thanks Samuele
|
|
Rank: Newbie Groups: Member
Joined: 7/18/2007 Posts: 8
|
Hi Samuele, From what I understand, I had some difficulty during the learning curve on this control. But once you get the hang of it, it is packaged quite nice. When I call the "FindControl" function, and I am using the ContentTemplate, I actually call it under the "ContentContainer" property of the dialog class. Like so...
Code: Visual Basic.NET
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ToSearch As Button = Dialog1.ContentContainer.FindControl("ToSearch")
End Sub
This should get you what you need. Happy Coding! Padishar
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Thanks Padishar! You are absolutely right. ContentContainer is exactly for that purpose.
|
|
Rank: Advanced Member Groups: Member
Joined: 5/31/2007 Posts: 58
|
Its work fine!!
Very thenks for all Samuele
|
|