How can i assign variable in aspx page?
See i have tried
<div>
<asp:TextBox ID="UsernameTextBox" Text="xxx" runat="server"></asp:TextBox>
<%= string ss= UsernameTextBox.Text.ToString() %>
<asp:Button ID="btnLogin" runat="server"
OnClientClick="LoginPopup( <%= UsernameTextBox.Text %>); return false;"
CssClass="login-button" Text="xxx">
</asp:Button>
</div>
I have assigned usernametextbox value in string
<%= string ss = UsernameTextBox.Text.ToString() %>
But it's showing error like : Invalid Expression term 'string'
Why i can't do that? Is it possible?
But if i remove the "string ss= " then it's <%= UsernameTextBox.Text.ToString() %> working good.
I can't assign the values to a string variable. Why?
Is a bug in .net?or any wrong syntax format?