更新时间:2023-10-14 14:27:58
我得到它的工作最后。我采取了不同的方法,但。
I got it to work finally. I took a different approach though.
[总成:标签preFIX(myNameSpace对象,mycustomtag)]
[ToolboxData(< {0}:GridViewRowClickable RUNAT =服务器>< / {0}:GridViewRowClickable>中)]
[assembly: TagPrefix("mynamespace", "mycustomtag")]
[ToolboxData("<{0}:GridViewRowClickable runat=server></{0}:GridViewRowClickable>")]
这增加了相应的Register指令在aspx页面的顶部,并修复了所有我收到的警告。自动完成也可以在此情况下,也
This adds the appropriate Register directive at the top of the aspx page and fixed all the warnings I received. The auto complete also works in this case as well.
下面是code。
<%@ Page Title="" Language="C#" MasterPageFile="~/MyMaster.master" AutoEventWireup="true" Inherits="MyPage" Codebehind="MyPage.aspx.cs" %>
<%@ Register Assembly="GridViewRowClickable" Namespace="CustomServerControls" TagPrefix="MyTag" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:SqlDataSource ID="Sql_MyTable" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand="spTbl_Select" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<egcc:GridViewRowClickable ID="GridViewRowClickable_test" runat="server"
DataSourceID="Sql_MyTable" DataKeyNames="tbl_id"
AllowSorting="True" AutoGenerateColumns="False" GridLines="None" PageSize="25" Width="100%"
EnableRowClickSelection="true" RowClickCommand="Select" OnSelectedIndexChanged="GridViewRowClickable_test_OnSelectedIndexChanged">
<Columns>
<asp:BoundField HeaderText="ID" DataField="tbl_id" SortExpression="tbl_id" />
<asp:BoundField HeaderText="Name" DataField="tbl_name" SortExpression="tbl_name" />
</Columns>
<EmptyDataTemplate>
No Data.
</EmptyDataTemplate>
</egcc:GridViewRowClickable>
</asp:Content>