M
Mark Richards
I have a gridView that has 2 templated columns that contain drop-down lists. The first drop down list uses a value off of a formview on the same page for filtering. The 2nd drop-down is supposed to use the value off the first drop-down for it's parameter. I tried to add a parameter definition the same way I did referring to the FormView, but I get the following error:
DataBinding: 'System.Web.UI.WebControls.GridView' does not contain a property with the name 'DataKey'.
Offending Code:
<asp:ObjectDataSource ID="dsTarget" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTargetsForSite" TypeName="AL.clsSite">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="SiteID" PropertyName="DataKey("SiteID"" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
wheras this code works:
<asp:ObjectDataSource ID="dsSite" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetSitesForPublisher" TypeName="AL.clsSite">
<SelectParameters>
<asp:ControlParameter ControlID="FormView1" Name="PublisherID" PropertyName="DataKey("PublisherID"" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
So, first, is this the best way to get a value out of a formView ? 2nd, how do I get a value from the GridView ?
Thanks,
Mark Richards
DataBinding: 'System.Web.UI.WebControls.GridView' does not contain a property with the name 'DataKey'.
Offending Code:
<asp:ObjectDataSource ID="dsTarget" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetTargetsForSite" TypeName="AL.clsSite">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="SiteID" PropertyName="DataKey("SiteID"" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
wheras this code works:
<asp:ObjectDataSource ID="dsSite" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetSitesForPublisher" TypeName="AL.clsSite">
<SelectParameters>
<asp:ControlParameter ControlID="FormView1" Name="PublisherID" PropertyName="DataKey("PublisherID"" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
So, first, is this the best way to get a value out of a formView ? 2nd, how do I get a value from the GridView ?
Thanks,
Mark Richards