开发者

Binding doesn't work inside a JQuery callback

I have the following code:

<input type="text" ID="JOB_CODETextBox" runat="server" value='<%# Eval("JOB_CODE") %>' readonly="readonly" 
onclick="$('#basic-modal-content').modal(
{
   appendTo:'form开发者_开发问答', persist: true,
   onClose: function (dialog) 
            {
                document.findElementById('<%= JOB_CODETextBox.ClientID %>').value = 'value'; 
                $.modal.close();
            } 
} );" />

The problem is, the binding '<%= JOB_CODETextBox.ClientID %>' doesn't work, it returns the same binding expression after renderign instead of replace it with the actual client id!

Any help !!

Thanks in advance.


You can't use codeblocks (<%%>) inside a server side control in this manner.

You are trying to render server side code in a control that is already server side.

Binding Expressions (<%#%>) are designed to work within server side controls and don't have this issue.

Why can't you bind the click event outside the control declaration, in a javascript section? That will work as you expect.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜