语法通用(即< T>)web用户控件 [英] Syntax for generic (i.e. <T>) web user control

查看:102
本文介绍了语法通用(即< T>)web用户控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有如下取得了web控件:

Assuming I have made a web control as follows:

public class TestControl<T> : WebControl
{
    ...
}

有没有办法把一个.aspx页面上的控制,而无需通过code办呢?我真的希望能够做一些事情,如:

Is there any way to place that control on an .aspx page without having to do it via code? I really want to be able to do something like:

<controls:TestControl<int> runat="server" />

不过,据我所知是没有办法我通过在通用参数。我试着在网上搜索,并发现这个 http://forums.asp.net/t/ 1309629.aspx ,这似乎正是我追求的,但似乎没有人掌握什么人想要的,我找不到任何关于计算器相似。

But as far as I can tell there is no way of me passing in the generic parameter. I've tried searching on the web and found this http://forums.asp.net/t/1309629.aspx, which appears to be exactly what I'm after, but no one seems to grasp what the guy wanted, and I can't find anything similar on StackOverflow.

推荐答案

没有。有没有办法做到这一点。

No. There's no way to do that.

这篇关于语法通用(即&LT; T&GT;)web用户控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆