Click here to Skip to main content
14,843,944 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRefactoring our security - need feedback Pin
gantww20-Jun-08 8:43
Membergantww20-Jun-08 8:43 
QuestionCreating A Web From with database back-end Pin
ferronrsmith20-Jun-08 8:17
Memberferronrsmith20-Jun-08 8:17 
AnswerRe: Creating A Web From with database back-end Pin
SomeGuyThatIsMe20-Jun-08 8:34
MemberSomeGuyThatIsMe20-Jun-08 8:34 
Questionpage_load for user control not firing when address is typed in browser window Pin
chacimulch20-Jun-08 8:06
Memberchacimulch20-Jun-08 8:06 
AnswerRe: page_load for user control not firing when address is typed in browser window Pin
Shaik Haneef20-Jun-08 18:18
MemberShaik Haneef20-Jun-08 18:18 
GeneralRe: page_load for user control not firing when address is typed in browser window Pin
chacimulch23-Jun-08 4:16
Memberchacimulch23-Jun-08 4:16 
GeneralRe: page_load for user control not firing when address is typed in browser window Pin
chacimulch23-Jun-08 5:40
Memberchacimulch23-Jun-08 5:40 
Questionhandling dynamically generated controls Pin
Balram Watwani20-Jun-08 7:49
MemberBalram Watwani20-Jun-08 7:49 
Anybody can help me please!

I have a asp.net page (vb) where I need to create Dynamic Controls. the situation is as follow

I have two links one is inside the panel (add range) and other is outside the panel (add component).
when I click the addrange then the four text boxes are going to add in the panel and when I click on addcomponent then one panel with dropdown box is going to create on the page. I done it but when I click the addcomponent the panel is adding on the page but the boxes on the first panel comes down with the 2nd added panel and first panel does not contain addrange text boxes. I am using webcontrol files. AddRange.ascx and AddComponent.ascx. my code is as follwo.

-----Add Panel----


'Add Panel (component)
Private Sub AddAndRemovePanel()
Dim c As Control = GetPostBackControl(Page)
If Not IsNothing(c) Then
If c.ID.ToString = "btnAddComponent" Then

ltlCountH2.Text = Convert.ToInt16(ltlCountH2.Text) + 1
End If
End If

PH2.Controls.Clear()
Dim ControlID As Integer = 0
For i As Integer = 0 To (Convert.ToInt16(ltlCountH2.Text) - 1)
Dim DynamicUserControl As AddComponent = LoadControl("AddComponent.ascx")
While InDeletedList1("uc1" & ControlID) = True
ControlID += 1
End While
DynamicUserControl.ID = "uc1" & ControlID
AddHandler DynamicUserControl.RemoveUserControl1, AddressOf Me.HandleRemoveUserControl1
AddHandler DynamicUserControl.SelectComponent, AddressOf Me.handleSelectComponent
PH2.Controls.Add(DynamicUserControl)
ControlID += 1
Next
populateADDComponentDropDown()

' MsgBox(ltlCountH3.Text)
' MsgBox("ltlCountH3=" & ltlCountH3.Text)
' MsgBox("ltlCountH1=" & ltlCountH1.Text)
' MsgBox("ltlCountH2=" & ltlCountH2.Text)

End Sub

Private Function InDeletedList1(ByVal ControlID As String) As Boolean
Dim DeletedList() As String = ltlRemovedH2.Text.Split("|")
For i As Integer = 0 To DeletedList.GetLength(0) - 1
If ControlID.ToLower = DeletedList(i).ToLower Then
Return True
End If
Next
Return False
End Function
Sub HandleRemoveUserControl1(ByVal sender As Object, ByVal e As EventArgs)
Dim DynamicUserControl As AddComponent = sender.parent
PH2.Controls.Remove(sender.parent)
ltlRemovedH2.Text &= DynamicUserControl.ID & "|"
ltlCountH2.Text = Convert.ToInt16(ltlCountH2.Text) - 1

End Sub



--------AddRange-------------


'Add Range in Panel
Private Sub AddAndRemoveDynamicControls2()
Dim c As Control = GetPostBackControl(Page)
If Not IsNothing(c) Then
If c.ID.ToString = "btnAddRange" Then
ltlCountH3.Text = Convert.ToInt16(ltlCountH3.Text) + 1
End If
End If

'PH3.Controls.Clear()
Dim ControlID As Integer = 0
For i As Integer = 0 To (Convert.ToInt16(ltlCountH3.Text) - 1)
Dim DynamicUserControl As WebUserControl = LoadControl("AddRange.ascx")

While InDeletedList("uc3" & ControlID) = True
ControlID += 1
End While
DynamicUserControl.ID = "uc3" & ControlID

AddHandler DynamicUserControl.RemoveUserControl, AddressOf Me.HandleRemoveUserControl2

For Each c2 As Control In PH2.Controls

If c2.GetType.Name.ToLower = "addcomponent_ascx" Then
Dim uc As UserControl = CType(c2, UserControl)
Dim mypanel As Panel = uc.FindControl("panel1")
mypanel.Controls.Add(DynamicUserControl)
Else
MsgBox("not found")
End If
Next

'PH2.Controls.Add(DynamicUserControl)
ControlID += 1
Next

End Sub
Private Function InDeletedList2(ByVal ControlID As String) As Boolean
Dim DeletedList() As String = ltlRemovedH3.Text.Split("|")
For i As Integer = 0 To DeletedList.GetLength(0) - 1
If ControlID.ToLower = DeletedList(i).ToLower Then
Return True
End If
Next
Return False
End Function
Sub HandleRemoveUserControl2(ByVal sender As Object, ByVal e As EventArgs)
Dim DynamicUserControl As WebUserControl = sender.parent
PH3.Controls.Remove(sender.parent)
ltlRemovedH3.Text &= DynamicUserControl.ID & "|"
ltlCountH3.Text = Convert.ToInt16(ltlCountH3.Text) - 1
End Sub
QuestionAdd image to a web page Pin
zvit20-Jun-08 7:34
Memberzvit20-Jun-08 7:34 
AnswerRe: Add image to a web page Pin
tina->newcoder20-Jun-08 8:00
Membertina->newcoder20-Jun-08 8:00 
AnswerRe: Add image to a web page Pin
Sathesh Sakthivel20-Jun-08 19:06
MemberSathesh Sakthivel20-Jun-08 19:06 
AnswerRe: Add image to a web page Pin
Christian Graus20-Jun-08 21:46
protectorChristian Graus20-Jun-08 21:46 
QuestionCheckBox Control retaining state Pin
P Nandi20-Jun-08 5:41
MemberP Nandi20-Jun-08 5:41 
QuestionNew to ASP Pin
KirkNew2ASP20-Jun-08 4:59
MemberKirkNew2ASP20-Jun-08 4:59 
AnswerRe: New to ASP Pin
Jay Royall20-Jun-08 5:38
MemberJay Royall20-Jun-08 5:38 
QuestionDisable Copy Slide, Edit Slide and Print Slide options in .pps file. Pin
VivekNema20-Jun-08 4:39
MemberVivekNema20-Jun-08 4:39 
Questiontextbox value addition Pin
ManiMughal20-Jun-08 4:36
MemberManiMughal20-Jun-08 4:36 
AnswerRe: textbox value addition Pin
windhopper20-Jun-08 4:45
Memberwindhopper20-Jun-08 4:45 
GeneralRe: textbox value addition Pin
ManiMughal20-Jun-08 4:51
MemberManiMughal20-Jun-08 4:51 
GeneralRe: textbox value addition Pin
tina->newcoder20-Jun-08 8:04
Membertina->newcoder20-Jun-08 8:04 
GeneralRe: textbox value addition Pin
windhopper22-Jun-08 22:07
Memberwindhopper22-Jun-08 22:07 
QuestionServer Control help? Code attached Pin
windhopper20-Jun-08 4:01
Memberwindhopper20-Jun-08 4:01 
AnswerRe: Server Control help? Code attached Pin
Abhijit Jana20-Jun-08 4:04
professionalAbhijit Jana20-Jun-08 4:04 
GeneralRe: Server Control help? Code attached Pin
windhopper20-Jun-08 4:17
Memberwindhopper20-Jun-08 4:17 
QuestionThe solution to our ASP.NET page timeout problems... Pin
AndyBrew7020-Jun-08 3:53
MemberAndyBrew7020-Jun-08 3:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.