Reputation: 3694
I have two problems:
I am creating a WebControl and I like to add SqlDataSource
as its property. It doesn't matter under what is the property name, Visual Studio shows its name as Database. Following is my code and Visual Studio 2010 express shows all Data1~Data3 properties in Property Editor as "Database"
Second problem is when I click on arrow beside the Databse name in Property Editor I get an exception "The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))"
Which part I'm doing wrong?
My component code:
using System;
using System.ComponentModel;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Collections;
namespace Comp1 {
[ToolboxData("<{0}:M1GridData runat=server></{0}:M1GridData>")]
public class M1GridData : WebControl {
public SqlDataSource Data1 { get; set; }
public SqlDataSource Data2 { get; set; }
public SqlDataSource Data3 { get; set; }
protected override void Render(HtmlTextWriter writer) {
writer.Write("Something");
}
}
}
My page code:
<cc1:M1GridData ID="M1GridData1" runat="server" />
<asp:SqlDataSource ID="SqlDataSource1" runat="server" />
Upvotes: 1
Views: 313
Reputation: 2025
I tried your code and it works fine. may be you need to restart your visual studio or reinstall the component.
also check Temporary ASP.NET Files
folder in each of frameworks you installed in C:\WINDOWS\Microsoft.NET\Framework\
and delete its content. sometimes ASP.NET
forgets to delete a cached dll and you get lots of non-sence errors because of that.
Upvotes: 1