asp.net - Button click not working inside update panel -
When I use the button in the update panel, it does not fire click event, but works out of the update panel is.
Here is the code
& lt; Asp: UpdatePanel id = "updatePanel2" runat = "server" UpdateMode = "Conditional" ChildrenAsTriggers = "false" & gt; & Lt; ContentTemplate & gt; & Lt; Asp: button id = "btnBlock" class = "button" text = "blockcalls" runat = "server" onclick = "btnBlock_Click" enabled = "true" width = "100px" /> & Lt; / ContentTemplate & gt; & Lt; Trigger & gt; & Lt; Asp: AsyncPostBackTrigger ControlID = "btnBlock" /> & Lt; / Trigger & gt; & Lt; / ASP: UpdatePanel & gt;
Code for the button
protected void btnBlock_Click (Object Sender, EventArgs e) {CtiWS.CtiWS CtiWS1 = New CtiWS.CtiWS (); Response.Write ("& lt; scripts> warning (" '+ convert.ToString (session ["BlockCalls"])' ')) "); If (btnBlock.Text == "block call") {btnBlock.Text = "UnBlockCalls"; CtiWS1. Blockcallers ("", "", "", "http Contex. Current session [" hosted "] .toasting ()); // server block call} other {btnBlock.Text = "BlockCalls"; CtiWS1. Blockcallers ("", "", "", "http Contex. Current session [" hosted "] .toasting ()); // server unblock calls}}
try it
set childrenAsTriggers
to true
and EventName = "click"
in asp: asyncPostBackTrigger
< Code> & lt; Asp: UpdatePanel id = "updatePanel2" runat = "server" updatemode = "conditional" child aggregator = "true" & gt; & Lt; ContentTemplate & gt; & Lt; Asp: button id = "btnBlock" class = "button" text = "blockcalls" runat = "server" onclick = "btnBlock_Click" enabled = "true" width = "100px" /> & Lt; / ContentTemplate & gt; & Lt; Trigger & gt; & Lt; Asp: AsyncPostBackTrigger ControlID = "btnBlock" EventName = "click" / & gt; & Lt; / Trigger & gt; & Lt; / ASP: UpdatePanel & gt;
Comments
Post a Comment