Vikram

Vikram

  • 1.5k
  • 276
  • 308.1k

DataList and SqlDataSource SelectCommand Parameter

May 27 2010 2:46 AM

Hi,
   In my application, I am using DataList. In Item Template I added One GridView and SqlDataSource to populate data in GridView. DataList having one DataKey field, I want to pass this DataKey Value to the SqlDataSource as Parameter.
 I tried this by Using Following:    
<SelectParameters>
                                                                                <%--<asp:Parameter  DefaultValue="" Name="LocatioID"  DbType="Int32" />--%>
                                                                                <asp:ControlParameter ControlID="dlJobsByLocation" Name="LocatioID" PropertyName="DataKeys[0]" />
                                                                                </SelectParameters>


<SelectParameters>
    <asp:ControlParameter ControlID="dataList" Name="ID" PropertyName="DataKeys[0]" />
</SelectParameters>
In above snippet I hard coded Property Name to DataKeys[0], due to this it return DataKey value of first row only.

    Here I need ProperyName which gives the DataKeys value for every row at the time of ItemDataBound. The Value 0 should be replaced with something  thats where I stuck.......


Any Help Appreciated.........


Thanks,
 VIkram

Answers (2)