<footertemplate>
<asp:DropDownList ID="inDataAssetIDFooter" runat="server" DataSourceID="dsDataAsset"
DataValueField="ID" DataTextField="Name" CssClass="DropDownList" AppendDataBoundItems="true">
<asp:ListItem Value="0">Select Data Asset</asp:ListItem>
</asp:DropDownList>
<asp:CompareValidator ID="vldDANameFooter" runat="server"
Operator="GreaterThan" ValueToCompare="0" ControlToValidate="inDataAssetIDFooter"
Text="*" ErrorMessage="Data Asset is Required"/>
</footertemplate>
<asp:ObjectDataSource ID="dsDataAsset" runat="server" SelectMethod="GetUnRelatedDataAssetsByAppID"
TypeName="MyProj.Lib.DataAssetDAL">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="PID" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
Thursday, October 30, 2008
Binding to a DropDown list in a Footer Row
I typically use a separate ObjectDataSource that I place outside the GridView for clarity and easy of access in the CodeBehind. Alternatively, you could load it by hand using FindControl or declaring an OnLoad handler.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment