I am trying to implement a custom control using a RowClickableGridView
class provided on this Stack Overflow post. This is the first time I have tried to create a custom server control and followed steps laid out in this MSDN walkthrough.
I have the RowClickableGridView
class in the App\_Code
directory of my Web Application Project with a namespace of MyWebApplication.App\_Code
, and it compiles.
My problem is that the .aspx
page that I am trying to use the control on does not recognize the tag prefix. The page also has numerous warnings for unsupported elements between the cc1:GridViewRowClickable
tags. I thought I had everything in place according to the MSDN walkthrough.
Code Snippet
<%@ Page Title="MyPage" Language="C#" MasterPageFile="~/MyMaster.master" AutoEventWireup="true" Inherits="MyPage" Codebehind="MyPage.aspx.cs" %>
<%@ Register TagPrefix="cc1" TagName="RowClickableGridView" Namespace="MyWebApplication.App_Code" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnectionString %>" SelectCommand="MySpName" SelectCommandType="StoredProcedure">
</asp:SqlDataSource>
<cc1:RowClickableGridView ID="GVW_test" runat="server" DataSourceID="SqlDataSource1">
<HeaderStyle CssClass="ListTop" />
<RowStyle CssClass="RowHighlight" />
<Columns>
<asp:BoundField HeaderText="ID" DataField="Atr_ID" SortExpression="Atr_ID" />
<asp:BoundField HeaderText="Name" DataField="Atr_Name" SortExpression="Atr_Name" />
</Columns>
<EmptyDataTemplate>
No Data
</EmptyDataTemplate>
</cc1:RowClickableGridView>
</asp:Content>
Any idea on what I am doing wrong or suggestions on what to try next?