I am trying to create a UserControl named DataSource to encapsulate a SqlDataSource. The UserControl has an InsertParameters property, among others. I have replaced 1 instance of SqlDataSource with DataSource in markup. The project builds with no errors.
I do get warnings. The first is
Content is not allowed between the opening and closing tags for element 'DataSource'.
This is a problem. I need content for things like InsertParameters. How can I get rid of the warning?
Let me explain further. I want to use markup to initialize the UserControl. I get warnings. I think I need a Composite Control instead of a UserControl. I am investigating.
swartzbill20...
Member
202 Points
102 Posts
wrapping SqlDataSource in a UserControl
Jul 06, 2011 04:27 PM|LINK
I am trying to create a UserControl named DataSource to encapsulate a SqlDataSource. The UserControl has an InsertParameters property, among others. I have replaced 1 instance of SqlDataSource with DataSource in markup. The project builds with no errors. I do get warnings. The first is
Content is not allowed between the opening and closing tags for element 'DataSource'.
This is a problem. I need content for things like InsertParameters. How can I get rid of the warning?
Bill
princeG
Star
9612 Points
1602 Posts
Re: wrapping SqlDataSource in a UserControl
Jul 06, 2011 05:12 PM|LINK
Check here with example
http://www.aspxcode.net/free-asp-net-data-sample-source-code.aspx?Topics=How%20to%20use%20SqlDataSource%20InsertParameters
msdn Example: http://msdn.microsoft.com/en-us/library/z72eefad.aspx
with control: http://www.codeproject.com/KB/aspnet/InsertSqlDataSource.aspx
swartzbill20...
Member
202 Points
102 Posts
Re: wrapping SqlDataSource in a UserControl
Jul 06, 2011 05:18 PM|LINK
Let me explain further. I want to use markup to initialize the UserControl. I get warnings. I think I need a Composite Control instead of a UserControl. I am investigating.
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: wrapping SqlDataSource in a UserControl
Jul 08, 2011 02:36 AM|LINK
You may then need to override
Jaisendme
Member
131 Points
31 Posts
Re: wrapping SqlDataSource in a UserControl
Jul 08, 2011 01:05 PM|LINK
Yes, You are right.
You have to use composite control.