Visual Studio keeps replacing my custom control namespace in designer.cs

LenStonna

New Member
I try to create a custom control which inherits from GridView ( using tut http://msdn.microsoft.com/en-us/library/yhzc935f(v=vs.100).aspx ). After each build Visual Studio keeps replacing my reference to my custom namespace with its own in Default.aspx.designer.cs\[code\]protected global::System.Web.UI.WebControls.WebParts.GridViewCustom GridView1;\[/code\]each time I did put\[code\]protected GridViewCustom.GridViewCustom GridView1;\[/code\]Why ?In assembly.cs I have added\[code\]using System.Web.UI;...[assembly: TagPrefix("GridViewCustom", "GridViewCustom")]\[/code\]In default.aspx I have:\[code\] <asp:GridViewCustom ID="GridView1" runat="server"> </asp:GridViewCustom>\[/code\]This is my source code for the control (source file is in App_Code):\[code\]using System;using System.Collections.Generic;using System.ComponentModel;using System.Text;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace GridViewCustom{ [DefaultProperty("Text")] [ToolboxData("<{0}:GridViewCustom runat=server></{0}:GridViewCustom>")] public class GridViewCustom : System.Web.UI.WebControls.GridView { [Bindable(true)] [Category("Appearance")] [DefaultValue("")] [Localizable(true)] public string Text { get { String s = (String)ViewState["Text"]; return ((s == null) ? String.Empty : s); } set { ViewState["Text"] = value; } } protected override void RenderContents(HtmlTextWriter output) { output.Write(Text); } }}\[/code\]
 
Back
Top