asp.netgridviewcustom-controlsvisual-studio-designerdatafield

Issue in the Design View for ASP.Net Custom Server side Control which inherits GridView


I have created a Custom Server Side Control which inherits GridView Class. I have added a public string property, which accepts the column names of the Data Source(DataSet or DataTable) with comma separator. Now I have implemented the required methods(in my case I have overridden the OnRowDataBound Event) and used the custom property values. I have used the same DLL in other projects too. Declared the property as below

[Bindable(false)]
public string RowSpanColumn
{
     get { return _RowSpanColumn; }
     set { _RowSpanColumn = value; }
}

I have dragged the control on to my ASPX page, the design view of VS looks fine(same as GridView design). But when I am setting the custom property as mentioned above, design view of the control is showing error on top of it as

There was an error rendering the control.Object reference not set to an instance of an object

And the ASPX Page is running perfectly as expected, there is only an issue with design view of Visual Studio. Please help me to find a solution. Thanks

Update

We have observed that renaming the Property name to other than RowSpanColumn say RSColumn. The Design is showing perfectly. I wanna know, if RowSpanColumn is predefined property used by Visual Studio? Please help me.


Solution

  • Have you tried adding design time support for your custom control?

    Here are few links that might help.

    ASP.NET Control Designers Overview -- http://msdn.microsoft.com/en-us/library/wxh45wzs.aspx

    Design Time Architecture -- http://msdn.microsoft.com/en-us/library/c5z9s1h4.aspx

    Custom Design-time Control Features in Visual Studio .NET -- http://msdn.microsoft.com/en-us/magazine/cc164048.aspx

    Extending Design Time Support --
    http://msdn.microsoft.com/en-us/library/37899azc.aspx

    For more you can try to debug the issue using another instance of visual studio and attach to existing process.