ASP.NET中的UserControls问题... [英] UserControls in ASP.NET Problem...

查看:60
本文介绍了ASP.NET中的UserControls问题...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个usercontrol并调用aspx页面,所以我创建了一个示例usercontrol页面,我将usercontrol调用到asp页面,就像这样

 <%@    注册    TagPrefix   =  uc    TagName   =  UserInformation    Src   = 〜/ userinformation.ascx >  



我的问题是在html body标签里面我无法调用tagprefix任何1可以帮助我,我的编码在下面



<%@ 页面 语言 = < span class =code-keyword> C# AutoEventWireup = true CodeFile = Default.aspx.cs 继承 = _默认 %>
<%@ 注册 TagPrefix = uc TagName = UserInformation < span class =code-attribute> Src = 〜/ userinformation.ascx %>

< ; !DOCTYPE html PUBLIC - // W3C // DTD XHTML 1.0 Transitional // EN http: //www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">

< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = server >
< title > < / title >
< / head >
< 正文 >
< 表格 id = form1 runat = server >
< div >
< table >
< tr >
< td > < uc < / td >
< / tr >
< span class =code-keyword>< / table >
< / div >
< / form >
< / body > ;
< / html >

解决方案

添加注册用户控件后,您是否构建了解决方案?如果没有尝试,看看你是否能通过intellisense获得标签。


I'm trying for creating a usercontrol and call into aspx page, so i created a sample usercontrol page and i called the usercontrol into the asp page like this

<%@ Register TagPrefix="uc" TagName="UserInformation" Src="~/userinformation.ascx">


My problem is inside the html body tag i'm unable to call the tagprefix can any 1 help me and my codings are below

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="uc" TagName="UserInformation" Src="~/userinformation.ascx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <table>
    <tr>
    <td> <uc </td>
    </tr>
    </table>
    </div>
    </form>
</body>
</html>

解决方案

After adding registering the user control, did you build your solution? If not try that and see if you are able to get the tag through intellisense .


这篇关于ASP.NET中的UserControls问题...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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