views:

50

answers:

1

i have written following code to access public variable of asp.net onclick event on button but its not giving me desired output.. please check it:

<asp:Button runat="server" CssClass="txtdisplay" ID="Button1"
 Text="Browse all jobs in area" 
OnClientClick="return navigateURL('index.aspx?c=<%=cityid %>')" />
+1  A: 

You cannot inline anything for server controls. You have to do it in the code behind.

This:

"return navigateURL('index.aspx?c=<%=cityid %>')"

Should Be This:

Button1.OnClientClick = "return navigateURL('index.aspx?c=" + city + ")"; 
ChaosPandion
its giving me syntax error
Rajesh Rolen- DotNet Developer
@Dot Net: Can you show us what you have tried?
ChaosPandion