I have a text box like this:
<asp:TextBox ID="txtLogin" runat="server" Text='<%# strUserID %>'></asp:TextBox>
strUserID
is a string value set in my codebehind and I bind the textbox to see the value. I tried with <%= strUserID %>
, but it doesnt work for me. can you please tell me why?
Also, I have a hidden field like this:
<input id="hdnUserID" runat="server" type="hidden" value='<%=txtLogin.ClientID %>' />
and I have a function prints the hidden field value like this:
function CheckForValue()
{
var uid = window.document.getElementById('<%= txtLogin.ClientID %>').value;
alert(hdnUserID);
return false;
}
But this alert always prints as "[object]". Can anyone please explain this? Looks like <%= value %>
doesnt work at all. But I have seen in my earlier projects where the existing code has these kinda lines!!