如何注册一个服务器端点击一个HTMLGenericControl?服务器端、HTMLGenericControl

2023-09-03 06:39:27 作者:海以南不再蓝

我在寻找一个可靠的机制来生成服务器端回传处理程序的HTMLGenericControl如li元素。

I'm looking for a reliable mechanism to generate a server side postback handler for an HTMLGenericControl such as an li element.

我有一些标记,我不希望改变,并会preFER以同样的方式对待这是一个标准的.NET服务器控件。

I have some markup that I do not wish to change and would prefer to treat this in the same fashion as a standard .Net server control.

另外,我知道我可以使用一个基于模板的控制,将一些.NET控件的标记中为隐藏,然后从客户端点击代理触发其click事件。不过,我真的询问,这是否可以做的更好。

Also, I know I can use a template based control to place some .Net controls within the markup as hidden and then trigger their click events from a client side click proxy. However, I'm really enquiring as to whether this can be done better.

推荐答案

与你所需要的问题是: - 有没有服务器端控制,有效的事件处理程序,使服务器端事件可触发

The problem with what you need is: - there are no server-side control with a valid event handler so that a server-side event can be triggered.

几个选项,我能想到的:

Couple of options I can think of:

使用 PageMethods 调用__doPostBack() 调用自定义的javascript做一个XMLHTTP请求到服务器