CovertCoder
Login
|
Register
Search
Main Navigation
Home
Contact Us
Login
Register
Tools
Code Generator
Knowledge Base
Featured Articles
Adding an AJAX Collapsible Panel
Binding Listbox with XLINQ
Calling Parent Page from Child
Datagrid Sort with LINQ
ListView in UpdatePanel
Programmatically call FancyBox
Tutorials
ASP.Net Tutorials
Add nicEdit to an ASP.Net page
AJAX Tutorials
Convert Web App for MVC Framework
Keep state of Collapsible Panel
Retrieving XML Config file values
Windows phone 7 Styles (Static Resources)
Topic: How to add a trigger to an UpdatePanel programmatically
Description:
This will show you how to add a trigger to an update panel programatically.
Dim
myTrigger
As New
PostBackTrigger
myTrigger.ControlID = myControl.ClientID.ToString()
myUpdatePanel.Triggers.Add(myTrigger)
Example:
Dim
myTrigger
As New
PostBackTrigger
myTrigger.ControlID = btnFinish.ClientID.ToString()
upnlMain.Triggers.Add(myTrigger)
To add a trigger in the markup, you use the following syntax
Note: Setting UpdateMode to "conditional" means that it will only postback it own update panel if there are others on the page. Also, you must have an UpdatePanel set to "conditional" if you are going to try to update it programmatically
</
asp:UpdatePanel
ID
="upnlMain"
runat
="server"
UpdateMode
="conditional">
<
ContentTemplate
>
...Content...
</
ContentTemplate
>
<
Triggers
>
<
asp
:
PostBackTrigger
ControlID
="btnFinish" />
</
Triggers
>
</
asp
:
UpdatePanel
>
Home
~
Topic