1

In ASP.NET, is it possible to use both code behind and inline on the same page? I want to add some inline code that's related to the UI of the page, the reason to make it inline is to make it easy to modify as it outputs some HTML which is why I don't want to add it in the code behind, is this possible in ASP.NET?

Edit: I'm sorry, obviously my question wasn't very clear, what I meant is using a script block with runat="server", this is what I meant by inline code.

Thanks

4

2 回答 2

4

Yes, you can use inline code just like in classic asp. You can use 'this' or 'me' to get to the code behind fields, methods, etc.

于 2008-11-19T01:06:40.280 回答
1

是的,这会起作用,确保类后面的代码被声明为部分类,无论如何这都是默认的。不要认为它适用于 1 或 1.1

于 2008-11-19T02:30:42.607 回答