SqlDataSourceID in templateField?
Posted on 2008-11-05
Say I have this GridView or DetailsView with a few templateField and the GridView or DetailsViews gets populated using the SqlDataSource with SqlDataSource1(<==automatic default name)
In editItem, I place a dropdownlist and bind it with a SqlDataSource. When this happends the SqlDatasource gets placed inside of edititem tag below the dropdownlist tag with the SqlDatasource1 id, even though SqlDatasource1 has been used up already.
And this runs fine.
But I create a second dropdownlist with another sqldatasource. Its sqldatasourceid gets named as SQlDatasource1 again.
But this time, debug complains that there are duplicate names.
1) Is there a difference between SqlDatasource being place inside of edititem than outside of gridview/or detailsview??
2) Why did it run ok when i had only one dropdownlist and with two same sqldatasource ids??
but didn't work when I had two dropdownlists??
3) Why did it create same SqlDatasourceid when I place th dropdownlist inside of the template?
when it usually automatically increment the id??