Hello forum! I have an aspx page with a panel, 1 button and 2 animation extender. The button is associated to one of the animation extender and it has in the property "OnClientClick"=return false;
This is all working well.
In the panel I have 1 label that I want is values to change always I click in the button. But, because of the property "OnClientClick"=return false; all the code that I have in the OnClick of the Button doesn't work! If I took of the property, the animation panel don't show...
Here is the code I have in my button:
Protected Sub btnInfo_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnInfo.Click
lbl_name.Text = "Liliana"
End Sub
Please help me!!
Thanks
????????????????
Liliana
Portugal
Hi Liliana
As far as i know, there is no way to do waht you want to do in that method. The button either works on the client OR the server not both
However, you could add a page method to populate the button's click event like this
<asp:button id="btnLilianaButton" runat="server" Text="Click Me" OnClientClick='<%# LilianaPageMethod()%>' />
and on the Page code-behind have a method like this
public string LilianaPageMethod(){return"javascript:$get('" + lbl_name.ClientID +"').innerText = 'Liliana';return false;";}
This statement is evaluated when the page is rendered only so is pretty static. You could also use a WebMethod via javascript if you so wished and this could interact fully with the server
Hope this helps
Tim
Hello Tim! Thanks for your help but I solve the problem by other way.
I put the panel inside an AJAX Update Panel and the code inside the Load Event of the Update Panel. And it works fine!
Thanks,
Liliana
No comments:
Post a Comment