irandokht 0 Newbie Poster

hi dears
i have two tables (Albums,Photos).when i want insert a record in a Photo table
i must select name of album so i create a user control that have a dropdownlist and a datasource until when i select a name of album put AlbumID in a Property
when i use this user control in details view in edittemplate i have an error
--->error
could not find control 'SelectedAlbum' in ControlParameter 'AlbumID'
my code id:

public partial class Admin_SelectedAlbum : System.Web.UI.UserControl
{
    public string SelectedValue    {
        get { return DropDownList1.SelectedValue; }
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}
...........
<asp:DetailsViewID="DetailsView2"runat="server"AutoGenerateRows="False"
DataKeyNames="PhotoID"DataSourceID="SqlDataSource3"Height="50px"
Width="125px">
<Fields>
<asp:BoundFieldDataField="PhotoID"HeaderText="PhotoID"
InsertVisible="False"ReadOnly="True"SortExpression="PhotoID"/>
<asp:TemplateFieldHeaderText="AlbumID"SortExpression="AlbumID">
[B]<EditItemTemplate>
<uc2:SelectedAlbumID="SelectedAlbum1"runat="server"/>
</EditItemTemplate>[/B]</asp:TemplateField>
<asp:CheckBoxFieldDataField="Visible"HeaderText="Visible"
SortExpression="Visible"/>
<asp:TemplateFieldHeaderText="Caption"SortExpression="Caption">
.........
....
</Fields>
<asp:SqlDataSourceID="SqlDataSource3"runat="server"
ConnectionString="<%$ ConnectionStrings:MisaghDBConnectionString1 %>"
DeleteCommand="DELETE FROM [Photos] WHERE [PhotoID] = @PhotoID"
InsertCommand="INSERT INTO [Photos] ([AlbumID], [Visible], [Caption]) VALUES (@AlbumID, @Visible, @Caption)"
ProviderName="<%$ ConnectionStrings:MisaghDBConnectionString1.Provid erName %>"
SelectCommand="SELECT [PhotoID], [AlbumID], [Visible], [Caption] FROM [Photos] where [PhotoID]=@PhotoID"
UpdateCommand="UPDATE [Photos] SET [AlbumID] = @AlbumID, [Visible] = @Visible, [Caption] = @Caption WHERE [PhotoID] = @PhotoID">
<DeleteParameters>
<asp:ParameterName="PhotoID"Type="Int32"/>
</DeleteParameters>
[B]InsertParameters>
<asp:ControlParameterType="Int32"Name="AlbumID"ControlID="SelectedAlbum1"PropertyName="SelectedValue"/>
<asp:ParameterName="Visible"Type="Boolean"/>
<asp:ParameterName="Caption"Type="String"/>
</InsertParameters>[/B]
<SelectParameters>
<asp:ControlParameterName="PhotoID"ControlID="DataList1"
PropertyName="SelectedValue"/>
</SelectParameters>
<UpdateParameters>
<asp:ControlParameterType="Int32"Name="AlbumID"ControlID="SelectedAlbum1"PropertyName="SelectedValue"/>
<asp:ParameterName="Visible"Type="Boolean"/>
<asp:ParameterName="Caption"Type="String"/>
<asp:ParameterName="PhotoID"Type="Int32"/>
</UpdateParameters>
</asp:SqlDataSource

whats your idea?
how do i resolve this problem?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.