click event is not firing in ascx file within web form

S

sanju

hi there i am trying to fire an button event in ascx file which interacts
with database ,my problem is " i am calling ascx file wiht a button click
dynamically when user needs to update database in aspx page , but the the
update button in ascx is not firing .. ..

but it is working fine when i call ascx like this manually.

'<callcontrol:callcontrol id=callcontrol runat="server"/>

<%@ Register TagPrefix="callcontrol" TagName="callcontrol"
src="callcontrol.ascx" %>

sub logacall(s As Object, e As EventArgs)
dim callcontrol1 as Control
callcontrol1= new callcontrol
LoadControl("callcontroll.ascx")
placeholder1.Controls.Add(callcontrol1)
end sub




plz help me in this regard i am trying since days to sort this.. i want to
load ascx file when a user needs.

sanju
 
S

S. Justin Gengo

sanju,

When you add a control to a page dynamically, it needs to be added again on
postback in order for that control's events to fire on postback.

I have some sample code for dynamically adding controls that may be helpful
for you to look at. In the code library of my site, www.aboutfortunate.com,
use the search box and search for: dynamic controls. You'll get a few useful
samples.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 
S

sanju reddy

thank u very much justin.. i got it event firing in ascx ..now its
working fine.. thank u very much,and the site is really helpful.

cheers
sanju

*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top