I have a custom control that contains a drop down. I have created a Public Property that's bindable for the drop down to control the SelectedValue of my drop down based on values from an ObjectdataSource. This works fine. What doesn't work is returning the value of the selected item in the Custom control's drop down to the same ObjectdataSource. It simply sends nothing back.
Here is my object data source:
<asp:ObjectDataSource ID="DetailData" runat="server"
InsertMethod="addTeamMembe
r"
SelectMethod="getTeamMembe
rDetail"
TypeName="ErgoWeb.TeamMemb
ers"
UpdateMethod="editTeamMemb
er">
<UpdateParameters>
<asp:Parameter Name="TeamID" Type="String" />
<asp:Parameter Name="Status" Type="String" />
<asp:Parameter Name="isChair" Type="String" />
<asp:Parameter Name="EmployeeID" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserGrid" Name="TeamID" PropertyName="SelectedValu
e"
Type="Int64" />
<asp:CookieParameter CookieName="EW_FacilityID"
Name="FacilityID" Type="Int64" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="EmployeeID" Type="String" />
<asp:Parameter Name="isChair" Type="String" />
<asp:Parameter Name="Status" Type="String" DefaultValue="1" />
<asp:CookieParameter CookieName="EW_FacilityID"
Name="FacilityID" Type="Int64" />
</InsertParameters>
</asp:ObjectDataSource>
Here is my configured User Control:
<uc1:TranslationElement
runat="server"
ID="isChairControl"
DoInline="false"
ElementType="dropdown"
ListType="YesNo"
ReturnAddress="Team.aspx"
SourceReference="YesNo"
SelectedValue='<%# Bind("isChair") %>' />
So far, so good. The control will be drawn properly with a drop down control and the correct selected value.
Here is the .ascx code for the control:
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="TranslationEle
ment.ascx.
vb" Inherits="ErgoWeb.Translat
ionElement
" %>
<asp:UpdatePanel ID="elementPanel" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<!--These are the controls for Inline translation -->
<asp:TextBox ID="elementString" runat="server" Visible="false" CssClass="tbox_up" />
<asp:LinkButton ID="SaveButton"
runat="Server" Text="Save" Visible="false"
Style="border: solid 1px gray; background-color:Blue; color: White; padding: 1px;" />
<asp:LinkButton ID="CancelButton"
runat="Server" Text="Cancel" Visible="false"
CausesValidation="false" Style="border: solid 1px gray; background-color:Blue; color: White; padding: 1px;"/>
<!--These are the controls: Depending on what the consumer has selected in ElementType -->
<asp:LinkButton ID="LinkButton1" runat="server" CssClass="linkButtonSingle
" Visible="false" />
<asp:Label ID="Label1" runat="server" Visible="false" />
<asp:Hyperlink ID="Hyperlink1" runat="server" Visible="False" />
<asp:DropdownList
ID="dropdownlist1"
runat="server"
visible="false"/>
<!--These are the controls to pass values if the control is configured to pass translation to the translation page-->
<asp:LinkButton ID="doTranslate" runat="server" Text="[trans]" Visible="false" CausesValidation="false" CssClass="transButton" />
<asp:HiddenField ID="sid" runat="server" />
<asp:HiddenField ID="sr" runat="server" />
<asp:HiddenField ID="ra" runat="server" />
<asp:HiddenField ID="selectedVal" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
I've tried to use asp:ControlParameter for the Update and Insert parameters in the ObjectDatasource. I've tried setting the ControlID to "dropdownlist1" and "isChairControl" with no success.
Is there a way to "return" a value for my control so it can be "consumed" by my ObjectdataSource?
Start Free Trial