2

I have a masterpage that contains all the javascript and inside the content control, there is a link that calls a javascript function and I want to pass the id once it's rendered differently by the server.

<asp:TextBox ID="txtstart" runat="server" Width="20%"></asp:TextBox>
<a title="Pick Date from Calendar" onclick="calendarPicker('<% txtstart.ClientId %>');" href="javascript:void(0);">

However, I keep getting this error:

Property access must assign to the property or use its value.

How would I be able to accomplish this?

1 Answer 1

1

Try this instead (notice the <%= in the onclick attribute):

<asp:TextBox ID="txtstart" runat="server" Width="20%" />
<a title="Pick Date from Calendar" 
   onclick="calendarPicker('<%= txtstart.ClientId %>');" 
   href="javascript:void(0);">
</a>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.