M
Mark Richards
I posted this earlier, and got no response. Basically I need to be able to
grab a value from one of the fields in a gridView to populate a dropdown in
another column of the gridview:
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
grab a value from one of the fields in a gridView to populate a dropdown in
another column of the gridview:
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