开发者

UniqueID vs html element actual id

I'm creating composite control, which has two other components that rely on each other.

In component A (image), I access component's B (input) UniqueID which equals

MyTextBox1$BoldTextBox

I use it in onclick JavaScript code...

But in rendered HTML input element has following id

MyTextBox1_BoldTextBox

So my javascript code , generated inside composite control has something like this:

onclick=$('#MyTextBox1开发者_Python百科$BoldTextBox').....

instead of:

onclick=$('#MyTextBox1_BoldTextBox').....

Could somebody please explain what is happening, and how can I reliably associate those two controls ?

Thanks , Paweł


You want the ClientID property instead of the UniqueID property.

The reason for this is (sort of) explained on Atanas Korchev's blog post "The difference between Id, ClientID, and UniqueID".

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜