Jump to content

Problem in Iterating panel control


siri

Recommended Posts

Hi,I have used the foll code to insert the user control in a panel control.But I am always getting a count of 0.Here is the code************************Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Clickdim msg as string ="" For counter = 0 To p1.Controls.Count - 1 (p1 -> Panel) msg = msg & p1.Controls(counter).ToString Next Response.Write(msg) End SubProtected Sub l1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles l1.Click Dim obj As WebUserControl Dim ctl As Control ctl = Page.LoadControl("webusercontrol.ascx") obj = CType(ctl, WebUserControl) obj.ID = ctl.GetHashCode().ToString p1.Controls.Add(obj) End Sub---------------------------------------------Here is the user control<%@ Control Language="VB" AutoEventWireup="false" CodeFile="WebUserControl.ascx.vb" Inherits="WebUserControl" %><p>Street Address:<br><asp:TextBox ID="Street" Runat="Server" /><p>City:<br><asp:TextBox ID="City" Runat="Server" /

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...