I have a problem with timing. I have a GridView that I set the DataKeyName to the rows key value. My problem is that one of the dropdownlist’s in that row needs that key value. How do I go about getting the correct key value into the SqlDataSource? Right now it uses the default value so the dropdownlist is not populated.
Select statement –
<asp:SqlDataSource ID="SqlDataSource4" runat="server"
ConnectionString="<%$ ConnectionStrings:AuditDevConnectionString2 %>"
SelectCommand="sp_fc_vm_getSpokeTo" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" DefaultValue="-1" Name="DebtorKey"
PropertyName="SelectedValue" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
I figured out how to handle this by only using the dropdownlist when the row is in edit mode.