473,396 Members | 1,608 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

click event is not firing in ascx file within web form

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
Nov 18 '05 #1
2 7205
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
"sanju" <sa**********@xtra.co.nz> wrote in message
news:u2**************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2


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!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Tim Thomas | last post by:
Hi, I am very new to .NET and am in the process of building my first web application. I will briefly describe what i am trying to achieve: I have a system where suppliers register their...
1
by: Earl Teigrob | last post by:
PROBLEM: When a user control is loaded into a PlaceHolder control more than once, the events do not fire on the first click of a control on the dynamically loaded user control. In other words, the...
2
by: ~~~ .NET Ed ~~~ | last post by:
I have a problem (don't we all?). I have a web form with multiple modules, some of these modules have an ASP.NET (server run) button. OK, now I have UserControlX which has one such button (say...
1
by: Luis Esteban Valencia Muñoz | last post by:
Hello Experts, I have three classes: Globals.cs, FunctionalArea.ascx.cs, and ReprotList.ascx.cs. The idea is that when one drop down is changed (i.e. Functional Area), another drop down on...
2
by: Curt_C [MVP] | last post by:
I've got a Repeater and within it a LinkButton. The LinkButton has an CommandName="Test" In the Repeater's ItemCommand event I want to check for this command name but the problem I'm having is...
4
by: TS | last post by:
I am creating a User control and i create some dynamic controls in the init handler. one of the controls is a custom validator which i assign a serverValidate event handler. I usally always do my...
0
by: =?Utf-8?B?Smlt?= | last post by:
I have an application that was built using asp.net 1.1. The application interviews the user with a parent form that loads a series of web user controls (.ascx files)dynamically with...
1
by: Andrew Jocelyn | last post by:
Hi I have a Formview control in a UserControl. The server-side validation is not working, i.e. the events are not firing when a button control which causes validation is fired or even when...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.