Advertisement

07.09.2008 at 07:44AM PDT, ID: 23550438
[x]
Attachment Details

Programaticly adding web user control at runtime

Asked by gogetsome in .Net Editors & IDEs

Tags: ASP.net

Hello, this is probably simple but I need some help with this situation.
I programatically add a web user control that I created to a placeholder on the click event of a button with the following code:

 Protected Sub btnDeleteUsers_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnDeleteUsers.Click
        Dim ctlDeleteUser As Control = LoadControl("~/Controls/Admin/Membership/DeleteUser.ascx")
        Me.plControls.Controls.Add(ctlDeleteUser)
    End Sub

I'm having the following issues:
1. During the page load of the DeleteUser.ascx I databind a dropdownlist and insert some instructions. BUT, the page load for the control does not fire.
How do you make if fire with out the page load or postback it is expecting?

2. The DeleteUser.ascx also contains a delete button that fires a stored procedure to delete the user selected from the dropdownlist from the database. BUT, this never fires..

How can I make this occur?

Im new to adding and using controls in this way and am sure it has to do with postback, but can't seem to google the answer I need. Any help would be great!
Start Free Trial
[+][-]07.09.2008 at 07:55AM PDT, ID: 21964290

View this solution now by starting your 7-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

Zone: .Net Editors & IDEs
Tags: ASP.net
Sign Up Now!
Solution Provided By: strickdd
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628